Merge
authorduke
Sat, 09 Sep 2017 14:36:45 +0200
changeset 47213 57173ad5c534
parent 47212 000f4e4ddd39 (current diff)
parent 47211 75e8600f1136 (diff)
child 47214 22850b3a5524
Merge
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64RawNativeCallNode.java
hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64RawNativeCallNode.java
hotspot/src/share/vm/runtime/fprofiler.cpp
hotspot/src/share/vm/runtime/fprofiler.hpp
hotspot/test/runtime/MinimalVM/Xprof.java
jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package.html
jaxws/src/java.xml.bind/share/classes/javax/xml/bind/helpers/package.html
jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package.html
jdk/src/java.desktop/macosx/classes/apple/laf/AquaLookAndFeel.java
jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java
jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java
jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java
jdk/src/java.desktop/share/classes/com/sun/java/swing/Painter.java
jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/nimbus/AbstractRegionPainter.java
jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel.java
jdk/src/java.desktop/unix/native/libsunwjdga/dgalock.c
jdk/src/java.desktop/unix/native/libsunwjdga/jdga.h
jdk/src/java.desktop/unix/native/libsunwjdga/jdgadevice.h
jdk/src/java.desktop/windows/classes/sun/awt/windows/WColor.java
--- a/.hgtags-top-repo	Fri Sep 01 14:13:40 2017 +0000
+++ b/.hgtags-top-repo	Sat Sep 09 14:36:45 2017 +0200
@@ -446,3 +446,4 @@
 b656dea9398ef601f7fc08d1a5157a560e0ccbe0 jdk-9+181
 682e2a6df836f4731f92eb2ddcd467075047f6ea jdk-10+20
 90cdfe56f1543267a8005e638bd1b44551fda189 jdk-10+21
+8625e8491887bfd4310b2cfc2b84bac26312ba20 jdk-10+22
--- a/common/autoconf/configure.ac	Fri Sep 01 14:13:40 2017 +0000
+++ b/common/autoconf/configure.ac	Sat Sep 09 14:36:45 2017 +0200
@@ -209,6 +209,7 @@
 # Need toolchain to setup dtrace
 HOTSPOT_SETUP_DTRACE
 HOTSPOT_ENABLE_DISABLE_AOT
+HOTSPOT_ENABLE_DISABLE_CDS
 HOTSPOT_ENABLE_DISABLE_GTEST
 
 ###############################################################################
--- a/common/autoconf/generated-configure.sh	Fri Sep 01 14:13:40 2017 +0000
+++ b/common/autoconf/generated-configure.sh	Sat Sep 09 14:36:45 2017 +0200
@@ -702,6 +702,7 @@
 FIXPATH_DETACH_FLAG
 FIXPATH
 BUILD_GTEST
+ENABLE_CDS
 ENABLE_AOT
 GCOV_ENABLED
 ZIP_EXTERNAL_DEBUG_SYMBOLS
@@ -1191,6 +1192,7 @@
 enable_native_coverage
 enable_dtrace
 enable_aot
+enable_cds
 enable_hotspot_gtest
 with_stdc__lib
 with_msvcr_dll
@@ -1999,6 +2001,8 @@
                           enable ahead of time compilation feature. Default is
                           auto, where aot is enabled if all dependencies are
                           present.
+  --enable-cds[=yes/no]   enable class data sharing feature in non-minimal VM.
+                          Default is yes.
   --disable-hotspot-gtest Disables building of the Hotspot unit tests
   --disable-freetype-bundling
                           disable bundling of the freetype library with the
@@ -2016,7 +2020,8 @@
   --disable-generate-classlist
                           forces enabling or disabling of the generation of a
                           CDS classlist at build time. Default is to generate
-                          it when either the server or client JVMs are built.
+                          it when either the server or client JVMs are built
+                          and enable-cds is true.
   --enable-sjavac         use sjavac to do fast incremental compiles
                           [disabled]
   --disable-javac-server  disable javac server [enabled]
@@ -4295,7 +4300,7 @@
 
 # All valid JVM features, regardless of platform
 VALID_JVM_FEATURES="compiler1 compiler2 zero shark minimal dtrace jvmti jvmci \
-    graal fprof vm-structs jni-check services management all-gcs nmt cds \
+    graal vm-structs jni-check services management all-gcs nmt cds \
     static-build link-time-opt aot"
 
 # All valid JVM variants
@@ -4345,6 +4350,11 @@
 #
 
 
+################################################################################
+# Allow to disable CDS
+#
+
+
 ###############################################################################
 # Set up all JVM features for each JVM variant.
 #
@@ -5151,7 +5161,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1504187184
+DATE_WHEN_GENERATED=1504441177
 
 ###############################################################################
 #
@@ -54216,6 +54226,23 @@
 
 
 
+  # Check whether --enable-cds was given.
+if test "${enable_cds+set}" = set; then :
+  enableval=$enable_cds;
+fi
+
+
+  if test "x$enable_cds" = "x" || test "x$enable_cds" = "xyes"; then
+    ENABLE_CDS="true"
+  elif test "x$enable_cds" = "xno"; then
+    ENABLE_CDS="false"
+  else
+    as_fn_error $? "Invalid value for --enable-cds: $enable_cds" "$LINENO" 5
+  fi
+
+
+
+
   # Check whether --enable-hotspot-gtest was given.
 if test "${enable_hotspot_gtest+set}" = set; then :
   enableval=$enable_hotspot_gtest;
@@ -65810,8 +65837,12 @@
     fi
     INCLUDE_GRAAL="true"
   else
-    # By default enable graal build where AOT is available
-    if test "x$ENABLE_AOT" = "xtrue"; then
+    # By default enable graal build on linux-x64 or where AOT is available.
+    # graal build requires jvmci.
+    if test "x$JVM_FEATURES_jvmci" = "xjvmci" && \
+        (test "x$OPENJDK_TARGET_CPU" = "xx86_64" && \
+         test "x$OPENJDK_TARGET_OS" = "xlinux" || \
+         test "x$ENABLE_AOT" = "xtrue") ; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
       JVM_FEATURES_graal="graal"
@@ -65856,7 +65887,10 @@
   fi
 
   # All variants but minimal (and custom) get these features
-  NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti fprof vm-structs jni-check services management all-gcs nmt cds"
+  NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti vm-structs jni-check services management all-gcs nmt"
+  if test "x$ENABLE_CDS" = "xtrue"; then
+    NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cds"
+  fi
 
   # Enable features depending on variant.
   JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal"
@@ -65960,7 +65994,7 @@
 
   # Check if it's likely that it's possible to generate the classlist. Depending
   # on exact jvm configuration it could be possible anyway.
-  if   [[ " $JVM_VARIANTS " =~ " server " ]]   ||   [[ " $JVM_VARIANTS " =~ " client " ]]  ; then
+  if test "x$ENABLE_CDS" = "xtrue" && (  [[ " $JVM_VARIANTS " =~ " server " ]]   ||   [[ " $JVM_VARIANTS " =~ " client " ]]  ); then
     ENABLE_GENERATE_CLASSLIST_POSSIBLE="true"
   else
     ENABLE_GENERATE_CLASSLIST_POSSIBLE="false"
@@ -65973,8 +66007,8 @@
 $as_echo "yes, forced" >&6; }
     ENABLE_GENERATE_CLASSLIST="true"
     if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xfalse"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS" >&5
-$as_echo "$as_me: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS" >&2;}
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS and enable-cds=$ENABLE_CDS" >&5
+$as_echo "$as_me: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS and enable-cds=$ENABLE_CDS" >&2;}
     fi
   elif test "x$enable_generate_classlist" = "xno"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, forced" >&5
--- a/common/autoconf/hotspot.m4	Fri Sep 01 14:13:40 2017 +0000
+++ b/common/autoconf/hotspot.m4	Sat Sep 09 14:36:45 2017 +0200
@@ -25,7 +25,7 @@
 
 # All valid JVM features, regardless of platform
 VALID_JVM_FEATURES="compiler1 compiler2 zero shark minimal dtrace jvmti jvmci \
-    graal fprof vm-structs jni-check services management all-gcs nmt cds \
+    graal vm-structs jni-check services management all-gcs nmt cds \
     static-build link-time-opt aot"
 
 # All valid JVM variants
@@ -240,6 +240,25 @@
   AC_SUBST(ENABLE_AOT)
 ])
 
+################################################################################
+# Allow to disable CDS
+#
+AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_CDS],
+[
+  AC_ARG_ENABLE([cds], [AS_HELP_STRING([--enable-cds@<:@=yes/no@:>@],
+      [enable class data sharing feature in non-minimal VM. Default is yes.])])
+
+  if test "x$enable_cds" = "x" || test "x$enable_cds" = "xyes"; then
+    ENABLE_CDS="true"
+  elif test "x$enable_cds" = "xno"; then
+    ENABLE_CDS="false"
+  else
+    AC_MSG_ERROR([Invalid value for --enable-cds: $enable_cds])
+  fi
+
+  AC_SUBST(ENABLE_CDS)
+])
+
 ###############################################################################
 # Set up all JVM features for each JVM variant.
 #
@@ -335,8 +354,12 @@
     fi
     INCLUDE_GRAAL="true"
   else
-    # By default enable graal build where AOT is available
-    if test "x$ENABLE_AOT" = "xtrue"; then
+    # By default enable graal build on linux-x64 or where AOT is available.
+    # graal build requires jvmci.
+    if test "x$JVM_FEATURES_jvmci" = "xjvmci" && \
+        (test "x$OPENJDK_TARGET_CPU" = "xx86_64" && \
+         test "x$OPENJDK_TARGET_OS" = "xlinux" || \
+         test "x$ENABLE_AOT" = "xtrue") ; then
       AC_MSG_RESULT([yes])
       JVM_FEATURES_graal="graal"
       INCLUDE_GRAAL="true"
@@ -374,7 +397,10 @@
   fi
 
   # All variants but minimal (and custom) get these features
-  NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti fprof vm-structs jni-check services management all-gcs nmt cds"
+  NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti vm-structs jni-check services management all-gcs nmt"
+  if test "x$ENABLE_CDS" = "xtrue"; then
+    NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cds"
+  fi                                            
 
   # Enable features depending on variant.
   JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal"
--- a/common/autoconf/jdk-options.m4	Fri Sep 01 14:13:40 2017 +0000
+++ b/common/autoconf/jdk-options.m4	Sat Sep 09 14:36:45 2017 +0200
@@ -496,11 +496,12 @@
 [
   AC_ARG_ENABLE([generate-classlist], [AS_HELP_STRING([--disable-generate-classlist],
       [forces enabling or disabling of the generation of a CDS classlist at build time.
-      Default is to generate it when either the server or client JVMs are built.])])
+      Default is to generate it when either the server or client JVMs are built and
+      enable-cds is true.])])
 
   # Check if it's likely that it's possible to generate the classlist. Depending
   # on exact jvm configuration it could be possible anyway.
-  if HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client); then
+  if test "x$ENABLE_CDS" = "xtrue" && (HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client)); then
     ENABLE_GENERATE_CLASSLIST_POSSIBLE="true"
   else
     ENABLE_GENERATE_CLASSLIST_POSSIBLE="false"
@@ -511,7 +512,7 @@
     AC_MSG_RESULT([yes, forced])
     ENABLE_GENERATE_CLASSLIST="true"
     if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xfalse"; then
-      AC_MSG_WARN([Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS])
+      AC_MSG_WARN([Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS and enable-cds=$ENABLE_CDS])
     fi
   elif test "x$enable_generate_classlist" = "xno"; then
     AC_MSG_RESULT([no, forced])
--- a/common/conf/jib-profiles.js	Fri Sep 01 14:13:40 2017 +0000
+++ b/common/conf/jib-profiles.js	Sat Sep 09 14:36:45 2017 +0200
@@ -818,6 +818,49 @@
             }
         },
 
+        "macosx-x64-open": {
+            artifacts: {
+                jdk: {
+                    local: "bundles/\\(jdk.*bin.tar.gz\\)",
+                    remote: [
+                        "bundles/openjdk/GPL/osx-x64/jdk-" + data.version
+                            + "_osx-x64_bin.tar.gz",
+                        "bundles/openjdk/GPL/osx-x64/\\1"
+                    ],
+                    subdir: "jdk-" + data.version
+                },
+                jre: {
+                    local: "bundles/\\(jre.*bin.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/osx-x64/\\1",
+                },
+                test: {
+                    local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
+                    remote: [
+                        "bundles/openjdk/GPL/osx-x64/jdk-" + data.version
+                            + "_osx-x64_bin-tests.tar.gz",
+                        "bundles/openjdk/GPL/osx-x64/\\1"
+                    ]
+                },
+                jdk_symbols: {
+                    local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+                    remote: [
+                        "bundles/openjdk/GPL/osx-x64/jdk-" + data.version
+                            + "_osx-x64_bin-symbols.tar.gz",
+                        "bundles/openjdk/GPL/osx-x64/\\1"
+                    ],
+                    subdir: "jdk-" + data.version
+                },
+                jre_symbols: {
+                    local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/osx-x64/\\1",
+                },
+                doc_api_spec: {
+                    local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)",
+                    remote: "bundles/openjdk/GPL/osx-x64/\\1",
+                },
+            }
+        },
+
         "windows-x86-open": {
             artifacts: {
                 jdk: {
@@ -884,10 +927,11 @@
     profiles["linux-x64-ri"] = clone(profiles["linux-x64-open"]);
     profiles["linux-x86-ri"] = clone(profiles["linux-x86-open"]);
     profiles["linux-x86-ri-debug"] = clone(profiles["linux-x86-open-debug"]);
+    profiles["macosx-x64-ri"] = clone(profiles["macosx-x64-open"]);
     profiles["windows-x86-ri"] = clone(profiles["windows-x86-open"]);
 
     // Generate artifacts for ri profiles
-    [ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "windows-x86-ri" ]
+    [ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "macosx-x64-ri", "windows-x86-ri" ]
         .forEach(function (name) {
             // Rewrite all remote dirs to "bundles/openjdk/BCL/..."
             for (artifactName in profiles[name].artifacts) {
--- a/corba/.hgtags	Fri Sep 01 14:13:40 2017 +0000
+++ b/corba/.hgtags	Sat Sep 09 14:36:45 2017 +0200
@@ -446,3 +446,4 @@
 ba71941ad9dba53b8fffb30602ef673eee88696c jdk-9+181
 7a54ec280513a33e49e60546c0cf9ca573925a43 jdk-10+20
 68b5f8eeac3325c02aac2f4b452b8a37c20c970e jdk-10+21
+1f4456d51b07098af1848d0d968084b1e9b85a36 jdk-10+22
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java	Sat Sep 09 14:36:45 2017 +0200
@@ -85,15 +85,15 @@
  * three {@code init} methods.  Two of the three methods use the properties
  * (associations of a name with a value) shown in the
  * table below.<BR>
- * <TABLE class="plain">
- * <CAPTION>Standard Java CORBA Properties:</CAPTION>
+ * <TABLE class="striped">
+ * <CAPTION>Standard Java CORBA Properties</CAPTION>
  * <thead>
- * <TR><TH>Property Name</TH>   <TH>Property Value</TH></TR>
+ * <TR><TH scope="col">Property Name</TH>   <TH scope="col">Property Value</TH></TR>
  * </thead>
- * <tbody>
- *     <TR><TD>org.omg.CORBA.ORBClass</TD>
+ * <tbody style="text-align:left">
+ *     <TR><TH scope="row">org.omg.CORBA.ORBClass</TH>
  *     <TD>class name of an ORB implementation</TD></TR>
- *     <TR><TD>org.omg.CORBA.ORBSingletonClass</TD>
+ *     <TR><TH scope="row">org.omg.CORBA.ORBSingletonClass</TH>
  *     <TD>class name of the ORB returned by {@code init()}</TD></TR>
  * </tbody>
  * </TABLE>
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/TCKind.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TCKind.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -237,175 +237,175 @@
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_null</code>.
+     * initialized with {@code TCKind._tk_null}.
      */
     public static final TCKind tk_null = new TCKind(_tk_null);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_void</code>.
+     * initialized with {@code TCKind._tk_void}.
      */
     public static final TCKind tk_void = new TCKind(_tk_void);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_short</code>.
+     * initialized with {@code TCKind._tk_short}.
      */
     public static final TCKind tk_short = new TCKind(_tk_short);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_long</code>.
+     * initialized with {@code TCKind._tk_long}.
      */
     public static final TCKind tk_long = new TCKind(_tk_long);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_ushort</code>.
+     * initialized with {@code TCKind._tk_ushort}.
      */
     public static final TCKind tk_ushort = new TCKind(_tk_ushort);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_ulong</code>.
+     * initialized with {@code TCKind._tk_ulong}.
      */
     public static final TCKind tk_ulong = new TCKind(_tk_ulong);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_float</code>.
+     * initialized with {@code TCKind._tk_float}.
      */
     public static final TCKind tk_float = new TCKind(_tk_float);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_double</code>.
+     * initialized with {@code TCKind._tk_double}.
      */
     public static final TCKind tk_double = new TCKind(_tk_double);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_boolean</code>.
+     * initialized with {@code TCKind._tk_boolean}.
      */
     public static final TCKind tk_boolean = new TCKind(_tk_boolean);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_char</code>.
+     * initialized with {@code TCKind._tk_char}.
      */
     public static final TCKind tk_char = new TCKind(_tk_char);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_octet</code>.
+     * initialized with {@code TCKind._tk_octet}.
      */
     public static final TCKind tk_octet = new TCKind(_tk_octet);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_any</code>.
+     * initialized with {@code TCKind._tk_any}.
      */
     public static final TCKind tk_any = new TCKind(_tk_any);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_TypeCode</code>.
+     * initialized with {@code TCKind._tk_TypeCode}.
      */
     public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_Principal</code>.
+     * initialized with {@code TCKind._tk_Principal}.
      */
     public static final TCKind tk_Principal = new TCKind(_tk_Principal);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_objref</code>.
+     * initialized with {@code TCKind._tk_objref}.
      */
     public static final TCKind tk_objref = new TCKind(_tk_objref);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_struct</code>.
+     * initialized with {@code TCKind._tk_struct}.
      */
     public static final TCKind tk_struct = new TCKind(_tk_struct);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_union</code>.
+     * initialized with {@code TCKind._tk_union}.
      */
     public static final TCKind tk_union = new TCKind(_tk_union);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_enum</code>.
+     * initialized with {@code TCKind._tk_enum}.
      */
     public static final TCKind tk_enum = new TCKind(_tk_enum);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_string</code>.
+     * initialized with {@code TCKind._tk_string}.
      */
     public static final TCKind tk_string = new TCKind(_tk_string);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_sequence</code>.
+     * initialized with {@code TCKind._tk_sequence}.
      */
     public static final TCKind tk_sequence = new TCKind(_tk_sequence);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_array</code>.
+     * initialized with {@code TCKind._tk_array}.
      */
     public static final TCKind tk_array = new TCKind(_tk_array);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_alias</code>.
+     * initialized with {@code TCKind._tk_alias}.
      */
     public static final TCKind tk_alias = new TCKind(_tk_alias);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_except</code>.
+     * initialized with {@code TCKind._tk_except}.
      */
     public static final TCKind tk_except = new TCKind(_tk_except);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_longlong</code>.
+     * initialized with {@code TCKind._tk_longlong}.
      */
     public static final TCKind tk_longlong = new TCKind(_tk_longlong);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_ulonglong</code>.
+     * initialized with {@code TCKind._tk_ulonglong}.
      */
     public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_longdouble</code>.
+     * initialized with {@code TCKind._tk_longdouble}.
      */
     public static final TCKind tk_longdouble = new TCKind(_tk_longdouble);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_wchar</code>.
+     * initialized with {@code TCKind._tk_wchar}.
      */
     public static final TCKind tk_wchar = new TCKind(_tk_wchar);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_wstring</code>.
+     * initialized with {@code TCKind._tk_wstring}.
      */
     public static final TCKind tk_wstring = new TCKind(_tk_wstring);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_fixed</code>.
+     * initialized with {@code TCKind._tk_fixed}.
      */
     public static final TCKind tk_fixed = new TCKind(_tk_fixed);
 
@@ -413,26 +413,26 @@
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_value</code>.
+     * initialized with {@code TCKind._tk_value}.
      */
     public static final TCKind tk_value = new TCKind(_tk_value);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_value_box</code>.
+     * initialized with {@code TCKind._tk_value_box}.
      */
     public static final TCKind tk_value_box = new TCKind(_tk_value_box);
     // orbos 98-01-18: Objects By Value -- end
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_native</code>.
+     * initialized with {@code TCKind._tk_native}.
      */
     public static final TCKind tk_native = new TCKind(_tk_native);
 
     /**
      * The <code>TCKind</code> constant whose <code>value</code> field is
-     * initialized with <code>TCKind._tk_abstract_interface</code>.
+     * initialized with {@code TCKind._tk_abstract_interface}.
      */
     public static final TCKind tk_abstract_interface = new TCKind(_tk_abstract_interface);
 
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html	Fri Sep 01 14:13:40 2017 +0000
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html	Sat Sep 09 14:36:45 2017 +0200
@@ -1,10 +1,10 @@
 <!doctype html>
-<html>
+<html lang="en">
 <head>
    <meta http-equiv="Content-Type" content="text/html">
    <title>Official Specifications for CORBA support in Java[tm] SE 6</title>
 </head>
-<body bgcolor="#FFFFFF">
+<body>
 
 <h1>
 Official Specifications for CORBA support in Java[tm] SE 6</h1>
--- a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html	Fri Sep 01 14:13:40 2017 +0000
+++ b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html	Sat Sep 09 14:36:45 2017 +0200
@@ -1,17 +1,17 @@
 <!doctype html>
-<html>
+<html lang="en">
 <head>
    <meta http-equiv="Content-Type" content="text/html">
    <title>IDL-to-Java Generated Files</title>
 </head>
-<body bgcolor="#FFFFFF">
+<body>
 
 <H1>IDL-to-Java Generated Files</H1>
 
 <P>The files that are generated by the IDL-to-Java compiler, in accordance with 
 the <em><a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">
 IDL-to-Java Language Mapping Specification</a></em>,
-which is implemented in Java<sup><font size="-2">TM</font></sup> SE 6 
+which is implemented in Java&trade; SE 6 
 according the <a href="compliance.html">compliance</a> document.
 
 
--- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl	Fri Sep 01 14:13:40 2017 +0000
+++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl	Sat Sep 09 14:36:45 2017 +0200
@@ -584,7 +584,7 @@
    * <caption style="display:none">Shows the validity of each attribute or operation</caption>
    *  <thead>
    *    <tr>
-   *      <th>&nbsp;</th>
+   *      <td></td>
    *      <th id="send_req">send_request</th>
    *      <th id="send_poll">send_poll</th>
    *      <th id="rec_reply">receive_reply</th>
@@ -592,182 +592,176 @@
    *      <th id="rec_oth">receive_other</th>
    *    </tr>
    *  </thead>
-   *  <tbody>
+   *  <tbody style="text-align:left">
    *
    *  <tr>
-   *     <td id="ri" colspan=6><i>Inherited from RequestInfo:</i></td>
+   *     <th id="ri" colspan=6><i>Inherited from RequestInfo:</i></th>
    *  </tr>
    * 
-   *  <tr><th id="req_id"><p style="text-align:left">request_id</p></th>
+   *  <tr><th id="req_id">request_id</th>
    *  <td headers="ri req_id send_req">yes</td> 
    *  <td headers="ri req_id send_poll">yes</td> 
    *  <td headers="ri req_id rec_reply">yes</td> 
    *  <td headers="ri req_id rec_ex">yes</td> 
    *  <td headers="ri req_id rec_oth">yes</td></tr>
    * 
-   *  <tr><th id="op"><p style="text-align:left">operation</p></th>
+   *  <tr><th id="op">operation</th>
    *  <td headers="ri op send_req">yes</td> 
    *  <td headers="ri op send_poll">yes</td> 
    *  <td headers="ri op rec_reply">yes</td> 
    *  <td headers="ri op rec_ex">yes</td> 
    *  <td headers="ri op rec_oth">yes</td></tr>
    *
-   *  <tr><th id="arg"><p style="text-align:left">arguments</p></th>
+   *  <tr><th id="arg">arguments</th>
    *  <td headers="ri arg send_req">yes<sub>1</sub></td>
    *  <td headers="ri arg send_poll">no </td> 
    *  <td headers="ri arg rec_reply">yes</td> 
    *  <td headers="ri arg rec_ex">no </td> 
    *  <td headers="ri arg rec_oth">no </td></tr>
    *
-   *  <tr><th id="exc"><p style="text-align:left">exceptions</p></th>
+   *  <tr><th id="exc">exceptions</th>
    *  <td headers="ri exc send_req">yes</td> 
    *  <td headers="ri exc send_poll">no </td> 
    *  <td headers="ri exc rec_reply">yes</td> 
    *  <td headers="ri exc rec_ex">yes</td> 
    *  <td headers="ri exc rec_oth">yes</td></tr>
    *
-   *  <tr><th id="con"><p style="text-align:left">contexts</p></th>
+   *  <tr><th id="con">contexts</th>
    *  <td headers="ri con send_req">yes</td> 
    *  <td headers="ri con send_poll">no </td> 
    *  <td headers="ri con rec_reply">yes</td> 
    *  <td headers="ri con rec_ex">yes</td> 
    *  <td headers="ri con rec_oth">yes</td></tr>
    *
-   *  <tr><th id="op_con"><p style="text-align:left">operation_context</p></th>
+   *  <tr><th id="op_con">operation_context</th>
    *  <td headers="ri op_con send_req">yes</td> 
    *  <td headers="ri op_con send_poll">no </td> 
    *  <td headers="ri op_con rec_reply">yes</td> 
    *  <td headers="ri op_con rec_ex">yes</td> 
-   *  <td headers="ri op_con rec_oth">yes</td>
-   *  </tr>
+   *  <td headers="ri op_con rec_oth">yes</td></tr>
    *
-   *  <tr><th id="result"><p style="text-align:left">result</p></th>
+   *  <tr><th id="result">result</th>
    *  <td headers="ri result send_req">no </td> 
    *  <td headers="ri result send_poll">no </td> 
    *  <td headers="ri result rec_reply">yes</td> 
    *  <td headers="ri result rec_ex">no </td> 
-   *  <td headers="ri result rec_oth">no </td>
-   *  </tr>
+   *  <td headers="ri result rec_oth">no </td></tr>
    *
-   *  <tr><th id="res_exp"><p style="text-align:left">response_expected</p></th>
+   *  <tr><th id="res_exp">response_expected</th>
    *  <td headers="ri res_exp send_req">yes</td> 
    *  <td headers="ri res_exp send_poll">yes</td> 
    *  <td headers="ri res_exp rec_reply">yes</td> 
    *  <td headers="ri res_exp rec_ex">yes</td> 
    *  <td headers="ri res_exp rec_oth">yes</td></tr>
    *
-   *  <tr><th id="sync_sco"><p style="text-align:left">sync_scope</p></th>
+   *  <tr><th id="sync_sco">sync_scope</th>
    *  <td headers="ri sync_sco send_req">yes</td> 
    *  <td headers="ri sync_sco send_poll">no </td> 
    *  <td headers="ri sync_sco rec_reply">yes</td> 
    *  <td headers="ri sync_sco rec_ex">yes</td> 
-   *  <td headers="ri sync_sco rec_oth">yes</td>
-   *  </tr>
+   *  <td headers="ri sync_sco rec_oth">yes</td></tr>
    *
-   *  <tr><th id="rep_stat"><p style="text-align:left">reply_status</p></th>
+   *  <tr><th id="rep_stat">reply_status</th>
    *  <td headers="ri rep_stat send_req">no </td> 
    *  <td headers="ri rep_stat send_poll">no </td> 
    *  <td headers="ri rep_stat rec_reply">yes</td> 
    *  <td headers="ri rep_stat rec_ex">yes</td> 
    *  <td headers="ri rep_stat rec_oth">yes</td></tr>
    *
-   *  <tr><th id="for_ref"><p style="text-align:left">forward_reference</p></th>
+   *  <tr><th id="for_ref">forward_reference</th>
    *  <td headers="ri for_ref send_req">no </td>
    *  <td headers="ri for_ref send_poll">no </td> 
    *  <td headers="ri for_ref rec_reply">no </td> 
    *  <td headers="ri for_ref rec_ex">no </td> 
-   *  <td headers="ri for_ref rec_oth">yes<sub>2</sub>
-   *  </td></tr>
+   *  <td headers="ri for_ref rec_oth">yes<sub>2</sub></td></tr>
    *
-   *  <tr><th id="get_slot"><p style="text-align:left">get_slot</p></th>
+   *  <tr><th id="get_slot">get_slot</th>
    *  <td headers="ri get_slot send_req">yes</td> 
    *  <td headers="ri get_slot send_poll">yes</td> 
    *  <td headers="ri get_slot rec_reply">yes</td> 
    *  <td headers="ri get_slot rec_ex">yes</td> 
    *  <td headers="ri get_slot rec_oth">yes</td></tr>
    *
-   *  <tr><th id="grsc"><p style="text-align:left">get_request_service_context</p></th>
+   *  <tr><th id="grsc">get_request_service_context</th>
    *  <td headers="ri grsc send_req">yes</td> 
    *  <td headers="ri grsc send_poll">no </td> 
    *  <td headers="ri grsc rec_reply">yes</td> 
    *  <td headers="ri grsc rec_ex">yes</td> 
    *  <td headers="ri grsc rec_oth">yes</td></tr>
    *
-   *  <tr><th id="gpsc"><p style="text-align:left">get_reply_service_context</p></th>
+   *  <tr><th id="gpsc">get_reply_service_context</th>
    *  <td headers="ri gpsc send_req">no </td> 
    *  <td headers="ri gpsc send_poll">no </td> 
    *  <td headers="ri gpsc rec_reply">yes</td> 
    *  <td headers="ri gpsc rec_ex">yes</td> 
-   *  <td headers="ri gpsc rec_oth">yes</td>
-   *  </tr>
+   *  <td headers="ri gpsc rec_oth">yes</td></tr>
    *
    *  <tr>
-   *    <td id="cri" colspan=6><i>ClientRequestInfo-specific:</i></td>
+   *    <th id="cri" colspan=6><i>ClientRequestInfo-specific:</i></th>
    *  </tr>
    *
-   *  <tr><th id="target"><p style="text-align:left">target</p></th>
+   *  <tr><th id="target">target</th>
    *  <td headers="cri target send_req">yes</td> 
    *  <td headers="cri target send_poll">yes</td> 
    *  <td headers="cri target rec_reply">yes</td> 
    *  <td headers="cri target rec_ex">yes</td> 
    *  <td headers="cri target rec_oth">yes</td></tr>
    *
-   *  <tr><th id="eftarget"><p style="text-align:left">effective_target</p></th>
+   *  <tr><th id="eftarget">effective_target</th>
    *  <td headers="cri eftarget send_req">yes</td> 
    *  <td headers="cri eftarget send_poll">yes</td> 
    *  <td headers="cri eftarget rec_reply">yes</td> 
    *  <td headers="cri eftarget rec_ex">yes</td> 
-   *  <td headers="cri eftarget rec_oth">yes</td>
-   *  </tr>
+   *  <td headers="cri eftarget rec_oth">yes</td></tr>
    *
-   *  <tr><th id="efprof"><p style="text-align:left">effective_profile</p></th>
+   *  <tr><th id="efprof">effective_profile</th>
    *  <td headers="cri efprof send_req">yes</td> 
    *  <td headers="cri efprof send_poll">yes</td> 
    *  <td headers="cri efprof rec_reply">yes</td> 
    *  <td headers="cri efprof rec_ex">yes</td> 
    *  <td headers="cri efprof rec_oth">yes</td></tr>
    *
-   *  <tr><th id="rxp"><p style="text-align:left">received_exception</p></th>
+   *  <tr><th id="rxp">received_exception</th>
    *  <td headers="cri rxp send_req">no </td> 
    *  <td headers="cri rxp send_poll">no </td> 
    *  <td headers="cri rxp rec_reply">no </td> 
    *  <td headers="cri rxp rec_ex">yes</td> 
    *  <td headers="cri rxp rec_oth">no </td></tr>
    *
-   *  <tr><th id="rei"><p style="text-align:left">received_exception_id</p></th>
+   *  <tr><th id="rei">received_exception_id</th>
    *  <td headers="cri rei send_req">no </td> 
    *  <td headers="cri rei send_poll">no </td> 
    *  <td headers="cri rei rec_reply">no </td> 
    *  <td headers="cri rei rec_ex">yes</td> 
    *  <td headers="cri rei rec_oth">no </td></tr>
    *
-   *  <tr><th id="gec"><p style="text-align:left">get_effective_component</p></th>
+   *  <tr><th id="gec">get_effective_component</th>
    *  <td headers="cri gec send_req">yes</td> 
    *  <td headers="cri gec send_poll">no </td> 
    *  <td headers="cri gec rec_reply">yes</td> 
    *  <td headers="cri gec rec_ex">yes</td> 
    *  <td headers="cri gec rec_oth">yes</td></tr>
    *
-   *  <tr><th id="gecs"><p style="text-align:left">get_effective_components</p></th>
+   *  <tr><th id="gecs">get_effective_components</th>
    *  <td headers="cri gecs send_req">yes</td> 
    *  <td headers="cri gecs send_poll">no </td> 
    *  <td headers="cri gecs rec_reply">yes</td> 
    *  <td headers="cri gecs rec_ex">yes</td> 
    *  <td headers="cri gecs rec_oth">yes</td></tr>
    *
-   *  <tr><th id="grpcy"><p style="text-align:left">get_request_policy</p></th>
+   *  <tr><th id="grpcy">get_request_policy</th>
    *  <td headers="cri grpcy send_req">yes</td>
    *  <td headers="cri grpcy send_poll">no </td> 
    *  <td headers="cri grpcy rec_reply">yes</td> 
    *  <td headers="cri grpcy rec_ex">yes</td> 
    *  <td headers="cri grpcy rec_oth">yes</td></tr>
    *
-   *  <tr><th id="arsc"><p style="text-align:left">add_request_service_context</p></th>
-   *    <td headers="cri arsc send_req">yes</td> 
-   *    <td headers="cri arsc send_poll">no </td> 
-   *    <td headers="cri arsc rec_reply">no </td> 
-   *    <td headers="cri arsc rec_ex">no </td> 
-   *    <td headers="cri arsc rec_oth">no </td></tr>
+   *  <tr><th id="arsc">add_request_service_context</th>
+   *  <td headers="cri arsc send_req">yes</td> 
+   *  <td headers="cri arsc send_poll">no </td> 
+   *  <td headers="cri arsc rec_reply">no </td> 
+   *  <td headers="cri arsc rec_ex">no </td> 
+   *  <td headers="cri arsc rec_oth">no </td></tr>
    *
    *   </tbody>
    * </table>
@@ -940,7 +934,7 @@
    *   <caption style="display:none">Shows the validity of each attribute or operation</caption>
    *   <thead>
    *     <tr>
-   *       <th>&nbsp;</th>
+   *       <td></td>
    *       <th id="rec_req_ser_con" valign="bottom">receive_request_<br>service_contexts</th>
    *       <th id="rec_req"  valign="bottom">receive_request</th>
    *       <th id="send_rep" valign="bottom">send_reply</th>
@@ -948,28 +942,28 @@
    *       <th id="send_oth" valign="bottom">send_other</th>
    *     </tr>
    *   </thead>
-   *  <tbody>
+   *  <tbody style="text-align:left">
    *
    *
    * <tr>
-   *   <td id="ri" colspan=6><i>Inherited from RequestInfo:</i></td>
+   *   <th id="ri" colspan=6><i>Inherited from RequestInfo:</i></th>
    * </tr>
    *
-   * <tr><th id="req_id"><p style="text-align:left">request_id</p></th>
+   * <tr><th id="req_id">request_id</th>
    * <td headers="ri req_id rec_req_ser_con">yes</td> 
    * <td headers="ri req_id rec_req">yes</td> 
    * <td headers="ri req_id send_rep">yes</td> 
    * <td headers="ri req_id send_exc">yes</td> 
    * <td headers="ri req_id send_oth">yes</td></tr>
    *
-   * <tr><th id="op"><p style="text-align:left">operation</p></th>
+   * <tr><th id="op">operation</th>
    * <td headers="ri op rec_req_ser_con">yes</td> 
    * <td headers="ri op rec_req">yes</td> 
    * <td headers="ri op send_rep">yes</td> 
    * <td headers="ri op send_exc">yes</td> 
    * <td headers="ri op send_oth">yes</td></tr>
    *
-   * <tr><th id="args"><p style="text-align:left">arguments</p></th>
+   * <tr><th id="args">arguments</th>
    * <td headers="ri args rec_req_ser_con">no </td> 
    * <td headers="ri args rec_req">yes<sub>1</sub></td>
    * <td headers="ri args send_rep">yes</td> 
@@ -977,21 +971,21 @@
    * <td headers="ri args send_oth">no<sub>2</sub>
    * </td></tr>
    *
-   * <tr><th id="exps"><p style="text-align:left">exceptions</p></th>
+   * <tr><th id="exps">exceptions</th>
    * <td headers="ri exps rec_req_ser_con">no </td> 
    * <td headers="ri exps rec_req">yes</td> 
    * <td headers="ri exps send_rep">yes</td> 
    * <td headers="ri exps send_exc">yes</td> 
    * <td headers="ri exps send_oth">yes</td></tr>
    *
-   * <tr><th id="contexts"><p style="text-align:left">contexts</p></th>
+   * <tr><th id="contexts">contexts</th>
    * <td headers="ri contexts rec_req_ser_con">no </td> 
    * <td headers="ri contexts rec_req">yes</td> 
    * <td headers="ri contexts send_rep">yes</td> 
    * <td headers="ri contexts send_exc">yes</td> 
    * <td headers="ri contexts send_oth">yes</td></tr>
    *
-   * <tr><th id="op_con"><p style="text-align:left">operation_context</p></th>
+   * <tr><th id="op_con">operation_context</th>
    * <td headers="ri op_con rec_req_ser_con">no </td> 
    * <td headers="ri op_con rec_req">yes</td> 
    * <td headers="ri op_con send_rep">yes</td> 
@@ -999,7 +993,7 @@
    * <td headers="ri op_con send_oth">no </td>
    * </tr>
    * 
-   * <tr><th id="result"><p style="text-align:left">result</p></th>
+   * <tr><th id="result">result</th>
    * <td headers="ri result rec_req_ser_con">no </td> 
    * <td headers="ri result rec_req">no </td> 
    * <td headers="ri result send_rep">yes</td> 
@@ -1007,113 +1001,136 @@
    * <td headers="ri result send_oth">no </td>
    * </tr>
    *
-   * <tr><th id="res_ex"><p style="text-align:left">response_expected</p></th>
+   * <tr><th id="res_ex">response_expected</th>
    * <td headers="ri res_ex rec_req_ser_con">yes</td> 
    * <td headers="ri res_ex rec_req">yes</td> 
    * <td headers="ri res_ex send_rep">yes</td> 
    * <td headers="ri res_ex send_exc">yes</td> 
    * <td headers="ri res_ex send_oth">yes</td></tr>
    *
-   * <tr><th id="syn_scp"><p style="text-align:left">sync_scope</p></th>
+   * <tr><th id="syn_scp">sync_scope</th>
    * <td headers="ri syn_scp rec_req_ser_con">yes</td> 
    * <td headers="ri syn_scp rec_req">yes</td> 
    * <td headers="ri syn_scp send_rep">yes</td> 
    * <td headers="ri syn_scp send_exc">yes</td> 
    * <td headers="ri syn_scp send_oth">yes</td></tr>
    * 
-   *    <tr><td><b>request_id</b></td>
-   *    <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
-   * 
-   *    <tr><td><b>operation</b></td>
-   *    <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+   * <tr><th id="rep_status">reply_status</th>
+   * <td headers="ri rep_status rec_req_ser_con">no </td>
+   * <td headers="ri rep_status rec_req">no </td>
+   * <td headers="ri rep_status send_rep">yes</td>
+   * <td headers="ri rep_status send_exc">yes</td>
+   * <td headers="ri rep_status send_oth">yes</td></tr>
    * 
-   *    <tr><td><b>arguments</b></td>
-   *    <td>no </td> <td>yes<sub>1</sub></td>
-   *                              <td>yes</td> <td>no<sub>2</sub></td> 
-   *                                                        <td>no<sub>2</sub>
-   *                                                        </td></tr>
+   * <tr><th id="fwd_ref">forward_reference</th>
+   * <td headers="ri fwd_ref rec_req_ser_con">no </td>
+   * <td headers="ri fwd_ref rec_req">no </td>
+   * <td headers="ri fwd_ref send_rep">no </td>
+   * <td headers="ri fwd_ref send_exc">no </td>
+   * <td headers="ri fwd_ref send_oth">yes<sub>2</sub></td></tr>
    * 
-   *    <tr><td><b>exceptions</b></td>
-   *    <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
-   * 
-   *    <tr><td><b>contexts</b></td>
-   *    <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
-   * 
-   *    <tr><td><b>operation_context</b></td>
-   *    <td>no </td> <td>yes</td> <td>yes</td> <td>no </td> <td>no </td></tr>
+   * <tr><th id="get_slt">get_slot</th>
+   * <td headers="ri get_slt rec_req_ser_con">yes</td>
+   * <td headers="ri get_slt rec_req">yes</td>
+   * <td headers="ri get_slt send_rep">yes</td>
+   * <td headers="ri get_slt send_exc">yes</td>
+   * <td headers="ri get_slt send_oth">yes</td></tr>
    * 
-   *    <tr><td><b>result</b></td>
-   *    <td>no </td> <td>no </td> <td>yes</td> <td>no </td> <td>no </td></tr>
-   * 
-   *    <tr><td><b>response_expected</b></td>
-   *    <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+   * <tr><th id="get_req_sc">get_request_service_context</th>
+   * <td headers="ri get_req_sc rec_req_ser_con">yes</td>
+   * <td headers="ri get_req_sc rec_req">no </td>
+   * <td headers="ri get_req_sc send_rep">yes</td>
+   * <td headers="ri get_req_sc send_exc">yes</td>
+   * <td headers="ri get_req_sc send_oth">yes</td></tr>
    * 
-   *    <tr><td><b>sync_scope</b></td>
-   *    <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
-   * 
-   *    <tr><td><b>reply_status</b></td>
-   *    <td>no </td> <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+   * <tr><th id="get_rep_sc">get_reply_service_context</th>
+   * <td headers="ri get_rep_sc rec_req_ser_con">no </td>
+   * <td headers="ri get_rep_sc rec_req">no </td>
+   * <td headers="ri get_rep_sc send_rep">yes</td>
+   * <td headers="ri get_rep_sc send_exc">yes</td>
+   * <td headers="ri get_rep_sc send_oth">yes</td></tr>
    * 
-   *    <tr><td><b>forward_reference</b></td>
-   *    <td>no </td> <td>no </td> <td>no </td> <td>no </td> <td>yes<sub>2</sub>
-   * 								</td></tr>
+   * <tr>
+   *   <th id="sri" colspan=6><i>ServerRequestInfo-specific:</i></th>
+   * </tr>
    * 
-   *    <tr><td><b>get_slot</b></td>
-   *    <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+   * <tr><th id="sndg_exc">sending_exception</th>
+   * <td headers="sri sndg_exc rec_req_ser_con">no </td>
+   * <td headers="sri sndg_exc rec_req">no </td>
+   * <td headers="sri sndg_exc send_rep">no </td>
+   * <td headers="sri sndg_exc send_exc">yes</td>
+   * <td headers="sri sndg_exc send_oth">no </td></tr>
    * 
-   *    <tr><td><b>get_request_service_context</b></td>
-   *    <td>yes</td> <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
-   * 
-   *    <tr><td><b>get_reply_service_context</b></td>
-   *    <td>no </td> <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+   * <tr><th id="obj_id">object_id</th>
+   * <td headers="sri obj_id rec_req_ser_con">no </td>
+   * <td headers="sri obj_id rec_req">yes</td>
+   * <td headers="sri obj_id send_rep">yes</td>
+   * <td headers="sri obj_id send_exc">yes<sub>3</sub></td>
+   * <td headers="sri obj_id send_oth">yes<sub>3</sub></td></tr>
    * 
-   *    <tr>
-   *      <td colspan=6><i>ServerRequestInfo-specific:</i></td>
-   *    </tr>
-   * 
-   *    <tr><td><b>sending_exception</b></td>
-   *    <td>no </td> <td>no </td> <td>no </td> <td>yes</td> <td>no </td></tr>
+   * <tr><th id="ada_id">adapter_id</th>
+   * <td headers="sri ada_id rec_req_ser_con">no </td>
+   * <td headers="sri ada_id rec_req">yes</td>
+   * <td headers="sri ada_id send_rep">yes</td>
+   * <td headers="sri ada_id send_exc">yes<sub>3</sub></td>
+   * <td headers="sri ada_id send_oth">yes<sub>3</sub></td></tr>
    * 
-   *    <tr><td><b>object_id</b></td>
-   *    <td>no </td> <td>yes</td> <td>yes</td> <td>yes<sub>3</sub></td> 
-   * 						       <td>yes<sub>3</sub>
-   * 						                </td></tr>
-   * 
-   *    <tr><td><b>adapter_id</b></td>
-   *    <td>no </td> <td>yes</td> <td>yes</td> <td>yes<sub>3</sub></td> 
-   * 						       <td>yes<sub>3</sub>
-   * 								</td></tr>
-   * 
-   *    <tr><td><b>server_id</b></td>
-   *    <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+   * <tr><th id="srv_id">server_id</th>
+   * <td headers="sri srv_id rec_req_ser_con">no </td>
+   * <td headers="sri srv_id rec_req">yes</td>
+   * <td headers="sri srv_id send_rep">yes</td>
+   * <td headers="sri srv_id send_exc">yes</td>
+   * <td headers="sri srv_id send_oth">yes</td></tr>
    *
-   *    <tr><td><b>orb_id</b></td>
-   *    <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+   * <tr><th id="orb_id">orb_id</th>
+   * <td headers="sri orb_id rec_req_ser_con">no </td>
+   * <td headers="sri orb_id rec_req">yes</td>
+   * <td headers="sri orb_id send_rep">yes</td>
+   * <td headers="sri orb_id send_exc">yes</td>
+   * <td headers="sri orb_id send_oth">yes</td></tr>
+   *
+   * <tr><th id="ada_nam">adapter_name</th>
+   * <td headers="sri ada_nam rec_req_ser_con">no </td>
+   * <td headers="sri ada_nam rec_req">yes</td>
+   * <td headers="sri ada_nam send_rep">yes</td>
+   * <td headers="sri ada_nam send_exc">yes</td>
+   * <td headers="sri ada_nam send_oth">yes</td></tr>
    *
-   *    <tr><td><b>adapter_name</b></td>
-   *    <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
-   *
-   *    <tr><td><b>target_most_derived_interface</b></td>
-   *    <td>no </td> <td>yes</td> <td>no<sub>4</sub></td> 
-   * 					  <td>no<sub>4</sub></td> 
-   * 						       <td>no<sub>4</sub>
-   * 							       </td></tr>
+   * <tr><th id="tmdi">target_most_derived_interface</th>
+   * <td headers="sri tmdi rec_req_ser_con">no </td>
+   * <td headers="sri tmdi rec_req">yes</td>
+   * <td headers="sri tmdi send_rep">no<sub>4</sub></td>
+   * <td headers="sri tmdi send_exc">no<sub>4</sub></td>
+   * <td headers="sri tmdi send_oth">no<sub>4</sub></td></tr>
    * 
-   *    <tr><td><b>get_server_policy</b></td>
-   *    <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+   * <tr><th id="gsp">get_server_policy</th>
+   * <td headers="sri gsp rec_req_ser_con">yes</td>
+   * <td headers="sri gsp rec_req">yes</td>
+   * <td headers="sri gsp send_rep">yes</td>
+   * <td headers="sri gsp send_exc">yes</td>
+   * <td headers="sri gsp send_oth">yes</td></tr>
    * 
-   *    <tr><td><b>set_slot</b></td>
-   *    <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+   * <tr><th id="set_slt">set_slot</th>
+   * <td headers="sri set_slt rec_req_ser_con">yes</td>
+   * <td headers="sri set_slt rec_req">yes</td>
+   * <td headers="sri set_slt send_rep">yes</td>
+   * <td headers="sri set_slt send_exc">yes</td>
+   * <td headers="sri set_slt send_oth">yes</td></tr>
    * 
-   *    <tr><td><b>target_is_a</b></td>
-   *    <td>no </td> <td>yes</td> <td>no<sub>4</sub></td> 
-   * 					  <td>no<sub>4</sub></td> 
-   * 						       <td>no<sub>4</sub>
-   * 							       </td></tr>
+   * <tr><th id="tar_isa">target_is_a</th>
+   * <td headers="sri tar_isa rec_req_ser_con">no </td>
+   * <td headers="sri tar_isa rec_req">yes</td>
+   * <td headers="sri tar_isa send_rep">no<sub>4</sub></td>
+   * <td headers="sri tar_isa send_exc">no<sub>4</sub></td>
+   * <td headers="sri tar_isa send_oth">no<sub>4</sub></td></tr>
    * 
-   *    <tr><td><b>add_reply_service_context</b></td>
-   *    <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
-   *   </tbody>
+   * <tr><th id="add_rep_sc">add_reply_service_context</th>
+   * <td headers="sri add_rep_sc rec_req_ser_con">yes</td>
+   * <td headers="sri add_rep_sc rec_req">yes</td>
+   * <td headers="sri add_rep_sc send_rep">yes</td>
+   * <td headers="sri add_rep_sc send_exc">yes</td>
+   * <td headers="sri add_rep_sc send_oth">yes</td></tr>
+   * </tbody>
    * </table>
    *
    * <ol>
--- a/hotspot/.hgtags	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/.hgtags	Sat Sep 09 14:36:45 2017 +0200
@@ -606,3 +606,4 @@
 4a443796f6f57842d6a0434ac27ca3d1033ccc20 jdk-9+181
 e93ed1a092409351c90b3a76d80b9aa8b44d5e6a jdk-10+20
 bdb2dbc43ff065b74c2121bdfb0d6e1fa8684b73 jdk-10+21
+71337910df60ff2b62daf10357f553def25e2d0b jdk-10+22
--- a/hotspot/make/lib/JvmFeatures.gmk	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/make/lib/JvmFeatures.gmk	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -88,11 +88,6 @@
   JVM_EXCLUDE_FILES += jvmciCodeInstaller_$(HOTSPOT_TARGET_CPU_ARCH).cpp
 endif
 
-ifneq ($(call check-jvm-feature, fprof), true)
-  JVM_CFLAGS_FEATURES += -DINCLUDE_FPROF=0
-  JVM_EXCLUDE_FILES += fprofiler.cpp
-endif
-
 ifneq ($(call check-jvm-feature, vm-structs), true)
   JVM_CFLAGS_FEATURES += -DINCLUDE_VM_STRUCTS=0
   JVM_EXCLUDE_FILES += vmStructs.cpp
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad	Sat Sep 09 14:36:45 2017 +0200
@@ -12614,7 +12614,7 @@
   match(Set dst (AndI (URShiftI src rshift) mask));
 
   ins_cost(INSN_COST);
-  format %{ "ubfxw $dst, $src, $mask" %}
+  format %{ "ubfxw $dst, $src, $rshift, $mask" %}
   ins_encode %{
     int rshift = $rshift$$constant;
     long mask = $mask$$constant;
@@ -12629,7 +12629,7 @@
   match(Set dst (AndL (URShiftL src rshift) mask));
 
   ins_cost(INSN_COST);
-  format %{ "ubfx $dst, $src, $mask" %}
+  format %{ "ubfx $dst, $src, $rshift, $mask" %}
   ins_encode %{
     int rshift = $rshift$$constant;
     long mask = $mask$$constant;
@@ -12647,7 +12647,7 @@
   match(Set dst (ConvI2L (AndI (URShiftI src rshift) mask)));
 
   ins_cost(INSN_COST * 2);
-  format %{ "ubfx $dst, $src, $mask" %}
+  format %{ "ubfx $dst, $src, $rshift, $mask" %}
   ins_encode %{
     int rshift = $rshift$$constant;
     long mask = $mask$$constant;
--- a/hotspot/src/cpu/aarch64/vm/aarch64_ad.m4	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/aarch64_ad.m4	Sat Sep 09 14:36:45 2017 +0200
@@ -183,7 +183,7 @@
   match(Set dst (And$1 ($2$1 src rshift) mask));
 
   ins_cost(INSN_COST);
-  format %{ "$3 $dst, $src, $mask" %}
+  format %{ "$3 $dst, $src, $rshift, $mask" %}
   ins_encode %{
     int rshift = $rshift$$constant;
     long mask = $mask$$constant;
@@ -203,7 +203,7 @@
   match(Set dst (ConvI2L (AndI (URShiftI src rshift) mask)));
 
   ins_cost(INSN_COST * 2);
-  format %{ "ubfx $dst, $src, $mask" %}
+  format %{ "ubfx $dst, $src, $rshift, $mask" %}
   ins_encode %{
     int rshift = $rshift$$constant;
     long mask = $mask$$constant;
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -3630,6 +3630,12 @@
 }
 
 #if INCLUDE_ALL_GCS
+/*
+ * g1_write_barrier_pre -- G1GC pre-write barrier for store of new_val at
+ * store_addr.
+ *
+ * Allocates rscratch1
+ */
 void MacroAssembler::g1_write_barrier_pre(Register obj,
                                           Register pre_val,
                                           Register thread,
@@ -3645,10 +3651,8 @@
   Label done;
   Label runtime;
 
-  assert(pre_val != noreg, "check this code");
-
-  if (obj != noreg)
-    assert_different_registers(obj, pre_val, tmp);
+  assert_different_registers(obj, pre_val, tmp, rscratch1);
+  assert(pre_val != noreg &&  tmp != noreg, "expecting a register");
 
   Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
                                        SATBMarkQueue::byte_offset_of_active()));
@@ -3722,12 +3726,22 @@
   bind(done);
 }
 
+/*
+ * g1_write_barrier_post -- G1GC post-write barrier for store of new_val at
+ * store_addr
+ *
+ * Allocates rscratch1
+ */
 void MacroAssembler::g1_write_barrier_post(Register store_addr,
                                            Register new_val,
                                            Register thread,
                                            Register tmp,
                                            Register tmp2) {
   assert(thread == rthread, "must be");
+  assert_different_registers(store_addr, new_val, thread, tmp, tmp2,
+                             rscratch1);
+  assert(store_addr != noreg && new_val != noreg && tmp != noreg
+         && tmp2 != noreg, "expecting a register");
 
   Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() +
                                        DirtyCardQueue::byte_offset_of_index()));
--- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -2067,7 +2067,7 @@
       __ g1_write_barrier_pre(noreg /* obj */,
                               r0 /* pre_val */,
                               rthread /* thread */,
-                              rscratch1 /* tmp */,
+                              rscratch2 /* tmp */,
                               true /* tosca_live */,
                               true /* expand_call */);
     }
--- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -170,7 +170,7 @@
           // G1 barrier needs uncompressed oop for region cross check.
           Register new_val = val;
           if (UseCompressedOops) {
-            new_val = rscratch1;
+            new_val = rscratch2;
             __ mov(new_val, val);
           }
           __ store_heap_oop(Address(r3, 0), val);
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -292,7 +292,7 @@
   if (VerifyThread) {
     // NOTE: this chops off the heads of the 64-bit O registers.
     // make sure G2_thread contains the right value
-    save_frame_and_mov(0, Lmethod, Lmethod);   // to avoid clobbering O0 (and propagate Lmethod for -Xprof)
+    save_frame_and_mov(0, Lmethod, Lmethod);   // to avoid clobbering O0 (and propagate Lmethod)
     mov(G1, L1);                // avoid clobbering G1
     // G2 saved below
     mov(G3, L3);                // avoid clobbering G3
@@ -398,7 +398,7 @@
 
 #ifdef ASSERT
   // check that it WAS previously set
-    save_frame_and_mov(0, Lmethod, Lmethod);     // Propagate Lmethod to helper frame for -Xprof
+    save_frame_and_mov(0, Lmethod, Lmethod);     // Propagate Lmethod to helper frame
     ld_ptr(sp_addr, L0);
     tst(L0);
     breakpoint_trap(Assembler::zero, Assembler::ptr_cc);
@@ -618,7 +618,7 @@
 
 # ifdef ASSERT
     // Check that we are not overwriting any other oop.
-    save_frame_and_mov(0, Lmethod, Lmethod);     // Propagate Lmethod for -Xprof
+    save_frame_and_mov(0, Lmethod, Lmethod);     // Propagate Lmethod
     ld_ptr(vm_result_addr, L0);
     tst(L0);
     restore();
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -2928,7 +2928,7 @@
   __ br(Assembler::zero, false, Assembler::pt, notFinal);
   __ delayed()->and3(Rret, 0xFF, G4_scratch);      // gets number of parameters
 
-  if (RewriteBytecodes && !UseSharedSpaces) {
+  if (RewriteBytecodes && !UseSharedSpaces && !DumpSharedSpaces) {
     patch_bytecode(Bytecodes::_fast_invokevfinal, Rscratch, Rtemp);
   }
 
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -187,10 +187,9 @@
         {"StubRoutines::_arrayof_oop_disjoint_arraycopy", "_aot_stub_routines_arrayof_oop_disjoint_arraycopy"},
         {"StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit", "_aot_stub_routines_arrayof_oop_disjoint_arraycopy_uninit"},
 
-        {"StubRoutines::_checkcast_arraycopy", "_aot_stub_routines_checkcast_arraycopy"},
+        {"StubRoutines::_unsafe_arraycopy", "_aot_stub_routines_unsafe_arraycopy"},
 
-
-
+        {"StubRoutines::_checkcast_arraycopy", "_aot_stub_routines_checkcast_arraycopy"},
 
         {"StubRoutines::_aescrypt_encryptBlock", "_aot_stub_routines_aescrypt_encryptBlock"},
         {"StubRoutines::_aescrypt_decryptBlock", "_aot_stub_routines_aescrypt_decryptBlock"},
@@ -478,8 +477,8 @@
     }
 
     /**
-     * Creates a global symbol of the form {@code "A" + container name}.
-     * Note, linker on Windows does not allow names which start with '.'
+     * Creates a global symbol of the form {@code "A" + container name}. Note, linker on Windows
+     * does not allow names which start with '.'
      *
      * @param container container to create a symbol for
      */
@@ -685,7 +684,8 @@
     }
 
     /**
-     * Add oop symbol by as follows. Extend the oop.got section with another slot for the VM to patch.
+     * Add oop symbol by as follows. Extend the oop.got section with another slot for the VM to
+     * patch.
      *
      * @param oopName name of the oop symbol
      */
@@ -728,10 +728,9 @@
     }
 
     /**
-     * Add klass symbol by as follows.
-     *   - Adding the symbol name to the metaspace.names section
-     *   - Add the offset of the name in metaspace.names to metaspace.offsets
-     *   - Extend the klasses.got section with another slot for the VM to patch
+     * Add klass symbol by as follows. - Adding the symbol name to the metaspace.names section - Add
+     * the offset of the name in metaspace.names to metaspace.offsets - Extend the klasses.got
+     * section with another slot for the VM to patch
      *
      * @param klassName name of the metaspace symbol
      * @return the got offset in the klasses.got of the metaspace symbol
--- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTBackend.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTBackend.java	Sat Sep 09 14:36:45 2017 +0200
@@ -27,6 +27,8 @@
 
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.core.GraalCompiler;
+import org.graalvm.compiler.core.common.CompilationIdentifier;
+import org.graalvm.compiler.core.common.CompilationIdentifier.Verbosity;
 import org.graalvm.compiler.debug.DebugContext;
 import org.graalvm.compiler.hotspot.HotSpotBackend;
 import org.graalvm.compiler.hotspot.HotSpotCompiledCodeBuilder;
@@ -127,7 +129,13 @@
             ProfilingInfo profilingInfo = DefaultProfilingInfo.get(TriState.FALSE);
 
             final boolean isImmutablePIC = true;
-            CompilationResult compilationResult = new CompilationResult(resolvedMethod.getName(), isImmutablePIC);
+            CompilationIdentifier id = new CompilationIdentifier() {
+                @Override
+                public String toString(Verbosity verbosity) {
+                    return resolvedMethod.getName();
+                }
+            };
+            CompilationResult compilationResult = new CompilationResult(id, isImmutablePIC);
 
             return GraalCompiler.compileGraph(graph, resolvedMethod, providers, backend, graphBuilderSuite, OptimisticOptimizations.ALL, profilingInfo, getSuites(), getLirSuites(),
                             compilationResult, CompilationResultBuilderFactory.Default);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.replacements/src/org/graalvm/compiler/api/replacements/ClassSubstitution.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.replacements/src/org/graalvm/compiler/api/replacements/ClassSubstitution.java	Sat Sep 09 14:36:45 2017 +0200
@@ -57,7 +57,9 @@
 
     /**
      * Determines if the substitutions are for classes that may not be part of the runtime.
-     * Substitutions for such classes are omitted if the original classes cannot be found.
+     * Substitutions for such classes are omitted if the original classes cannot be found. If
+     * multiple classes are specified using {@link #className()} and {@link #optional()} is false,
+     * then at least one of the classes is required to be reachable.
      */
     boolean optional() default false;
 }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.test/src/org/graalvm/compiler/asm/test/AssemblerTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.test/src/org/graalvm/compiler/asm/test/AssemblerTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -90,7 +90,7 @@
             StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).compilationId(compilationId).build();
             CallingConvention cc = backend.newLIRGenerationResult(compilationId, null, null, graph, null).getCallingConvention();
 
-            CompilationResult compResult = new CompilationResult();
+            CompilationResult compResult = new CompilationResult(graph.compilationId());
             byte[] targetCode = test.generateCode(compResult, codeCache.getTarget(), registerConfig, cc);
             compResult.setTargetCode(targetCode, targetCode.length);
             compResult.setTotalFrameSize(0);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/CompilationResult.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/CompilationResult.java	Sat Sep 09 14:36:45 2017 +0200
@@ -33,6 +33,7 @@
 import java.util.List;
 import java.util.Objects;
 
+import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.graph.NodeSourcePosition;
 import org.graalvm.util.EconomicSet;
 
@@ -190,6 +191,8 @@
 
     private final String name;
 
+    private final CompilationIdentifier compilationId;
+
     /**
      * The buffer containing the emitted machine code.
      */
@@ -222,21 +225,26 @@
 
     private boolean isImmutablePIC;
 
-    public CompilationResult() {
-        this(null, false);
+    public CompilationResult(CompilationIdentifier compilationId) {
+        this(compilationId, compilationId.toString(CompilationIdentifier.Verbosity.NAME), false);
+    }
+
+    public CompilationResult(CompilationIdentifier compilationId, String name) {
+        this(compilationId, name, false);
+    }
+
+    public CompilationResult(CompilationIdentifier compilationId, boolean isImmutablePIC) {
+        this(compilationId, null, isImmutablePIC);
+    }
+
+    public CompilationResult(CompilationIdentifier compilationId, String name, boolean isImmutablePIC) {
+        this.compilationId = compilationId;
+        this.name = name;
+        this.isImmutablePIC = isImmutablePIC;
     }
 
     public CompilationResult(String name) {
-        this(name, false);
-    }
-
-    public CompilationResult(boolean isImmutablePIC) {
-        this(null, isImmutablePIC);
-    }
-
-    public CompilationResult(String name, boolean isImmutablePIC) {
-        this.name = name;
-        this.isImmutablePIC = isImmutablePIC;
+        this(null, name);
     }
 
     @Override
@@ -266,6 +274,7 @@
                 this.totalFrameSize == that.totalFrameSize &&
                 this.targetCodeSize == that.targetCodeSize &&
                 Objects.equals(this.name, that.name) &&
+                Objects.equals(this.compilationId, that.compilationId) &&
                 Objects.equals(this.annotations, that.annotations) &&
                 Objects.equals(this.dataSection, that.dataSection) &&
                 Objects.equals(this.exceptionHandlers, that.exceptionHandlers) &&
@@ -670,6 +679,10 @@
         return name;
     }
 
+    public CompilationIdentifier getCompilationId() {
+        return compilationId;
+    }
+
     public void setHasUnsafeAccess(boolean hasUnsafeAccess) {
         checkOpen();
         this.hasUnsafeAccess = hasUnsafeAccess;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraalCompilerTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraalCompilerTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -949,7 +949,7 @@
 
             try (AllocSpy spy = AllocSpy.open(installedCodeOwner); DebugContext.Scope ds = debug.scope("Compiling", new DebugDumpScope(id.toString(CompilationIdentifier.Verbosity.ID), true))) {
                 CompilationPrinter printer = CompilationPrinter.begin(options, id, installedCodeOwner, INVOCATION_ENTRY_BCI);
-                CompilationResult compResult = compile(installedCodeOwner, graphToCompile, new CompilationResult(), id, options);
+                CompilationResult compResult = compile(installedCodeOwner, graphToCompile, new CompilationResult(graphToCompile.compilationId()), id, options);
                 printer.finish(compResult);
 
                 try (DebugContext.Scope s = debug.scope("CodeInstall", getCodeCache(), installedCodeOwner, compResult);
@@ -1019,17 +1019,19 @@
      */
     protected final CompilationResult compile(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph) {
         OptionValues options = graph == null ? getInitialOptions() : graph.getOptions();
-        return compile(installedCodeOwner, graph, new CompilationResult(), getOrCreateCompilationId(installedCodeOwner, graph), options);
+        CompilationIdentifier compilationId = getOrCreateCompilationId(installedCodeOwner, graph);
+        return compile(installedCodeOwner, graph, new CompilationResult(compilationId), compilationId, options);
     }
 
     protected final CompilationResult compile(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph, CompilationIdentifier compilationId) {
         OptionValues options = graph == null ? getInitialOptions() : graph.getOptions();
-        return compile(installedCodeOwner, graph, new CompilationResult(), compilationId, options);
+        return compile(installedCodeOwner, graph, new CompilationResult(compilationId), compilationId, options);
     }
 
     protected final CompilationResult compile(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph, OptionValues options) {
         assert graph == null || graph.getOptions() == options;
-        return compile(installedCodeOwner, graph, new CompilationResult(), getOrCreateCompilationId(installedCodeOwner, graph), options);
+        CompilationIdentifier compilationId = getOrCreateCompilationId(installedCodeOwner, graph);
+        return compile(installedCodeOwner, graph, new CompilationResult(compilationId), compilationId, options);
     }
 
     /**
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/InfopointReasonTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/InfopointReasonTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -64,7 +64,7 @@
         final ResolvedJavaMethod method = getResolvedJavaMethod("testMethod");
         final StructuredGraph graph = parseEager(method, AllowAssumptions.YES);
         final CompilationResult cr = compileGraph(graph, graph.method(), getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, graph.getProfilingInfo(),
-                        createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(), CompilationResultBuilderFactory.Default);
+                        createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(graph.compilationId()), CompilationResultBuilderFactory.Default);
         for (Infopoint sp : cr.getInfopoints()) {
             assertNotNull(sp.reason);
             if (sp instanceof Call) {
@@ -86,7 +86,7 @@
         assertTrue(graphLineSPs > 0);
         PhaseSuite<HighTierContext> graphBuilderSuite = getCustomGraphBuilderSuite(GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withFullInfopoints(true));
         final CompilationResult cr = compileGraph(graph, graph.method(), getProviders(), getBackend(), graphBuilderSuite, OptimisticOptimizations.ALL, graph.getProfilingInfo(),
-                        createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(), CompilationResultBuilderFactory.Default);
+                        createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(graph.compilationId()), CompilationResultBuilderFactory.Default);
         int lineSPs = 0;
         for (Infopoint sp : cr.getInfopoints()) {
             assertNotNull(sp.reason);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/InvokeGraal.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/InvokeGraal.java	Sat Sep 09 14:36:45 2017 +0200
@@ -123,7 +123,7 @@
             ProfilingInfo profilingInfo = graph.getProfilingInfo(method);
 
             /* The default class and configuration for compilation results. */
-            CompilationResult compilationResult = new CompilationResult();
+            CompilationResult compilationResult = new CompilationResult(graph.compilationId());
             CompilationResultBuilderFactory factory = CompilationResultBuilderFactory.Default;
 
             /* Invoke the whole Graal compilation pipeline. */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph.test/src/org/graalvm/compiler/graph/test/NodeBitMapTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,203 @@
+/*
+ * 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 org.graalvm.compiler.graph.test;
+
+import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED;
+import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED;
+
+import java.util.ConcurrentModificationException;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.graalvm.compiler.api.test.Graal;
+import org.graalvm.compiler.graph.Graph;
+import org.graalvm.compiler.graph.Node;
+import org.graalvm.compiler.graph.NodeBitMap;
+import org.graalvm.compiler.graph.NodeClass;
+import org.graalvm.compiler.nodeinfo.NodeInfo;
+import org.graalvm.compiler.options.OptionValues;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class NodeBitMapTest extends GraphTest {
+
+    @NodeInfo(cycles = CYCLES_IGNORED, size = SIZE_IGNORED)
+    static final class TestNode extends Node {
+        public static final NodeClass<TestNode> TYPE = NodeClass.create(TestNode.class);
+
+        protected TestNode() {
+            super(TYPE);
+        }
+    }
+
+    private Graph graph;
+    private TestNode[] nodes = new TestNode[100];
+    private NodeBitMap map;
+
+    @Before
+    public void before() {
+        // Need to initialize HotSpotGraalRuntime before any Node class is initialized.
+        Graal.getRuntime();
+
+        OptionValues options = getOptions();
+        graph = new Graph(options, getDebug(options));
+        for (int i = 0; i < nodes.length; i++) {
+            nodes[i] = graph.add(new TestNode());
+        }
+        map = graph.createNodeBitMap();
+    }
+
+    @Test
+    public void iterateEmpty() {
+        for (Node n : map) {
+            Assert.fail("no elements expected: " + n);
+        }
+    }
+
+    @Test
+    public void iterateMarkedNodes() {
+        map.mark(nodes[99]);
+        map.mark(nodes[0]);
+        map.mark(nodes[7]);
+        map.mark(nodes[1]);
+        map.mark(nodes[53]);
+
+        Iterator<Node> iter = map.iterator();
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[0], iter.next());
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[1], iter.next());
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[7], iter.next());
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[53], iter.next());
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[99], iter.next());
+        Assert.assertFalse(iter.hasNext());
+    }
+
+    @Test
+    public void deleteNodeWhileIterating() {
+        map.mark(nodes[99]);
+        map.mark(nodes[0]);
+        map.mark(nodes[7]);
+        map.mark(nodes[1]);
+        map.mark(nodes[53]);
+
+        Iterator<Node> iter = map.iterator();
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[0], iter.next());
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[1], iter.next());
+        nodes[7].markDeleted();
+        nodes[53].markDeleted();
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[99], iter.next());
+        Assert.assertFalse(iter.hasNext());
+    }
+
+    @Test
+    public void deleteAllNodesBeforeIterating() {
+        for (int i = 0; i < nodes.length; i++) {
+            map.mark(nodes[i]);
+            nodes[i].markDeleted();
+        }
+
+        Iterator<Node> iter = map.iterator();
+        Assert.assertFalse(iter.hasNext());
+    }
+
+    @Test
+    public void multipleHasNextInvocations() {
+        map.mark(nodes[7]);
+
+        Iterator<Node> iter = map.iterator();
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[7], iter.next());
+        Assert.assertFalse(iter.hasNext());
+    }
+
+    @Test(expected = NoSuchElementException.class)
+    public void noSuchElement() {
+        map.iterator().next();
+    }
+
+    @Test(expected = ConcurrentModificationException.class)
+    public void concurrentModification() {
+        map.mark(nodes[7]);
+
+        map.mark(nodes[99]);
+        map.mark(nodes[0]);
+        map.mark(nodes[7]);
+        map.mark(nodes[1]);
+        map.mark(nodes[53]);
+
+        Iterator<Node> iter = map.iterator();
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[0], iter.next());
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[1], iter.next());
+        Assert.assertTrue(iter.hasNext());
+        nodes[7].markDeleted();
+        iter.next();
+    }
+
+    @Test
+    public void nextWithoutHasNext() {
+        map.mark(nodes[99]);
+        map.mark(nodes[0]);
+        map.mark(nodes[7]);
+        map.mark(nodes[1]);
+        map.mark(nodes[53]);
+
+        Iterator<Node> iter = map.iterator();
+        Assert.assertEquals(nodes[0], iter.next());
+        Assert.assertEquals(nodes[1], iter.next());
+        Assert.assertEquals(nodes[7], iter.next());
+        Assert.assertEquals(nodes[53], iter.next());
+        Assert.assertEquals(nodes[99], iter.next());
+        Assert.assertFalse(iter.hasNext());
+    }
+
+    @Test
+    public void markWhileIterating() {
+        map.mark(nodes[0]);
+
+        Iterator<Node> iter = map.iterator();
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[0], iter.next());
+        map.mark(nodes[7]);
+        Assert.assertTrue(iter.hasNext());
+        map.mark(nodes[1]);
+        Assert.assertEquals(nodes[7], iter.next());
+        map.mark(nodes[99]);
+        map.mark(nodes[53]);
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[53], iter.next());
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals(nodes[99], iter.next());
+        Assert.assertFalse(iter.hasNext());
+    }
+}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeBitMap.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeBitMap.java	Sat Sep 09 14:36:45 2017 +0200
@@ -23,22 +23,23 @@
 package org.graalvm.compiler.graph;
 
 import java.util.Arrays;
+import java.util.ConcurrentModificationException;
 import java.util.Iterator;
+import java.util.NoSuchElementException;
 
 import org.graalvm.compiler.graph.iterators.NodeIterable;
 
-public final class NodeBitMap implements NodeIterable<Node> {
+public final class NodeBitMap extends NodeIdAccessor implements NodeIterable<Node> {
     private static final int SHIFT = 6;
 
     private long[] bits;
     private int nodeCount;
     private int counter;
-    private final Graph graph;
 
     public NodeBitMap(Graph graph) {
+        super(graph);
         this.nodeCount = graph.nodeIdCount();
         this.bits = new long[sizeForNodeCount(nodeCount)];
-        this.graph = graph;
     }
 
     private static int sizeForNodeCount(int nodeCount) {
@@ -50,9 +51,9 @@
     }
 
     private NodeBitMap(NodeBitMap other) {
+        super(other.graph);
         this.bits = other.bits.clone();
         this.nodeCount = other.nodeCount;
-        this.graph = other.graph;
     }
 
     public Graph graph() {
@@ -60,12 +61,12 @@
     }
 
     public boolean isNew(Node node) {
-        return node.id() >= nodeCount;
+        return getNodeId(node) >= nodeCount;
     }
 
     public boolean isMarked(Node node) {
         assert check(node, false);
-        return isMarked(node.id());
+        return isMarked(getNodeId(node));
     }
 
     public boolean checkAndMarkInc(Node node) {
@@ -84,33 +85,33 @@
 
     public boolean isMarkedAndGrow(Node node) {
         assert check(node, true);
-        int id = node.id();
+        int id = getNodeId(node);
         checkGrow(id);
         return isMarked(id);
     }
 
     public void mark(Node node) {
         assert check(node, false);
-        int id = node.id();
+        int id = getNodeId(node);
         bits[id >> SHIFT] |= (1L << id);
     }
 
     public void markAndGrow(Node node) {
         assert check(node, true);
-        int id = node.id();
+        int id = getNodeId(node);
         checkGrow(id);
         bits[id >> SHIFT] |= (1L << id);
     }
 
     public void clear(Node node) {
         assert check(node, false);
-        int id = node.id();
+        int id = getNodeId(node);
         bits[id >> SHIFT] &= ~(1L << id);
     }
 
     public void clearAndGrow(Node node) {
         assert check(node, true);
-        int id = node.id();
+        int id = getNodeId(node);
         checkGrow(id);
         bits[id >> SHIFT] &= ~(1L << id);
     }
@@ -181,15 +182,30 @@
         }
     }
 
-    protected int nextMarkedNodeId(int fromNodeId) {
+    protected Node nextMarkedNode(int fromNodeId) {
         assert fromNodeId >= 0;
         int wordIndex = fromNodeId >> SHIFT;
         int wordsInUse = bits.length;
         if (wordIndex < wordsInUse) {
-            long word = bits[wordIndex] & (0xFFFFFFFFFFFFFFFFL << fromNodeId);
+            long word = getPartOfWord(bits[wordIndex], fromNodeId);
             while (true) {
-                if (word != 0) {
-                    return wordIndex * Long.SIZE + Long.numberOfTrailingZeros(word);
+                while (word != 0) {
+                    int bitIndex = Long.numberOfTrailingZeros(word);
+                    int nodeId = wordIndex * Long.SIZE + bitIndex;
+                    Node result = graph.getNode(nodeId);
+                    if (result == null) {
+                        // node was deleted -> clear the bit and continue searching
+                        bits[wordIndex] = bits[wordIndex] & ~(1 << bitIndex);
+                        int nextNodeId = nodeId + 1;
+                        if ((nextNodeId & (Long.SIZE - 1)) == 0) {
+                            // we reached the end of this word
+                            break;
+                        } else {
+                            word = getPartOfWord(word, nextNodeId);
+                        }
+                    } else {
+                        return result;
+                    }
                 }
                 if (++wordIndex == wordsInUse) {
                     break;
@@ -197,30 +213,56 @@
                 word = bits[wordIndex];
             }
         }
-        return -2;
+        return null;
+    }
+
+    private static long getPartOfWord(long word, int firstNodeIdToInclude) {
+        return word & (0xFFFFFFFFFFFFFFFFL << firstNodeIdToInclude);
     }
 
+    /**
+     * This iterator only returns nodes that are marked in the {@link NodeBitMap} and are alive in
+     * the corresponding {@link Graph}.
+     */
     private class MarkedNodeIterator implements Iterator<Node> {
-        private int nextNodeId;
+        private int currentNodeId;
+        private Node currentNode;
 
         MarkedNodeIterator() {
-            nextNodeId = -1;
+            currentNodeId = -1;
             forward();
         }
 
         private void forward() {
-            nextNodeId = NodeBitMap.this.nextMarkedNodeId(nextNodeId + 1);
+            assert currentNode == null;
+            currentNode = NodeBitMap.this.nextMarkedNode(currentNodeId + 1);
+            if (currentNode != null) {
+                assert currentNode.isAlive();
+                currentNodeId = getNodeId(currentNode);
+            } else {
+                currentNodeId = -1;
+            }
         }
 
         @Override
         public boolean hasNext() {
-            return nextNodeId >= 0;
+            if (currentNode == null && currentNodeId >= 0) {
+                forward();
+            }
+            return currentNodeId >= 0;
         }
 
         @Override
         public Node next() {
-            Node result = graph.getNode(nextNodeId);
-            forward();
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
+            if (!currentNode.isAlive()) {
+                throw new ConcurrentModificationException("NodeBitMap was modified between the calls to hasNext() and next()");
+            }
+
+            Node result = currentNode;
+            currentNode = null;
             return result;
         }
 
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64RawNativeCallNode.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.graalvm.compiler.hotspot.aarch64;
-
-import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNKNOWN;
-import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_UNKNOWN;
-
-import org.graalvm.compiler.core.aarch64.AArch64NodeLIRBuilder;
-import org.graalvm.compiler.core.common.type.RawPointerStamp;
-import org.graalvm.compiler.core.common.type.Stamp;
-import org.graalvm.compiler.core.common.type.StampFactory;
-import org.graalvm.compiler.graph.NodeClass;
-import org.graalvm.compiler.graph.NodeInputList;
-import org.graalvm.compiler.nodeinfo.NodeInfo;
-import org.graalvm.compiler.nodes.FixedWithNextNode;
-import org.graalvm.compiler.nodes.ValueNode;
-import org.graalvm.compiler.nodes.spi.LIRLowerable;
-import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
-
-import jdk.vm.ci.code.CallingConvention;
-import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.JavaKind;
-import jdk.vm.ci.meta.JavaType;
-import jdk.vm.ci.meta.MetaAccessProvider;
-import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.vm.ci.meta.Value;
-
-@NodeInfo(cycles = CYCLES_UNKNOWN, cyclesRationale = "Native call is a block hole", size = SIZE_UNKNOWN)
-public final class AArch64RawNativeCallNode extends FixedWithNextNode implements LIRLowerable {
-    public static final NodeClass<AArch64RawNativeCallNode> TYPE = NodeClass.create(AArch64RawNativeCallNode.class);
-
-    protected final JavaConstant functionPointer;
-    @Input NodeInputList<ValueNode> args;
-
-    public AArch64RawNativeCallNode(JavaKind returnType, JavaConstant functionPointer, ValueNode[] args) {
-        super(TYPE, StampFactory.forKind(returnType));
-        this.functionPointer = functionPointer;
-        this.args = new NodeInputList<>(this, args);
-    }
-
-    private static class PointerType implements JavaType {
-
-        @Override
-        public String getName() {
-            return "void*";
-        }
-
-        @Override
-        public JavaType getComponentType() {
-            return null;
-        }
-
-        @Override
-        public JavaType getArrayClass() {
-            return null;
-        }
-
-        @Override
-        public JavaKind getJavaKind() {
-            // native pointers and java objects use the same registers in the calling convention
-            return JavaKind.Object;
-        }
-
-        @Override
-        public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
-            return null;
-        }
-    }
-
-    private static JavaType toJavaType(Stamp stamp, MetaAccessProvider metaAccess) {
-        if (stamp instanceof RawPointerStamp) {
-            return new PointerType();
-        } else {
-            return stamp.javaType(metaAccess);
-        }
-    }
-
-    @Override
-    public void generate(NodeLIRBuilderTool generator) {
-        AArch64NodeLIRBuilder gen = (AArch64NodeLIRBuilder) generator;
-        Value[] parameter = new Value[args.count()];
-        JavaType[] parameterTypes = new JavaType[args.count()];
-        for (int i = 0; i < args.count(); i++) {
-            parameter[i] = generator.operand(args.get(i));
-            parameterTypes[i] = toJavaType(args.get(i).stamp(), gen.getLIRGeneratorTool().getMetaAccess());
-        }
-        JavaType returnType = toJavaType(stamp(), gen.getLIRGeneratorTool().getMetaAccess());
-        CallingConvention cc = generator.getLIRGeneratorTool().getCodeCache().getRegisterConfig().getCallingConvention(HotSpotCallingConventionType.NativeCall, returnType, parameterTypes,
-                        generator.getLIRGeneratorTool());
-        gen.getLIRGeneratorTool().emitCCall(functionPointer.asLong(), cc, parameter);
-        if (this.getStackKind() != JavaKind.Void) {
-            generator.setResult(this, gen.getLIRGeneratorTool().emitMove(cc.getReturn()));
-        }
-    }
-
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64RawNativeCallNode.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package org.graalvm.compiler.hotspot.amd64;
-
-import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNKNOWN;
-
-import org.graalvm.compiler.core.amd64.AMD64NodeLIRBuilder;
-import org.graalvm.compiler.core.common.type.RawPointerStamp;
-import org.graalvm.compiler.core.common.type.Stamp;
-import org.graalvm.compiler.core.common.type.StampFactory;
-import org.graalvm.compiler.graph.NodeClass;
-import org.graalvm.compiler.graph.NodeInputList;
-import org.graalvm.compiler.nodeinfo.NodeInfo;
-import org.graalvm.compiler.nodeinfo.NodeSize;
-import org.graalvm.compiler.nodes.FixedWithNextNode;
-import org.graalvm.compiler.nodes.ValueNode;
-import org.graalvm.compiler.nodes.spi.LIRLowerable;
-import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
-
-import jdk.vm.ci.code.CallingConvention;
-import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
-import jdk.vm.ci.meta.JavaConstant;
-import jdk.vm.ci.meta.JavaKind;
-import jdk.vm.ci.meta.JavaType;
-import jdk.vm.ci.meta.MetaAccessProvider;
-import jdk.vm.ci.meta.ResolvedJavaType;
-import jdk.vm.ci.meta.Value;
-
-@NodeInfo(cycles = CYCLES_UNKNOWN, cyclesRationale = "Native call is a block hole", size = NodeSize.SIZE_UNKNOWN)
-public final class AMD64RawNativeCallNode extends FixedWithNextNode implements LIRLowerable {
-    public static final NodeClass<AMD64RawNativeCallNode> TYPE = NodeClass.create(AMD64RawNativeCallNode.class);
-
-    protected final JavaConstant functionPointer;
-    @Input NodeInputList<ValueNode> args;
-
-    public AMD64RawNativeCallNode(JavaKind returnType, JavaConstant functionPointer, ValueNode[] args) {
-        super(TYPE, StampFactory.forKind(returnType));
-        this.functionPointer = functionPointer;
-        this.args = new NodeInputList<>(this, args);
-    }
-
-    private static class PointerType implements JavaType {
-
-        @Override
-        public String getName() {
-            return "void*";
-        }
-
-        @Override
-        public JavaType getComponentType() {
-            return null;
-        }
-
-        @Override
-        public JavaType getArrayClass() {
-            return null;
-        }
-
-        @Override
-        public JavaKind getJavaKind() {
-            // native pointers and java objects use the same registers in the calling convention
-            return JavaKind.Object;
-        }
-
-        @Override
-        public ResolvedJavaType resolve(ResolvedJavaType accessingClass) {
-            return null;
-        }
-    }
-
-    private static JavaType toJavaType(Stamp stamp, MetaAccessProvider metaAccess) {
-        if (stamp instanceof RawPointerStamp) {
-            return new PointerType();
-        } else {
-            return stamp.javaType(metaAccess);
-        }
-    }
-
-    @Override
-    public void generate(NodeLIRBuilderTool generator) {
-        AMD64NodeLIRBuilder gen = (AMD64NodeLIRBuilder) generator;
-        Value[] parameter = new Value[args.count()];
-        JavaType[] parameterTypes = new JavaType[args.count()];
-        for (int i = 0; i < args.count(); i++) {
-            parameter[i] = generator.operand(args.get(i));
-            parameterTypes[i] = toJavaType(args.get(i).stamp(), gen.getLIRGeneratorTool().getMetaAccess());
-        }
-        JavaType returnType = toJavaType(stamp(), gen.getLIRGeneratorTool().getMetaAccess());
-        CallingConvention cc = generator.getLIRGeneratorTool().getCodeCache().getRegisterConfig().getCallingConvention(HotSpotCallingConventionType.NativeCall, returnType, parameterTypes,
-                        generator.getLIRGeneratorTool());
-        gen.getLIRGeneratorTool().emitCCall(functionPointer.asLong(), cc, parameter, countFloatingTypeArguments(args));
-        if (this.getStackKind() != JavaKind.Void) {
-            generator.setResult(this, gen.getLIRGeneratorTool().emitMove(cc.getReturn()));
-        }
-    }
-
-    private static int countFloatingTypeArguments(NodeInputList<ValueNode> args) {
-        int count = 0;
-        for (ValueNode n : args) {
-            if (n.getStackKind() == JavaKind.Double || n.getStackKind() == JavaKind.Float) {
-                count++;
-            }
-        }
-        if (count > 8) {
-            return 8;
-        }
-        return count;
-    }
-
-}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java	Sat Sep 09 14:36:45 2017 +0200
@@ -207,7 +207,6 @@
                         "oracle/jrockit/jfr/Timing.counterTime()J",
                         "oracle/jrockit/jfr/VMJFR.classID0(Ljava/lang/Class;)J",
                         "oracle/jrockit/jfr/VMJFR.threadID()I",
-                        "sun/misc/Unsafe.copyMemory(Ljava/lang/Object;JLjava/lang/Object;JJ)V",
                         "sun/nio/cs/ISO_8859_1$Encoder.encodeISOArray([CI[BII)I",
                         "sun/security/provider/DigestBase.implCompressMultiBlock([BII)I",
                         "sun/security/provider/SHA.implCompress([BI)V",
@@ -273,7 +272,6 @@
                         "jdk/internal/misc/Unsafe.compareAndExchangeShortRelease(Ljava/lang/Object;JSS)S",
                         "jdk/internal/misc/Unsafe.compareAndSetByte(Ljava/lang/Object;JBB)Z",
                         "jdk/internal/misc/Unsafe.compareAndSetShort(Ljava/lang/Object;JSS)Z",
-                        "jdk/internal/misc/Unsafe.copyMemory0(Ljava/lang/Object;JLjava/lang/Object;JJ)V",
                         "jdk/internal/misc/Unsafe.getAndAddByte(Ljava/lang/Object;JB)B",
                         "jdk/internal/misc/Unsafe.getAndAddShort(Ljava/lang/Object;JS)S",
                         "jdk/internal/misc/Unsafe.getAndSetByte(Ljava/lang/Object;JB)B",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotUnsafeSubstitutionTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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.
+ */
+package org.graalvm.compiler.hotspot.test;
+
+import org.graalvm.compiler.replacements.test.MethodSubstitutionTest;
+import org.junit.Test;
+
+import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import sun.misc.Unsafe;
+
+/**
+ * Tests the VM independent intrinsification of {@link Unsafe} methods.
+ */
+public class HotSpotUnsafeSubstitutionTest extends MethodSubstitutionTest {
+
+    public void testSubstitution(String testMethodName, Class<?> holder, String methodName, Class<?>[] parameterTypes, Object receiver, Object[] args1, Object[] args2) {
+        ResolvedJavaMethod testMethod = getResolvedJavaMethod(testMethodName);
+        ResolvedJavaMethod originalMethod = getResolvedJavaMethod(holder, methodName, parameterTypes);
+
+        // Force compilation
+        InstalledCode code = getCode(testMethod);
+        assert code != null;
+
+        // Verify that the original method and the substitution produce the same value
+        Object expected = invokeSafe(originalMethod, receiver, args1);
+        Object actual = invokeSafe(testMethod, null, args2);
+        assertDeepEquals(expected, actual);
+
+        // Verify that the generated code and the original produce the same value
+        expected = invokeSafe(originalMethod, receiver, args1);
+        actual = executeVarargsSafe(code, args2);
+        assertDeepEquals(expected, actual);
+
+    }
+
+    @Test
+    public void testUnsafeSubstitutions() throws Exception {
+        testGraph("unsafeCopyMemory");
+    }
+
+    public void unsafeCopyMemory(Object srcBase, long srcOffset, Object dstBase, long dstOffset, long bytes) {
+        UNSAFE.copyMemory(srcBase, srcOffset, dstBase, dstOffset, bytes);
+    }
+
+    public byte[] testCopyMemorySnippet(long src, int bytes) {
+        byte[] result = new byte[bytes];
+        UNSAFE.copyMemory(null, src, result, Unsafe.ARRAY_BYTE_BASE_OFFSET, bytes);
+        return result;
+    }
+
+    @Test
+    public void testCopyMemory() {
+        int size = 128;
+        long src = UNSAFE.allocateMemory(size);
+        for (int i = 0; i < size; i++) {
+            UNSAFE.putByte(null, src + i, (byte) i);
+        }
+        test("testCopyMemorySnippet", src, size);
+    }
+}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java	Sat Sep 09 14:36:45 2017 +0200
@@ -64,9 +64,9 @@
 import org.graalvm.compiler.options.OptionValues;
 import org.graalvm.compiler.phases.tiers.SuitesProvider;
 import org.graalvm.compiler.word.Word;
-import org.graalvm.util.Equivalence;
 import org.graalvm.util.EconomicMap;
 import org.graalvm.util.EconomicSet;
+import org.graalvm.util.Equivalence;
 import org.graalvm.util.MapCursor;
 import org.graalvm.word.Pointer;
 
@@ -258,6 +258,18 @@
     private static native void sha5ImplCompressStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word bufAddr, Object state);
 
     /**
+     * @see org.graalvm.compiler.hotspot.meta.HotSpotUnsafeSubstitutions#copyMemory
+     */
+    public static final ForeignCallDescriptor UNSAFE_ARRAYCOPY = new ForeignCallDescriptor("unsafe_arraycopy", void.class, Word.class, Word.class, Word.class);
+
+    public static void unsafeArraycopy(Word srcAddr, Word dstAddr, Word size) {
+        unsafeArraycopyStub(HotSpotBackend.UNSAFE_ARRAYCOPY, srcAddr, dstAddr, size);
+    }
+
+    @NodeIntrinsic(ForeignCallNode.class)
+    private static native void unsafeArraycopyStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word srcAddr, Word dstAddr, Word size);
+
+    /**
      * @see VMErrorNode
      */
     public static final ForeignCallDescriptor VM_ERROR = new ForeignCallDescriptor("vm_error", void.class, Object.class, Object.class, long.class);
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java	Sat Sep 09 14:36:45 2017 +0200
@@ -198,7 +198,7 @@
 
     public CompilationResult compile(ResolvedJavaMethod method, int entryBCI, boolean useProfilingInfo, CompilationIdentifier compilationId, OptionValues options, DebugContext debug) {
         StructuredGraph graph = createGraph(method, entryBCI, useProfilingInfo, compilationId, options, debug);
-        CompilationResult result = new CompilationResult();
+        CompilationResult result = new CompilationResult(compilationId);
         return compileHelper(CompilationResultBuilderFactory.Default, result, graph, method, entryBCI, useProfilingInfo, options);
     }
 
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java	Sat Sep 09 14:36:45 2017 +0200
@@ -111,6 +111,7 @@
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.MetaAccessProvider;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
+import sun.misc.Unsafe;
 
 /**
  * Defines the {@link Plugins} used when running on HotSpot.
@@ -202,6 +203,7 @@
                 registerCRC32Plugins(invocationPlugins, config, replacementBytecodeProvider);
                 registerBigIntegerPlugins(invocationPlugins, config, replacementBytecodeProvider);
                 registerSHAPlugins(invocationPlugins, config, replacementBytecodeProvider);
+                registerUnsafePlugins(invocationPlugins, replacementBytecodeProvider);
                 StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, snippetReflection, invocationPlugins, replacementBytecodeProvider, true);
 
                 for (NodeIntrinsicPluginFactory factory : GraalServices.load(NodeIntrinsicPluginFactory.class)) {
@@ -313,6 +315,17 @@
         r.registerMethodSubstitution(ReflectionSubstitutions.class, "getClassAccessFlags", Class.class);
     }
 
+    private static void registerUnsafePlugins(InvocationPlugins plugins, BytecodeProvider replacementBytecodeProvider) {
+        Registration r;
+        if (Java8OrEarlier) {
+            r = new Registration(plugins, Unsafe.class, replacementBytecodeProvider);
+        } else {
+            r = new Registration(plugins, "jdk.internal.misc.Unsafe", replacementBytecodeProvider);
+        }
+        r.registerMethodSubstitution(HotSpotUnsafeSubstitutions.class, HotSpotUnsafeSubstitutions.copyMemoryName, "copyMemory", Receiver.class, Object.class, long.class, Object.class, long.class,
+                        long.class);
+    }
+
     private static final LocationIdentity INSTANCE_KLASS_CONSTANTS = NamedLocationIdentity.immutable("InstanceKlass::_constants");
     private static final LocationIdentity CONSTANT_POOL_LENGTH = NamedLocationIdentity.immutable("ConstantPool::_length");
 
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java	Sat Sep 09 14:36:45 2017 +0200
@@ -51,6 +51,7 @@
 import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA5_IMPL_COMPRESS;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA_IMPL_COMPRESS;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.SQUARE_TO_LEN;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.UNSAFE_ARRAYCOPY;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.VM_ERROR;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.WRONG_METHOD_HANDLER;
@@ -330,6 +331,8 @@
         registerCheckcastArraycopyDescriptor(true, c.checkcastArraycopyUninit);
         registerCheckcastArraycopyDescriptor(false, c.checkcastArraycopy);
 
+        registerForeignCall(UNSAFE_ARRAYCOPY, c.unsafeArraycopy, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.any());
+
         if (c.useMultiplyToLenIntrinsic()) {
             registerForeignCall(MULTIPLY_TO_LEN, c.multiplyToLen, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(JavaKind.Int));
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotUnsafeSubstitutions.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.graalvm.compiler.hotspot.meta;
+
+import static org.graalvm.compiler.serviceprovider.JDK9Method.Java8OrEarlier;
+
+import org.graalvm.compiler.api.replacements.ClassSubstitution;
+import org.graalvm.compiler.api.replacements.MethodSubstitution;
+import org.graalvm.compiler.hotspot.HotSpotBackend;
+import org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode;
+import org.graalvm.compiler.word.Word;
+import org.graalvm.word.WordFactory;
+
+@ClassSubstitution(className = {"jdk.internal.misc.Unsafe", "sun.misc.Unsafe"})
+public class HotSpotUnsafeSubstitutions {
+
+    public static final String copyMemoryName = Java8OrEarlier ? "copyMemory" : "copyMemory0";
+
+    @SuppressWarnings("unused")
+    @MethodSubstitution(isStatic = false)
+    static void copyMemory(Object receiver, Object srcBase, long srcOffset, Object destBase, long destOffset, long bytes) {
+        Word srcAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(srcBase, srcOffset));
+        Word dstAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(destBase, destOffset));
+        Word size = Word.signed(bytes);
+        HotSpotBackend.unsafeArraycopy(srcAddr, dstAddr, size);
+    }
+}
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java	Sat Sep 09 14:36:45 2017 +0200
@@ -216,8 +216,9 @@
 
     @SuppressWarnings("try")
     private CompilationResult buildCompilationResult(DebugContext debug, final Backend backend) {
-        CompilationResult compResult = new CompilationResult(toString(), GeneratePIC.getValue(options));
-        final StructuredGraph graph = getGraph(debug, getStubCompilationId());
+        CompilationIdentifier compilationId = getStubCompilationId();
+        final StructuredGraph graph = getGraph(debug, compilationId);
+        CompilationResult compResult = new CompilationResult(compilationId, toString(), GeneratePIC.getValue(options));
 
         // Stubs cannot be recompiled so they cannot be compiled with assumptions
         assert graph.getAssumptions() == null;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceInterval.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceInterval.java	Sat Sep 09 14:36:45 2017 +0200
@@ -365,10 +365,6 @@
         return intTo;
     }
 
-    int numUsePositions() {
-        return numUsePos();
-    }
-
     public void setLocationHint(IntervalHint interval) {
         locationHint = interval;
     }
@@ -452,6 +448,10 @@
         return spillSt == SpillState.StartInMemory || (spillSt == SpillState.SpillStore && opId > spillDefinitionPos() && !canMaterialize());
     }
 
+    public boolean preSpilledAllocated() {
+        return spillState() == SpillState.StartInMemory && numUsePos() == 0 && !hasHint();
+    }
+
     // test intersection
     boolean intersects(TraceInterval i) {
         return intersectsAt(i) != -1;
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanLifetimeAnalysisPhase.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanLifetimeAnalysisPhase.java	Sat Sep 09 14:36:45 2017 +0200
@@ -541,16 +541,23 @@
                 assert instructionIndex == 0 : "not at start?" + instructionIndex;
                 handleTraceBegin(blocks[0]);
 
-                // fix spill state for phi/incoming intervals
-                for (TraceInterval interval : allocator.intervals()) {
-                    if (interval != null && interval.spillState().equals(SpillState.NoDefinitionFound) && interval.spillDefinitionPos() != -1) {
-                        // there was a definition in a phi/incoming
-                        interval.setSpillState(SpillState.NoSpillStore);
-                    }
-                }
                 if (TraceRAuseInterTraceHints.getValue(allocator.getLIR().getOptions())) {
                     addInterTraceHints();
                 }
+                // fix spill state for phi/incoming intervals
+                for (TraceInterval interval : allocator.intervals()) {
+                    if (interval != null) {
+                        if (interval.spillState().equals(SpillState.NoDefinitionFound) && interval.spillDefinitionPos() != -1) {
+                            // there was a definition in a phi/incoming
+                            interval.setSpillState(SpillState.NoSpillStore);
+                        }
+                        if (interval.preSpilledAllocated()) {
+                            // pre-spill unused, start in memory intervals
+                            allocator.assignSpillSlot(interval);
+                        }
+                    }
+                }
+
                 for (FixedInterval interval1 : allocator.fixedIntervals()) {
                     if (interval1 != null) {
                         /* We use [-1, 0] to avoid intersection with incoming values. */
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanPhase.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanPhase.java	Sat Sep 09 14:36:45 2017 +0200
@@ -153,7 +153,7 @@
         @Override
         public boolean apply(TraceInterval i) {
             // all TraceIntervals are variable intervals
-            return true;
+            return !i.preSpilledAllocated();
         }
     };
     private static final Comparator<TraceInterval> SORT_BY_FROM_COMP = new Comparator<TraceInterval>() {
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java	Sat Sep 09 14:36:45 2017 +0200
@@ -319,7 +319,7 @@
         assert !graph.isFrozen();
         ResolvedJavaMethod installedCodeOwner = graph.method();
         request = new Request<>(graph, installedCodeOwner, getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL,
-                        graph.getProfilingInfo(), createSuites(getOptions()), createLIRSuites(getOptions()), new CompilationResult(), CompilationResultBuilderFactory.Default);
+                        graph.getProfilingInfo(), createSuites(getOptions()), createLIRSuites(getOptions()), new CompilationResult(graph.compilationId()), CompilationResultBuilderFactory.Default);
     }
 
     /**
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java	Sat Sep 09 14:36:45 2017 +0200
@@ -209,7 +209,6 @@
         int nodeCount = nodeOrder.nextOrderId;
         assert nodeOrder.orderIds.get(graph.start()) == START_NODE_ORDER_ID;
         assert nodeOrder.orderIds.get(graph.start().next()) == FIRST_NODE_ORDER_ID;
-        assert nodeCount == graph.getNodeCount() + 1;
 
         long[] nodeStartOffsets = new long[nodeCount];
         UnmodifiableMapCursor<Node, Integer> cursor = nodeOrder.orderIds.getEntries();
@@ -218,6 +217,7 @@
             Integer orderId = cursor.getValue();
 
             assert !(node instanceof AbstractBeginNode) || nodeOrder.orderIds.get(((AbstractBeginNode) node).next()) == orderId + BEGIN_NEXT_ORDER_ID_OFFSET;
+            assert nodeStartOffsets[orderId] == 0;
             nodeStartOffsets[orderId] = writer.getBytesWritten();
 
             /* Write out the type, properties, and edges. */
@@ -284,7 +284,6 @@
         writer.putUV(nodeOrder.maxFixedNodeOrderId);
         writer.putUV(nodeCount);
         for (int i = 0; i < nodeCount; i++) {
-            assert i == NULL_ORDER_ID || i == START_NODE_ORDER_ID || nodeStartOffsets[i] > 0;
             writer.putUV(metadataStart - nodeStartOffsets[i]);
         }
 
@@ -344,8 +343,25 @@
             } while (current != null);
 
             maxFixedNodeOrderId = nextOrderId - 1;
+
+            /*
+             * Emit all parameters consecutively at a known location (after all fixed nodes). This
+             * allows substituting parameters when inlining during decoding by pre-initializing the
+             * decoded node list.
+             *
+             * Note that not all parameters must be present (unused parameters are deleted after
+             * parsing). This leads to holes in the orderId, i.e., unused orderIds.
+             */
+            int parameterCount = graph.method().getSignature().getParameterCount(!graph.method().isStatic());
+            for (ParameterNode node : graph.getNodes(ParameterNode.TYPE)) {
+                assert orderIds.get(node) == null : "Parameter node must not be ordered yet";
+                assert node.index() < parameterCount : "Parameter index out of range";
+                orderIds.set(node, nextOrderId + node.index());
+            }
+            nextOrderId += parameterCount;
+
             for (Node node : graph.getNodes()) {
-                assert (node instanceof FixedNode) == (orderIds.get(node) != null) : "all fixed nodes must be ordered: " + node;
+                assert (node instanceof FixedNode || node instanceof ParameterNode) == (orderIds.get(node) != null) : "all fixed nodes and ParameterNodes must be ordered: " + node;
                 add(node);
             }
         }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java	Sat Sep 09 14:36:45 2017 +0200
@@ -37,6 +37,7 @@
 import org.graalvm.compiler.bytecode.BytecodeDisassembler;
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.code.DisassemblerProvider;
+import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.core.common.alloc.Trace;
 import org.graalvm.compiler.core.common.alloc.TraceBuilderResult;
 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
@@ -72,6 +73,7 @@
     private CFGPrinter cfgPrinter;
     private File cfgFile;
     private JavaMethod curMethod;
+    private CompilationIdentifier curCompilation;
     private List<String> curDecorators = Collections.emptyList();
 
     @Override
@@ -92,6 +94,7 @@
      */
     private boolean checkMethodScope(DebugContext debug) {
         JavaMethod method = null;
+        CompilationIdentifier compilation = null;
         ArrayList<String> decorators = new ArrayList<>();
         for (Object o : debug.context()) {
             if (o instanceof JavaMethod) {
@@ -102,22 +105,33 @@
                 if (graph.method() != null) {
                     method = graph.method();
                     decorators.clear();
+                    compilation = graph.compilationId();
                 }
             } else if (o instanceof DebugDumpScope) {
                 DebugDumpScope debugDumpScope = (DebugDumpScope) o;
                 if (debugDumpScope.decorator) {
                     decorators.add(debugDumpScope.name);
                 }
+            } else if (o instanceof CompilationResult) {
+                CompilationResult compilationResult = (CompilationResult) o;
+                compilation = compilationResult.getCompilationId();
             }
         }
 
-        if (method == null) {
+        if (method == null && compilation == null) {
             return false;
         }
 
-        if (!method.equals(curMethod) || !curDecorators.equals(decorators)) {
-            cfgPrinter.printCompilation(method);
+        if (compilation != null) {
+            if (!compilation.equals(curCompilation) || !curDecorators.equals(decorators)) {
+                cfgPrinter.printCompilation(compilation);
+            }
+        } else {
+            if (!method.equals(curMethod) || !curDecorators.equals(decorators)) {
+                cfgPrinter.printCompilation(method);
+            }
         }
+        curCompilation = compilation;
         curMethod = method;
         curDecorators = decorators;
         return true;
@@ -277,6 +291,7 @@
             cfgPrinter = null;
             curDecorators = Collections.emptyList();
             curMethod = null;
+            curCompilation = null;
         }
     }
 
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CompilationPrinter.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CompilationPrinter.java	Sat Sep 09 14:36:45 2017 +0200
@@ -31,6 +31,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.debug.LogStream;
 import org.graalvm.compiler.debug.TTY;
 import org.graalvm.compiler.lir.util.IndexedValueMap;
@@ -115,12 +116,25 @@
     /**
      * Prints a compilation timestamp for a given method.
      *
-     * @param method the method for which a timestamp will be printed
+     * @param javaMethod the method for which a timestamp will be printed
      */
-    public void printCompilation(JavaMethod method) {
+    public void printCompilation(JavaMethod javaMethod) {
+        printCompilation(javaMethod.format("%H::%n"), javaMethod.format("%f %r %H.%n(%p)"));
+    }
+
+    /**
+     * Prints a compilation id.
+     *
+     * @param compilationId the compilation method for which an id will be printed
+     */
+    public void printCompilation(CompilationIdentifier compilationId) {
+        printCompilation(compilationId.toString(CompilationIdentifier.Verbosity.DETAILED), compilationId.toString(CompilationIdentifier.Verbosity.DETAILED));
+    }
+
+    private void printCompilation(final String name, String method) {
         begin("compilation");
-        out.print("name \" ").print(method.format("%H::%n")).println('"');
-        out.print("method \"").print(method.format("%f %r %H.%n(%p)")).println('"');
+        out.print("name \" ").print(name).println('"');
+        out.print("method \"").print(method).println('"');
         out.print("date ").println(System.currentTimeMillis());
         end("compilation");
     }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.verifier/src/org/graalvm/compiler/replacements/verifier/ClassSubstitutionVerifier.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.verifier/src/org/graalvm/compiler/replacements/verifier/ClassSubstitutionVerifier.java	Sat Sep 09 14:36:45 2017 +0200
@@ -95,10 +95,13 @@
             TypeElement typeElement = null;
             for (String className : classNames) {
                 typeElement = env.getElementUtils().getTypeElement(className);
-                if (typeElement == null && !optional) {
-                    env.getMessager().printMessage(Kind.ERROR, String.format("The class '%s' was not found on the classpath.", stringValue), sourceElement, classSubstition, stringValue);
+                if (typeElement != null) {
+                    break;
                 }
             }
+            if (typeElement == null && !optional) {
+                env.getMessager().printMessage(Kind.ERROR, String.format("The class '%s' was not found on the classpath.", stringValue), sourceElement, classSubstition, stringValue);
+            }
 
             return typeElement;
         }
--- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java	Sat Sep 09 14:36:45 2017 +0200
@@ -707,10 +707,22 @@
             }
         }
 
+        LoopScope inlineLoopScope = createInitialLoopScope(inlineScope, predecessor);
+
+        /*
+         * The GraphEncoder assigns parameters a nodeId immediately after the fixed nodes.
+         * Initializing createdNodes here avoid decoding and immediately replacing the
+         * ParameterNodes.
+         */
+        int firstArgumentNodeId = inlineScope.maxFixedNodeOrderId + 1;
+        for (int i = 0; i < arguments.length; i++) {
+            inlineLoopScope.createdNodes[firstArgumentNodeId + i] = arguments[i];
+        }
+
         /*
          * Do the actual inlining by returning the initial loop scope for the inlined method scope.
          */
-        return createInitialLoopScope(inlineScope, predecessor);
+        return inlineLoopScope;
     }
 
     @Override
@@ -1028,9 +1040,7 @@
         if (node instanceof ParameterNode) {
             ParameterNode param = (ParameterNode) node;
             if (methodScope.isInlinedMethod()) {
-                Node result = methodScope.arguments[param.index()];
-                assert result != null;
-                return result;
+                throw GraalError.shouldNotReachHere("Parameter nodes are already registered when the inlined scope is created");
 
             } else if (parameterPlugin != null) {
                 assert !methodScope.isInlinedMethod();
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -1185,62 +1185,6 @@
 // directory not the java application's temp directory, ala java.io.tmpdir.
 const char* os::get_temp_directory() { return "/tmp"; }
 
-static bool file_exists(const char* filename) {
-  struct stat statbuf;
-  if (filename == NULL || strlen(filename) == 0) {
-    return false;
-  }
-  return os::stat(filename, &statbuf) == 0;
-}
-
-bool os::dll_build_name(char* buffer, size_t buflen,
-                        const char* pname, const char* fname) {
-  bool retval = false;
-  // Copied from libhpi
-  const size_t pnamelen = pname ? strlen(pname) : 0;
-
-  // Return error on buffer overflow.
-  if (pnamelen + strlen(fname) + 10 > (size_t) buflen) {
-    *buffer = '\0';
-    return retval;
-  }
-
-  if (pnamelen == 0) {
-    snprintf(buffer, buflen, "lib%s.so", fname);
-    retval = true;
-  } else if (strchr(pname, *os::path_separator()) != NULL) {
-    int n;
-    char** pelements = split_path(pname, &n);
-    if (pelements == NULL) {
-      return false;
-    }
-    for (int i = 0; i < n; i++) {
-      // Really shouldn't be NULL, but check can't hurt
-      if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
-        continue; // skip the empty path values
-      }
-      snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname);
-      if (file_exists(buffer)) {
-        retval = true;
-        break;
-      }
-    }
-    // release the storage
-    for (int i = 0; i < n; i++) {
-      if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i]);
-      }
-    }
-    if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements);
-    }
-  } else {
-    snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
-    retval = true;
-  }
-  return retval;
-}
-
 // Check if addr is inside libjvm.so.
 bool os::address_is_in_vm(address addr) {
 
@@ -1493,12 +1437,7 @@
 }
 
 void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
-  st->print("CPU:");
-  st->print("total %d", os::processor_count());
-  // It's not safe to query number of active processors after crash.
-  // st->print("(active %d)", os::active_processor_count());
-  st->print(" %s", VM_Version::features());
-  st->cr();
+  // Nothing to do beyond what os::print_cpu_info() does.
 }
 
 static void print_signal_handler(outputStream* st, int sig,
@@ -2668,11 +2607,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 // suspend/resume support
 
-//  the low-level signal-based suspend/resume support is a remnant from the
+//  The low-level signal-based suspend/resume support is a remnant from the
 //  old VM-suspension that used to be for java-suspension, safepoints etc,
-//  within hotspot. Now there is a single use-case for this:
-//    - calling get_thread_pc() on the VMThread by the flat-profiler task
-//      that runs in the watcher thread.
+//  within hotspot. Currently used by JFR's OSThreadSampler
+//
 //  The remaining code is greatly simplified from the more general suspension
 //  code that used to be used.
 //
@@ -2688,7 +2626,13 @@
 //
 //  Note that the SR_lock plays no role in this suspend/resume protocol,
 //  but is checked for NULL in SR_handler as a thread termination indicator.
+//  The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
 //
+//  Note that resume_clear_context() and suspend_save_context() are needed
+//  by SR_handler(), so that fetch_frame_from_ucontext() works,
+//  which in part is used by:
+//    - Forte Analyzer: AsyncGetCallTrace()
+//    - StackBanging: get_frame_at_stack_banging_point()
 
 static void resume_clear_context(OSThread *osthread) {
   osthread->set_ucontext(NULL);
@@ -3695,44 +3639,6 @@
   }
 }
 
-class PcFetcher : public os::SuspendedThreadTask {
-public:
-  PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {}
-  ExtendedPC result();
-protected:
-  void do_task(const os::SuspendedThreadTaskContext& context);
-private:
-  ExtendedPC _epc;
-};
-
-ExtendedPC PcFetcher::result() {
-  guarantee(is_done(), "task is not done yet.");
-  return _epc;
-}
-
-void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) {
-  Thread* thread = context.thread();
-  OSThread* osthread = thread->osthread();
-  if (osthread->ucontext() != NULL) {
-    _epc = os::Aix::ucontext_get_pc((const ucontext_t *) context.ucontext());
-  } else {
-    // NULL context is unexpected, double-check this is the VMThread.
-    guarantee(thread->is_VM_thread(), "can only be called for VMThread");
-  }
-}
-
-// Suspends the target using the signal mechanism and then grabs the PC before
-// resuming the target. Used by the flat-profiler only
-ExtendedPC os::get_thread_pc(Thread* thread) {
-  // Make sure that it is called by the watcher for the VMThread.
-  assert(Thread::current()->is_Watcher_thread(), "Must be watcher");
-  assert(thread->is_VM_thread(), "Can only be called for VMThread");
-
-  PcFetcher fetcher(thread);
-  fetcher.run();
-  return fetcher.result();
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // debug support
 
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -1172,13 +1172,6 @@
 
 // DLL functions
 
-#define JNI_LIB_PREFIX "lib"
-#ifdef __APPLE__
-  #define JNI_LIB_SUFFIX ".dylib"
-#else
-  #define JNI_LIB_SUFFIX ".so"
-#endif
-
 const char* os::dll_file_extension() { return JNI_LIB_SUFFIX; }
 
 // This must be hard coded because it's the system's temporary
@@ -1201,62 +1194,6 @@
 const char* os::get_temp_directory() { return "/tmp"; }
 #endif // __APPLE__
 
-static bool file_exists(const char* filename) {
-  struct stat statbuf;
-  if (filename == NULL || strlen(filename) == 0) {
-    return false;
-  }
-  return os::stat(filename, &statbuf) == 0;
-}
-
-bool os::dll_build_name(char* buffer, size_t buflen,
-                        const char* pname, const char* fname) {
-  bool retval = false;
-  // Copied from libhpi
-  const size_t pnamelen = pname ? strlen(pname) : 0;
-
-  // Return error on buffer overflow.
-  if (pnamelen + strlen(fname) + strlen(JNI_LIB_PREFIX) + strlen(JNI_LIB_SUFFIX) + 2 > buflen) {
-    return retval;
-  }
-
-  if (pnamelen == 0) {
-    snprintf(buffer, buflen, JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, fname);
-    retval = true;
-  } else if (strchr(pname, *os::path_separator()) != NULL) {
-    int n;
-    char** pelements = split_path(pname, &n);
-    if (pelements == NULL) {
-      return false;
-    }
-    for (int i = 0; i < n; i++) {
-      // Really shouldn't be NULL, but check can't hurt
-      if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
-        continue; // skip the empty path values
-      }
-      snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX,
-               pelements[i], fname);
-      if (file_exists(buffer)) {
-        retval = true;
-        break;
-      }
-    }
-    // release the storage
-    for (int i = 0; i < n; i++) {
-      if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i]);
-      }
-    }
-    if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements);
-    }
-  } else {
-    snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname);
-    retval = true;
-  }
-  return retval;
-}
-
 // check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
@@ -2666,11 +2603,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 // suspend/resume support
 
-//  the low-level signal-based suspend/resume support is a remnant from the
+//  The low-level signal-based suspend/resume support is a remnant from the
 //  old VM-suspension that used to be for java-suspension, safepoints etc,
-//  within hotspot. Now there is a single use-case for this:
-//    - calling get_thread_pc() on the VMThread by the flat-profiler task
-//      that runs in the watcher thread.
+//  within hotspot. Currently used by JFR's OSThreadSampler
+//
 //  The remaining code is greatly simplified from the more general suspension
 //  code that used to be used.
 //
@@ -2686,6 +2622,13 @@
 //
 //  Note that the SR_lock plays no role in this suspend/resume protocol,
 //  but is checked for NULL in SR_handler as a thread termination indicator.
+//  The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
+//
+//  Note that resume_clear_context() and suspend_save_context() are needed
+//  by SR_handler(), so that fetch_frame_from_ucontext() works,
+//  which in part is used by:
+//    - Forte Analyzer: AsyncGetCallTrace()
+//    - StackBanging: get_frame_at_stack_banging_point()
 
 static void resume_clear_context(OSThread *osthread) {
   osthread->set_ucontext(NULL);
@@ -3584,45 +3527,6 @@
   }
 }
 
-///
-class PcFetcher : public os::SuspendedThreadTask {
- public:
-  PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {}
-  ExtendedPC result();
- protected:
-  void do_task(const os::SuspendedThreadTaskContext& context);
- private:
-  ExtendedPC _epc;
-};
-
-ExtendedPC PcFetcher::result() {
-  guarantee(is_done(), "task is not done yet.");
-  return _epc;
-}
-
-void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) {
-  Thread* thread = context.thread();
-  OSThread* osthread = thread->osthread();
-  if (osthread->ucontext() != NULL) {
-    _epc = os::Bsd::ucontext_get_pc((const ucontext_t *) context.ucontext());
-  } else {
-    // NULL context is unexpected, double-check this is the VMThread
-    guarantee(thread->is_VM_thread(), "can only be called for VMThread");
-  }
-}
-
-// Suspends the target using the signal mechanism and then grabs the PC before
-// resuming the target. Used by the flat-profiler only
-ExtendedPC os::get_thread_pc(Thread* thread) {
-  // Make sure that it is called by the watcher for the VMThread
-  assert(Thread::current()->is_Watcher_thread(), "Must be watcher");
-  assert(thread->is_VM_thread(), "Can only be called for VMThread");
-
-  PcFetcher fetcher(thread);
-  fetcher.run();
-  return fetcher.result();
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // debug support
 
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -1419,53 +1419,6 @@
   return os::stat(filename, &statbuf) == 0;
 }
 
-bool os::dll_build_name(char* buffer, size_t buflen,
-                        const char* pname, const char* fname) {
-  bool retval = false;
-  // Copied from libhpi
-  const size_t pnamelen = pname ? strlen(pname) : 0;
-
-  // Return error on buffer overflow.
-  if (pnamelen + strlen(fname) + 10 > (size_t) buflen) {
-    return retval;
-  }
-
-  if (pnamelen == 0) {
-    snprintf(buffer, buflen, "lib%s.so", fname);
-    retval = true;
-  } else if (strchr(pname, *os::path_separator()) != NULL) {
-    int n;
-    char** pelements = split_path(pname, &n);
-    if (pelements == NULL) {
-      return false;
-    }
-    for (int i = 0; i < n; i++) {
-      // Really shouldn't be NULL, but check can't hurt
-      if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
-        continue; // skip the empty path values
-      }
-      snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname);
-      if (file_exists(buffer)) {
-        retval = true;
-        break;
-      }
-    }
-    // release the storage
-    for (int i = 0; i < n; i++) {
-      if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i]);
-      }
-    }
-    if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements);
-    }
-  } else {
-    snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
-    retval = true;
-  }
-  return retval;
-}
-
 // check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
@@ -4047,11 +4000,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 // suspend/resume support
 
-//  the low-level signal-based suspend/resume support is a remnant from the
+//  The low-level signal-based suspend/resume support is a remnant from the
 //  old VM-suspension that used to be for java-suspension, safepoints etc,
-//  within hotspot. Now there is a single use-case for this:
-//    - calling get_thread_pc() on the VMThread by the flat-profiler task
-//      that runs in the watcher thread.
+//  within hotspot. Currently used by JFR's OSThreadSampler
+//
 //  The remaining code is greatly simplified from the more general suspension
 //  code that used to be used.
 //
@@ -4067,6 +4019,13 @@
 //
 //  Note that the SR_lock plays no role in this suspend/resume protocol,
 //  but is checked for NULL in SR_handler as a thread termination indicator.
+//  The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
+//
+//  Note that resume_clear_context() and suspend_save_context() are needed
+//  by SR_handler(), so that fetch_frame_from_ucontext() works,
+//  which in part is used by:
+//    - Forte Analyzer: AsyncGetCallTrace()
+//    - StackBanging: get_frame_at_stack_banging_point()
 
 static void resume_clear_context(OSThread *osthread) {
   osthread->set_ucontext(NULL);
@@ -5107,44 +5066,6 @@
   }
 }
 
-class PcFetcher : public os::SuspendedThreadTask {
- public:
-  PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {}
-  ExtendedPC result();
- protected:
-  void do_task(const os::SuspendedThreadTaskContext& context);
- private:
-  ExtendedPC _epc;
-};
-
-ExtendedPC PcFetcher::result() {
-  guarantee(is_done(), "task is not done yet.");
-  return _epc;
-}
-
-void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) {
-  Thread* thread = context.thread();
-  OSThread* osthread = thread->osthread();
-  if (osthread->ucontext() != NULL) {
-    _epc = os::Linux::ucontext_get_pc((const ucontext_t *) context.ucontext());
-  } else {
-    // NULL context is unexpected, double-check this is the VMThread
-    guarantee(thread->is_VM_thread(), "can only be called for VMThread");
-  }
-}
-
-// Suspends the target using the signal mechanism and then grabs the PC before
-// resuming the target. Used by the flat-profiler only
-ExtendedPC os::get_thread_pc(Thread* thread) {
-  // Make sure that it is called by the watcher for the VMThread
-  assert(Thread::current()->is_Watcher_thread(), "Must be watcher");
-  assert(thread->is_VM_thread(), "Can only be called for VMThread");
-
-  PcFetcher fetcher(thread);
-  fetcher.run();
-  return fetcher.result();
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // debug support
 
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -24,7 +24,6 @@
 
 #include "utilities/globalDefinitions.hpp"
 #include "prims/jvm.h"
-#include "semaphore_posix.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/os.hpp"
@@ -32,6 +31,11 @@
 #include "utilities/macros.hpp"
 #include "utilities/vmError.hpp"
 
+#ifndef __APPLE__
+// POSIX unamed semaphores are not supported on OS X.
+#include "semaphore_posix.hpp"
+#endif
+
 #include <dlfcn.h>
 #include <pthread.h>
 #include <semaphore.h>
--- a/hotspot/src/os/solaris/vm/osThread_solaris.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os/solaris/vm/osThread_solaris.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -65,12 +65,6 @@
   void set_lwp_id(uint id)           { _lwp_id = id; }
   void set_native_priority(int prio) { _native_priority = prio; }
 
- // ***************************************************************
- // interrupt support.  interrupts (using signals) are used to get
- // the thread context (get_thread_pc), to set the thread context
- // (set_thread_pc), and to implement java.lang.Thread.interrupt.
- // ***************************************************************
-
  public:
   os::SuspendResume sr;
 
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -1356,60 +1356,6 @@
 // directory not the java application's temp directory, ala java.io.tmpdir.
 const char* os::get_temp_directory() { return "/tmp"; }
 
-static bool file_exists(const char* filename) {
-  struct stat statbuf;
-  if (filename == NULL || strlen(filename) == 0) {
-    return false;
-  }
-  return os::stat(filename, &statbuf) == 0;
-}
-
-bool os::dll_build_name(char* buffer, size_t buflen,
-                        const char* pname, const char* fname) {
-  bool retval = false;
-  const size_t pnamelen = pname ? strlen(pname) : 0;
-
-  // Return error on buffer overflow.
-  if (pnamelen + strlen(fname) + 10 > (size_t) buflen) {
-    return retval;
-  }
-
-  if (pnamelen == 0) {
-    snprintf(buffer, buflen, "lib%s.so", fname);
-    retval = true;
-  } else if (strchr(pname, *os::path_separator()) != NULL) {
-    int n;
-    char** pelements = split_path(pname, &n);
-    if (pelements == NULL) {
-      return false;
-    }
-    for (int i = 0; i < n; i++) {
-      // really shouldn't be NULL but what the heck, check can't hurt
-      if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
-        continue; // skip the empty path values
-      }
-      snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname);
-      if (file_exists(buffer)) {
-        retval = true;
-        break;
-      }
-    }
-    // release the storage
-    for (int i = 0; i < n; i++) {
-      if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i]);
-      }
-    }
-    if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements);
-    }
-  } else {
-    snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
-    retval = true;
-  }
-  return retval;
-}
-
 // check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
@@ -3496,6 +3442,37 @@
   schedctl_start(schedctl_init());
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// suspend/resume support
+
+//  The low-level signal-based suspend/resume support is a remnant from the
+//  old VM-suspension that used to be for java-suspension, safepoints etc,
+//  within hotspot. Currently used by JFR's OSThreadSampler
+//
+//  The remaining code is greatly simplified from the more general suspension
+//  code that used to be used.
+//
+//  The protocol is quite simple:
+//  - suspend:
+//      - sends a signal to the target thread
+//      - polls the suspend state of the osthread using a yield loop
+//      - target thread signal handler (SR_handler) sets suspend state
+//        and blocks in sigsuspend until continued
+//  - resume:
+//      - sets target osthread state to continue
+//      - sends signal to end the sigsuspend loop in the SR_handler
+//
+//  Note that the SR_lock plays no role in this suspend/resume protocol,
+//  but is checked for NULL in SR_handler as a thread termination indicator.
+//  The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs.
+//
+//  Note that resume_clear_context() and suspend_save_context() are needed
+//  by SR_handler(), so that fetch_frame_from_ucontext() works,
+//  which in part is used by:
+//    - Forte Analyzer: AsyncGetCallTrace()
+//    - StackBanging: get_frame_at_stack_banging_point()
+//    - JFR: get_topframe()-->....-->get_valid_uc_in_signal_handler()
+
 static void resume_clear_context(OSThread *osthread) {
   osthread->set_ucontext(NULL);
 }
@@ -3506,7 +3483,7 @@
 
 static PosixSemaphore sr_semaphore;
 
-void os::Solaris::SR_handler(Thread* thread, ucontext_t* uc) {
+void os::Solaris::SR_handler(Thread* thread, ucontext_t* context) {
   // Save and restore errno to avoid confusing native code with EINTR
   // after sigsuspend.
   int old_errno = errno;
@@ -3516,7 +3493,7 @@
 
   os::SuspendResume::State current = osthread->sr.state();
   if (current == os::SuspendResume::SR_SUSPEND_REQUEST) {
-    suspend_save_context(osthread, uc);
+    suspend_save_context(osthread, context);
 
     // attempt to switch the state, we assume we had a SUSPEND_REQUEST
     os::SuspendResume::State state = osthread->sr.suspended();
@@ -3663,45 +3640,6 @@
   }
 }
 
-class PcFetcher : public os::SuspendedThreadTask {
- public:
-  PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {}
-  ExtendedPC result();
- protected:
-  void do_task(const os::SuspendedThreadTaskContext& context);
- private:
-  ExtendedPC _epc;
-};
-
-ExtendedPC PcFetcher::result() {
-  guarantee(is_done(), "task is not done yet.");
-  return _epc;
-}
-
-void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) {
-  Thread* thread = context.thread();
-  OSThread* osthread = thread->osthread();
-  if (osthread->ucontext() != NULL) {
-    _epc = os::Solaris::ucontext_get_pc((const ucontext_t *) context.ucontext());
-  } else {
-    // NULL context is unexpected, double-check this is the VMThread
-    guarantee(thread->is_VM_thread(), "can only be called for VMThread");
-  }
-}
-
-// A lightweight implementation that does not suspend the target thread and
-// thus returns only a hint. Used for profiling only!
-ExtendedPC os::get_thread_pc(Thread* thread) {
-  // Make sure that it is called by the watcher and the Threads lock is owned.
-  assert(Thread::current()->is_Watcher_thread(), "Must be watcher and own Threads_lock");
-  // For now, is only used to profile the VM Thread
-  assert(thread->is_VM_thread(), "Can only be called for VMThread");
-  PcFetcher fetcher(thread);
-  fetcher.run();
-  return fetcher.result();
-}
-
-
 // This does not do anything on Solaris. This is basically a hook for being
 // able to use structured exception handling (thread-local exception filters) on, e.g., Win32.
 void os::os_exception_wrapper(java_call_t f, JavaValue* value,
--- a/hotspot/src/os/windows/vm/decoder_windows.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os/windows/vm/decoder_windows.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -27,160 +27,99 @@
 #include "runtime/arguments.hpp"
 #include "runtime/os.hpp"
 #include "decoder_windows.hpp"
+#include "windbghelp.hpp"
 
 WindowsDecoder::WindowsDecoder() {
-  _dbghelp_handle = NULL;
-  _can_decode_in_vm = false;
-  _pfnSymGetSymFromAddr64 = NULL;
-  _pfnUndecorateSymbolName = NULL;
-#ifdef AMD64
-  _pfnStackWalk64 = NULL;
-  _pfnSymFunctionTableAccess64 = NULL;
-  _pfnSymGetModuleBase64 = NULL;
-#endif
+  _can_decode_in_vm = true;
   _decoder_status = no_error;
   initialize();
 }
 
 void WindowsDecoder::initialize() {
-  if (!has_error() && _dbghelp_handle == NULL) {
-    HMODULE handle = ::LoadLibrary("dbghelp.dll");
-    if (!handle) {
-      _decoder_status = helper_not_found;
-      return;
-    }
-
-    _dbghelp_handle = handle;
-
-    pfn_SymSetOptions _pfnSymSetOptions = (pfn_SymSetOptions)::GetProcAddress(handle, "SymSetOptions");
-    pfn_SymInitialize _pfnSymInitialize = (pfn_SymInitialize)::GetProcAddress(handle, "SymInitialize");
-    _pfnSymGetSymFromAddr64 = (pfn_SymGetSymFromAddr64)::GetProcAddress(handle, "SymGetSymFromAddr64");
-    _pfnUndecorateSymbolName = (pfn_UndecorateSymbolName)::GetProcAddress(handle, "UnDecorateSymbolName");
-
-    if (_pfnSymSetOptions == NULL || _pfnSymInitialize == NULL || _pfnSymGetSymFromAddr64 == NULL) {
-      uninitialize();
-      _decoder_status = helper_func_error;
-      return;
-    }
-
-#ifdef AMD64
-    _pfnStackWalk64 = (pfn_StackWalk64)::GetProcAddress(handle, "StackWalk64");
-    _pfnSymFunctionTableAccess64 = (pfn_SymFunctionTableAccess64)::GetProcAddress(handle, "SymFunctionTableAccess64");
-    _pfnSymGetModuleBase64 = (pfn_SymGetModuleBase64)::GetProcAddress(handle, "SymGetModuleBase64");
-    if (_pfnStackWalk64 == NULL || _pfnSymFunctionTableAccess64 == NULL || _pfnSymGetModuleBase64 == NULL) {
-      // We can't call StackWalk64 to walk the stack, but we are still
-      // able to decode the symbols. Let's limp on.
-      _pfnStackWalk64 = NULL;
-      _pfnSymFunctionTableAccess64 = NULL;
-      _pfnSymGetModuleBase64 = NULL;
-    }
-#endif
-
+  if (!has_error()) {
     HANDLE hProcess = ::GetCurrentProcess();
-    _pfnSymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_EXACT_SYMBOLS);
-    if (!_pfnSymInitialize(hProcess, NULL, TRUE)) {
-      _pfnSymGetSymFromAddr64 = NULL;
-      _pfnUndecorateSymbolName = NULL;
-      ::FreeLibrary(handle);
-      _dbghelp_handle = NULL;
+    WindowsDbgHelp::symSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_EXACT_SYMBOLS);
+    if (!WindowsDbgHelp::symInitialize(hProcess, NULL, TRUE)) {
       _decoder_status = helper_init_error;
       return;
     }
 
     // set pdb search paths
-    pfn_SymSetSearchPath  _pfn_SymSetSearchPath =
-      (pfn_SymSetSearchPath)::GetProcAddress(handle, "SymSetSearchPath");
-    pfn_SymGetSearchPath  _pfn_SymGetSearchPath =
-      (pfn_SymGetSearchPath)::GetProcAddress(handle, "SymGetSearchPath");
-    if (_pfn_SymSetSearchPath != NULL && _pfn_SymGetSearchPath != NULL) {
-      char paths[MAX_PATH];
-      int  len = sizeof(paths);
-      if (!_pfn_SymGetSearchPath(hProcess, paths, len)) {
-        paths[0] = '\0';
-      } else {
-        // available spaces in path buffer
-        len -= (int)strlen(paths);
-      }
+    char paths[MAX_PATH];
+    int  len = sizeof(paths);
+    if (!WindowsDbgHelp::symGetSearchPath(hProcess, paths, len)) {
+      paths[0] = '\0';
+    } else {
+      // available spaces in path buffer
+      len -= (int)strlen(paths);
+    }
 
-      char tmp_path[MAX_PATH];
-      DWORD dwSize;
-      HMODULE hJVM = ::GetModuleHandle("jvm.dll");
-      tmp_path[0] = '\0';
-      // append the path where jvm.dll is located
-      if (hJVM != NULL && (dwSize = ::GetModuleFileName(hJVM, tmp_path, sizeof(tmp_path))) > 0) {
-        while (dwSize > 0 && tmp_path[dwSize] != '\\') {
-          dwSize --;
-        }
-
-        tmp_path[dwSize] = '\0';
-
-        if (dwSize > 0 && len > (int)dwSize + 1) {
-          strncat(paths, os::path_separator(), 1);
-          strncat(paths, tmp_path, dwSize);
-          len -= dwSize + 1;
-        }
+    char tmp_path[MAX_PATH];
+    DWORD dwSize;
+    HMODULE hJVM = ::GetModuleHandle("jvm.dll");
+    tmp_path[0] = '\0';
+    // append the path where jvm.dll is located
+    if (hJVM != NULL && (dwSize = ::GetModuleFileName(hJVM, tmp_path, sizeof(tmp_path))) > 0) {
+      while (dwSize > 0 && tmp_path[dwSize] != '\\') {
+        dwSize --;
       }
 
-      // append $JRE/bin. Arguments::get_java_home actually returns $JRE
-      // path
-      char *p = Arguments::get_java_home();
-      assert(p != NULL, "empty java home");
-      size_t java_home_len = strlen(p);
-      if (len > (int)java_home_len + 5) {
+      tmp_path[dwSize] = '\0';
+
+      if (dwSize > 0 && len > (int)dwSize + 1) {
         strncat(paths, os::path_separator(), 1);
-        strncat(paths, p, java_home_len);
-        strncat(paths, "\\bin", 4);
-        len -= (int)(java_home_len + 5);
+        strncat(paths, tmp_path, dwSize);
+        len -= dwSize + 1;
       }
+    }
 
-      // append $JDK/bin path if it exists
-      assert(java_home_len < MAX_PATH, "Invalid path length");
-      // assume $JRE is under $JDK, construct $JDK/bin path and
-      // see if it exists or not
-      if (strncmp(&p[java_home_len - 3], "jre", 3) == 0) {
-        strncpy(tmp_path, p, java_home_len - 3);
-        tmp_path[java_home_len - 3] = '\0';
-        strncat(tmp_path, "bin", 3);
+    // append $JRE/bin. Arguments::get_java_home actually returns $JRE
+    // path
+    char *p = Arguments::get_java_home();
+    assert(p != NULL, "empty java home");
+    size_t java_home_len = strlen(p);
+    if (len > (int)java_home_len + 5) {
+      strncat(paths, os::path_separator(), 1);
+      strncat(paths, p, java_home_len);
+      strncat(paths, "\\bin", 4);
+      len -= (int)(java_home_len + 5);
+    }
 
-        // if the directory exists
-        DWORD dwAttrib = GetFileAttributes(tmp_path);
-        if (dwAttrib != INVALID_FILE_ATTRIBUTES &&
-            (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) {
-          // tmp_path should have the same length as java_home_len, since we only
-          // replaced 'jre' with 'bin'
-          if (len > (int)java_home_len + 1) {
-            strncat(paths, os::path_separator(), 1);
-            strncat(paths, tmp_path, java_home_len);
-          }
+    // append $JDK/bin path if it exists
+    assert(java_home_len < MAX_PATH, "Invalid path length");
+    // assume $JRE is under $JDK, construct $JDK/bin path and
+    // see if it exists or not
+    if (strncmp(&p[java_home_len - 3], "jre", 3) == 0) {
+      strncpy(tmp_path, p, java_home_len - 3);
+      tmp_path[java_home_len - 3] = '\0';
+      strncat(tmp_path, "bin", 3);
+
+      // if the directory exists
+      DWORD dwAttrib = GetFileAttributes(tmp_path);
+      if (dwAttrib != INVALID_FILE_ATTRIBUTES &&
+          (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) {
+        // tmp_path should have the same length as java_home_len, since we only
+        // replaced 'jre' with 'bin'
+        if (len > (int)java_home_len + 1) {
+          strncat(paths, os::path_separator(), 1);
+          strncat(paths, tmp_path, java_home_len);
         }
       }
-
-      _pfn_SymSetSearchPath(hProcess, paths);
     }
 
-     // find out if jvm.dll contains private symbols, by decoding
-     // current function and comparing the result
-     address addr = (address)Decoder::demangle;
-     char buf[MAX_PATH];
-     if (decode(addr, buf, sizeof(buf), NULL, NULL, true /* demangle */)) {
-       _can_decode_in_vm = !strcmp(buf, "Decoder::demangle");
-     }
+    WindowsDbgHelp::symSetSearchPath(hProcess, paths);
+
+    // find out if jvm.dll contains private symbols, by decoding
+    // current function and comparing the result
+    address addr = (address)Decoder::demangle;
+    char buf[MAX_PATH];
+    if (decode(addr, buf, sizeof(buf), NULL, NULL, true /* demangle */)) {
+      _can_decode_in_vm = !strcmp(buf, "Decoder::demangle");
+    }
   }
 }
 
-void WindowsDecoder::uninitialize() {
-  _pfnSymGetSymFromAddr64 = NULL;
-  _pfnUndecorateSymbolName = NULL;
-#ifdef AMD64
-  _pfnStackWalk64 = NULL;
-  _pfnSymFunctionTableAccess64 = NULL;
-  _pfnSymGetModuleBase64 = NULL;
-#endif
-  if (_dbghelp_handle != NULL) {
-    ::FreeLibrary(_dbghelp_handle);
-  }
-  _dbghelp_handle = NULL;
-}
+void WindowsDecoder::uninitialize() {}
 
 bool WindowsDecoder::can_decode_C_frame_in_vm() const {
   return  (!has_error() && _can_decode_in_vm);
@@ -188,14 +127,14 @@
 
 
 bool WindowsDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* modulepath, bool demangle_name)  {
-  if (_pfnSymGetSymFromAddr64 != NULL) {
+  if (!has_error()) {
     PIMAGEHLP_SYMBOL64 pSymbol;
     char symbolInfo[MAX_PATH + sizeof(IMAGEHLP_SYMBOL64)];
     pSymbol = (PIMAGEHLP_SYMBOL64)symbolInfo;
     pSymbol->MaxNameLength = MAX_PATH;
     pSymbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
     DWORD64 displacement;
-    if (_pfnSymGetSymFromAddr64(::GetCurrentProcess(), (DWORD64)addr, &displacement, pSymbol)) {
+    if (WindowsDbgHelp::symGetSymFromAddr64(::GetCurrentProcess(), (DWORD64)addr, &displacement, pSymbol)) {
       if (buf != NULL) {
         if (!(demangle_name && demangle(pSymbol->Name, buf, buflen))) {
           jio_snprintf(buf, buflen, "%s", pSymbol->Name);
@@ -211,69 +150,9 @@
 }
 
 bool WindowsDecoder::demangle(const char* symbol, char *buf, int buflen) {
-  return _pfnUndecorateSymbolName != NULL &&
-         _pfnUndecorateSymbolName(symbol, buf, buflen, UNDNAME_COMPLETE);
-}
-
-#ifdef AMD64
-BOOL WindowsDbgHelp::StackWalk64(DWORD MachineType,
-                                 HANDLE hProcess,
-                                 HANDLE hThread,
-                                 LPSTACKFRAME64 StackFrame,
-                                 PVOID ContextRecord,
-                                 PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,
-                                 PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
-                                 PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
-                                 PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress) {
-  DecoderLocker locker;
-  WindowsDecoder* wd = (WindowsDecoder*)locker.decoder();
-
-  if (!wd->has_error() && wd->_pfnStackWalk64) {
-    return wd->_pfnStackWalk64(MachineType,
-                               hProcess,
-                               hThread,
-                               StackFrame,
-                               ContextRecord,
-                               ReadMemoryRoutine,
-                               FunctionTableAccessRoutine,
-                               GetModuleBaseRoutine,
-                               TranslateAddress);
-  } else {
-    return false;
+  if (!has_error()) {
+    return WindowsDbgHelp::unDecorateSymbolName(symbol, buf, buflen, UNDNAME_COMPLETE) > 0;
   }
+  return false;
 }
 
-PVOID WindowsDbgHelp::SymFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase) {
-  DecoderLocker locker;
-  WindowsDecoder* wd = (WindowsDecoder*)locker.decoder();
-
-  if (!wd->has_error() && wd->_pfnSymFunctionTableAccess64) {
-    return wd->_pfnSymFunctionTableAccess64(hProcess, AddrBase);
-  } else {
-    return NULL;
-  }
-}
-
-pfn_SymFunctionTableAccess64 WindowsDbgHelp::pfnSymFunctionTableAccess64() {
-  DecoderLocker locker;
-  WindowsDecoder* wd = (WindowsDecoder*)locker.decoder();
-
-  if (!wd->has_error()) {
-    return wd->_pfnSymFunctionTableAccess64;
-  } else {
-    return NULL;
-  }
-}
-
-pfn_SymGetModuleBase64 WindowsDbgHelp::pfnSymGetModuleBase64() {
-  DecoderLocker locker;
-  WindowsDecoder* wd = (WindowsDecoder*)locker.decoder();
-
-  if (!wd->has_error()) {
-    return wd->_pfnSymGetModuleBase64;
-  } else {
-    return NULL;
-  }
-}
-
-#endif // AMD64
--- a/hotspot/src/os/windows/vm/decoder_windows.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os/windows/vm/decoder_windows.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -25,33 +25,8 @@
 #ifndef OS_WINDOWS_VM_DECODER_WINDOWS_HPP
 #define OS_WINDOWS_VM_DECIDER_WINDOWS_HPP
 
-#include <windows.h>
-#include <imagehlp.h>
-
 #include "utilities/decoder.hpp"
 
-// functions needed for decoding symbols
-typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD);
-typedef BOOL  (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL);
-typedef BOOL  (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
-typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD);
-typedef BOOL  (WINAPI *pfn_SymSetSearchPath)(HANDLE, PCTSTR);
-typedef BOOL  (WINAPI *pfn_SymGetSearchPath)(HANDLE, PTSTR, int);
-
-#ifdef AMD64
-typedef BOOL  (WINAPI *pfn_StackWalk64)(DWORD MachineType,
-                                        HANDLE hProcess,
-                                        HANDLE hThread,
-                                        LPSTACKFRAME64 StackFrame,
-                                        PVOID ContextRecord,
-                                        PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,
-                                        PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
-                                        PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
-                                        PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
-typedef PVOID (WINAPI *pfn_SymFunctionTableAccess64)(HANDLE hProcess, DWORD64 AddrBase);
-typedef DWORD64 (WINAPI *pfn_SymGetModuleBase64)(HANDLE hProcess, DWORD64 dwAddr);
-#endif
-
 class WindowsDecoder : public AbstractDecoder {
 
 public:
@@ -70,38 +45,8 @@
   void initialize();
   void uninitialize();
 
-private:
-  HMODULE                   _dbghelp_handle;
   bool                      _can_decode_in_vm;
-  pfn_SymGetSymFromAddr64   _pfnSymGetSymFromAddr64;
-  pfn_UndecorateSymbolName  _pfnUndecorateSymbolName;
-#ifdef AMD64
-  pfn_StackWalk64              _pfnStackWalk64;
-  pfn_SymFunctionTableAccess64 _pfnSymFunctionTableAccess64;
-  pfn_SymGetModuleBase64       _pfnSymGetModuleBase64;
 
-  friend class WindowsDbgHelp;
-#endif
 };
 
-#ifdef AMD64
-// TODO: refactor and move the handling of dbghelp.dll outside of Decoder
-class WindowsDbgHelp : public Decoder {
-public:
-  static BOOL StackWalk64(DWORD MachineType,
-                          HANDLE hProcess,
-                          HANDLE hThread,
-                          LPSTACKFRAME64 StackFrame,
-                          PVOID ContextRecord,
-                          PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,
-                          PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
-                          PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
-                          PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
-  static PVOID SymFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase);
-
-  static pfn_SymFunctionTableAccess64 pfnSymFunctionTableAccess64();
-  static pfn_SymGetModuleBase64       pfnSymGetModuleBase64();
-};
-#endif
-
 #endif // OS_WINDOWS_VM_DECODER_WINDOWS_HPP
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -74,6 +74,8 @@
 #include "utilities/growableArray.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/vmError.hpp"
+#include "windbghelp.hpp"
+
 
 #ifdef _DEBUG
 #include <crtdbg.h>
@@ -1009,7 +1011,6 @@
 }
 
 void os::abort(bool dump_core, void* siginfo, const void* context) {
-  HINSTANCE dbghelp;
   EXCEPTION_POINTERS ep;
   MINIDUMP_EXCEPTION_INFORMATION mei;
   MINIDUMP_EXCEPTION_INFORMATION* pmei;
@@ -1026,28 +1027,6 @@
     win32::exit_process_or_thread(win32::EPT_PROCESS, 1);
   }
 
-  dbghelp = os::win32::load_Windows_dll("DBGHELP.DLL", NULL, 0);
-
-  if (dbghelp == NULL) {
-    jio_fprintf(stderr, "Failed to load dbghelp.dll\n");
-    CloseHandle(dumpFile);
-    win32::exit_process_or_thread(win32::EPT_PROCESS, 1);
-  }
-
-  _MiniDumpWriteDump =
-      CAST_TO_FN_PTR(BOOL(WINAPI *)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE,
-                                    PMINIDUMP_EXCEPTION_INFORMATION,
-                                    PMINIDUMP_USER_STREAM_INFORMATION,
-                                    PMINIDUMP_CALLBACK_INFORMATION),
-                                    GetProcAddress(dbghelp,
-                                    "MiniDumpWriteDump"));
-
-  if (_MiniDumpWriteDump == NULL) {
-    jio_fprintf(stderr, "Failed to find MiniDumpWriteDump() in module dbghelp.dll.\n");
-    CloseHandle(dumpFile);
-    win32::exit_process_or_thread(win32::EPT_PROCESS, 1);
-  }
-
   dumpType = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithHandleData |
     MiniDumpWithFullMemoryInfo | MiniDumpWithThreadInfo | MiniDumpWithUnloadedModules);
 
@@ -1064,8 +1043,8 @@
 
   // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all
   // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then.
-  if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == false &&
-      _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == false) {
+  if (!WindowsDbgHelp::miniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) &&
+      !WindowsDbgHelp::miniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL)) {
     jio_fprintf(stderr, "Call to MiniDumpWriteDump() failed (Error 0x%x)\n", GetLastError());
   }
   CloseHandle(dumpFile);
@@ -1198,70 +1177,6 @@
   }
 }
 
-static bool file_exists(const char* filename) {
-  if (filename == NULL || strlen(filename) == 0) {
-    return false;
-  }
-  return GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES;
-}
-
-bool os::dll_build_name(char *buffer, size_t buflen,
-                        const char* pname, const char* fname) {
-  bool retval = false;
-  const size_t pnamelen = pname ? strlen(pname) : 0;
-  const char c = (pnamelen > 0) ? pname[pnamelen-1] : 0;
-
-  // Return error on buffer overflow.
-  if (pnamelen + strlen(fname) + 10 > buflen) {
-    return retval;
-  }
-
-  if (pnamelen == 0) {
-    jio_snprintf(buffer, buflen, "%s.dll", fname);
-    retval = true;
-  } else if (c == ':' || c == '\\') {
-    jio_snprintf(buffer, buflen, "%s%s.dll", pname, fname);
-    retval = true;
-  } else if (strchr(pname, *os::path_separator()) != NULL) {
-    int n;
-    char** pelements = split_path(pname, &n);
-    if (pelements == NULL) {
-      return false;
-    }
-    for (int i = 0; i < n; i++) {
-      char* path = pelements[i];
-      // Really shouldn't be NULL, but check can't hurt
-      size_t plen = (path == NULL) ? 0 : strlen(path);
-      if (plen == 0) {
-        continue; // skip the empty path values
-      }
-      const char lastchar = path[plen - 1];
-      if (lastchar == ':' || lastchar == '\\') {
-        jio_snprintf(buffer, buflen, "%s%s.dll", path, fname);
-      } else {
-        jio_snprintf(buffer, buflen, "%s\\%s.dll", path, fname);
-      }
-      if (file_exists(buffer)) {
-        retval = true;
-        break;
-      }
-    }
-    // release the storage
-    for (int i = 0; i < n; i++) {
-      if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i]);
-      }
-    }
-    if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements);
-    }
-  } else {
-    jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
-    retval = true;
-  }
-  return retval;
-}
-
 // Needs to be in os specific directory because windows requires another
 // header file <direct.h>
 const char* os::get_current_directory(char *buf, size_t buflen) {
@@ -3591,22 +3506,6 @@
   return interrupted;
 }
 
-// Get's a pc (hint) for a running thread. Currently used only for profiling.
-ExtendedPC os::get_thread_pc(Thread* thread) {
-  CONTEXT context;
-  context.ContextFlags = CONTEXT_CONTROL;
-  HANDLE handle = thread->osthread()->thread_handle();
-  if (GetThreadContext(handle, &context)) {
-#ifdef _M_AMD64
-    return ExtendedPC((address) context.Rip);
-#else
-    return ExtendedPC((address) context.Eip);
-#endif
-  } else {
-    return ExtendedPC(NULL);
-  }
-}
-
 // GetCurrentThreadId() returns DWORD
 intx os::current_thread_id()  { return GetCurrentThreadId(); }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os/windows/vm/windbghelp.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,306 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "utilities/ostream.hpp"
+#include "windbghelp.hpp"
+
+#include <windows.h>
+
+typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD);
+typedef DWORD (WINAPI *pfn_SymGetOptions)(void);
+typedef BOOL  (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL);
+typedef BOOL  (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
+typedef DWORD (WINAPI *pfn_UnDecorateSymbolName)(const char*, char*, DWORD, DWORD);
+typedef BOOL  (WINAPI *pfn_SymSetSearchPath)(HANDLE, PCTSTR);
+typedef BOOL  (WINAPI *pfn_SymGetSearchPath)(HANDLE, PTSTR, int);
+typedef BOOL  (WINAPI *pfn_StackWalk64)(DWORD MachineType,
+                                        HANDLE hProcess,
+                                        HANDLE hThread,
+                                        LPSTACKFRAME64 StackFrame,
+                                        PVOID ContextRecord,
+                                        PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,
+                                        PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
+                                        PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
+                                        PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
+typedef PVOID (WINAPI *pfn_SymFunctionTableAccess64)(HANDLE hProcess, DWORD64 AddrBase);
+typedef DWORD64 (WINAPI *pfn_SymGetModuleBase64)(HANDLE hProcess, DWORD64 dwAddr);
+typedef BOOL (WINAPI *pfn_MiniDumpWriteDump) (HANDLE hProcess, DWORD ProcessId, HANDLE hFile,
+                                              MINIDUMP_TYPE DumpType, PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
+                                              PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
+                                              PMINIDUMP_CALLBACK_INFORMATION    CallbackParam);
+typedef BOOL (WINAPI *pfn_SymGetLineFromAddr64) (HANDLE hProcess, DWORD64 dwAddr,
+                                                 PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line);
+typedef LPAPI_VERSION (WINAPI *pfn_ImagehlpApiVersion)(void);
+
+// Add functions as needed.
+#define FOR_ALL_FUNCTIONS(DO) \
+ DO(ImagehlpApiVersion) \
+ DO(SymGetOptions) \
+ DO(SymSetOptions) \
+ DO(SymInitialize) \
+ DO(SymGetSymFromAddr64) \
+ DO(UnDecorateSymbolName) \
+ DO(SymSetSearchPath) \
+ DO(SymGetSearchPath) \
+ DO(StackWalk64) \
+ DO(SymFunctionTableAccess64) \
+ DO(SymGetModuleBase64) \
+ DO(MiniDumpWriteDump) \
+ DO(SymGetLineFromAddr64)
+
+
+#define DECLARE_FUNCTION_POINTER(functionname) \
+static pfn_##functionname g_pfn_##functionname;
+
+FOR_ALL_FUNCTIONS(DECLARE_FUNCTION_POINTER)
+
+
+static HMODULE g_dll_handle = NULL;
+static DWORD g_dll_load_error = 0;
+static API_VERSION g_version = { 0, 0, 0, 0 };
+
+static enum {
+  state_uninitialized = 0,
+  state_ready = 1,
+  state_error = 2
+} g_state = state_uninitialized;
+
+static void initialize() {
+
+  assert(g_state == state_uninitialized, "wrong sequence");
+  g_state = state_error;
+
+  g_dll_handle = ::LoadLibrary("DBGHELP.DLL");
+  if (g_dll_handle == NULL) {
+    g_dll_load_error = ::GetLastError();
+  } else {
+    // Note: We loaded the DLL successfully. From here on we count
+    // initialization as success. We still may fail to load all of the
+    // desired function pointers successfully, but DLL may still be usable
+    // enough for our purposes.
+    g_state = state_ready;
+
+#define DO_RESOLVE(functionname) \
+      g_pfn_##functionname = (pfn_##functionname) ::GetProcAddress(g_dll_handle, #functionname);
+
+    FOR_ALL_FUNCTIONS(DO_RESOLVE)
+
+    // Retrieve version information.
+    if (g_pfn_ImagehlpApiVersion) {
+      const API_VERSION* p = g_pfn_ImagehlpApiVersion();
+      memcpy(&g_version, p, sizeof(API_VERSION));
+    }
+  }
+
+}
+
+///////////////////// External functions //////////////////////////
+
+// All outside facing functions are synchronized. Also, we run
+// initialization on first touch.
+
+
+// Call InitializeCriticalSection as early as possible.
+class CritSect {
+  CRITICAL_SECTION cs;
+public:
+  CritSect() { ::InitializeCriticalSection(&cs); }
+  void enter() { ::EnterCriticalSection(&cs); }
+  void leave() { ::LeaveCriticalSection(&cs); }
+};
+
+static CritSect g_cs;
+
+class EntryGuard {
+public:
+  EntryGuard() {
+    g_cs.enter();
+    if (g_state == state_uninitialized) {
+      initialize();
+    }
+  }
+  ~EntryGuard() {
+    g_cs.leave();
+  }
+};
+
+DWORD WindowsDbgHelp::symSetOptions(DWORD arg) {
+  EntryGuard entry_guard;
+  if (g_pfn_SymSetOptions != NULL) {
+    return g_pfn_SymSetOptions(arg);
+  }
+  return 0;
+}
+
+DWORD WindowsDbgHelp::symGetOptions(void) {
+  EntryGuard entry_guard;
+  if (g_pfn_SymGetOptions != NULL) {
+    return g_pfn_SymGetOptions();
+  }
+  return 0;
+}
+
+BOOL WindowsDbgHelp::symInitialize(HANDLE hProcess, PCTSTR UserSearchPath, BOOL fInvadeProcess) {
+  EntryGuard entry_guard;
+  if (g_pfn_SymInitialize != NULL) {
+    return g_pfn_SymInitialize(hProcess, UserSearchPath, fInvadeProcess);
+  }
+  return FALSE;
+}
+
+BOOL WindowsDbgHelp::symGetSymFromAddr64(HANDLE hProcess, DWORD64 the_address,
+                                         PDWORD64 Displacement, PIMAGEHLP_SYMBOL64 Symbol) {
+  EntryGuard entry_guard;
+  if (g_pfn_SymGetSymFromAddr64 != NULL) {
+    return g_pfn_SymGetSymFromAddr64(hProcess, the_address, Displacement, Symbol);
+  }
+  return FALSE;
+}
+
+DWORD WindowsDbgHelp::unDecorateSymbolName(const char* DecoratedName, char* UnDecoratedName,
+                                           DWORD UndecoratedLength, DWORD Flags) {
+  EntryGuard entry_guard;
+  if (g_pfn_UnDecorateSymbolName != NULL) {
+    return g_pfn_UnDecorateSymbolName(DecoratedName, UnDecoratedName, UndecoratedLength, Flags);
+  }
+  if (UnDecoratedName != NULL && UndecoratedLength > 0) {
+    UnDecoratedName[0] = '\0';
+  }
+  return 0;
+}
+
+BOOL WindowsDbgHelp::symSetSearchPath(HANDLE hProcess, PCTSTR SearchPath) {
+  EntryGuard entry_guard;
+  if (g_pfn_SymSetSearchPath != NULL) {
+    return g_pfn_SymSetSearchPath(hProcess, SearchPath);
+  }
+  return FALSE;
+}
+
+BOOL WindowsDbgHelp::symGetSearchPath(HANDLE hProcess, PTSTR SearchPath, int SearchPathLength) {
+  EntryGuard entry_guard;
+  if (g_pfn_SymGetSearchPath != NULL) {
+    return g_pfn_SymGetSearchPath(hProcess, SearchPath, SearchPathLength);
+  }
+  return FALSE;
+}
+
+BOOL WindowsDbgHelp::stackWalk64(DWORD MachineType,
+                                 HANDLE hProcess,
+                                 HANDLE hThread,
+                                 LPSTACKFRAME64 StackFrame,
+                                 PVOID ContextRecord) {
+  EntryGuard entry_guard;
+  if (g_pfn_StackWalk64 != NULL) {
+    return g_pfn_StackWalk64(MachineType, hProcess, hThread, StackFrame,
+                             ContextRecord,
+                             NULL, // ReadMemoryRoutine
+                             g_pfn_SymFunctionTableAccess64, // FunctionTableAccessRoutine,
+                             g_pfn_SymGetModuleBase64, // GetModuleBaseRoutine
+                             NULL // TranslateAddressRoutine
+                             );
+  }
+  return FALSE;
+}
+
+PVOID WindowsDbgHelp::symFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase) {
+  EntryGuard entry_guard;
+  if (g_pfn_SymFunctionTableAccess64 != NULL) {
+    return g_pfn_SymFunctionTableAccess64(hProcess, AddrBase);
+  }
+  return NULL;
+}
+
+DWORD64 WindowsDbgHelp::symGetModuleBase64(HANDLE hProcess, DWORD64 dwAddr) {
+  EntryGuard entry_guard;
+  if (g_pfn_SymGetModuleBase64 != NULL) {
+    return g_pfn_SymGetModuleBase64(hProcess, dwAddr);
+  }
+  return 0;
+}
+
+BOOL WindowsDbgHelp::miniDumpWriteDump(HANDLE hProcess, DWORD ProcessId, HANDLE hFile,
+                                       MINIDUMP_TYPE DumpType, PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
+                                       PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
+                                       PMINIDUMP_CALLBACK_INFORMATION CallbackParam) {
+  EntryGuard entry_guard;
+  if (g_pfn_MiniDumpWriteDump != NULL) {
+    return g_pfn_MiniDumpWriteDump(hProcess, ProcessId, hFile, DumpType,
+                                   ExceptionParam, UserStreamParam, CallbackParam);
+  }
+  return FALSE;
+}
+
+BOOL WindowsDbgHelp::symGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr,
+                          PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line) {
+  EntryGuard entry_guard;
+  if (g_pfn_SymGetLineFromAddr64 != NULL) {
+    return g_pfn_SymGetLineFromAddr64(hProcess, dwAddr, pdwDisplacement, Line);
+  }
+  return FALSE;
+}
+
+// Print one liner describing state (if library loaded, which functions are
+// missing - if any, and the dbhelp API version)
+void WindowsDbgHelp::print_state_on(outputStream* st) {
+  // Note: We should not lock while printing, but this should be
+  // safe to do without lock anyway.
+  st->print("dbghelp: ");
+
+  if (g_state == state_uninitialized) {
+    st->print("uninitialized.");
+  } else if (g_state == state_error) {
+    st->print("loading error: %u", g_dll_load_error);
+  } else {
+    st->print("loaded successfully ");
+
+    // We may want to print dll file name here - which may be interesting for
+    // cases where more than one version exists on the system, e.g. with a
+    // debugging sdk separately installed. But we get the file name in the DLL
+    // section of the hs-err file too, so this may be redundant.
+
+    // Print version.
+    st->print("- version: %u.%u.%u",
+              g_version.MajorVersion, g_version.MinorVersion, g_version.Revision);
+
+    // Print any functions which failed to load.
+    int num_missing = 0;
+    st->print(" - missing functions: ");
+
+    #define CHECK_AND_PRINT_IF_NULL(functionname) \
+    if (g_pfn_##functionname == NULL) { \
+      st->print("%s" #functionname, ((num_missing > 0) ? ", " : "")); \
+      num_missing ++; \
+    }
+
+    FOR_ALL_FUNCTIONS(CHECK_AND_PRINT_IF_NULL)
+
+    if (num_missing == 0) {
+      st->print("none");
+    }
+  }
+  st->cr();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/os/windows/vm/windbghelp.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef OS_WINDOWS_VM_DBGHELPLOADER_HPP
+#define OS_WINDOWS_VM_DBGHELPLOADER_HPP
+
+#include <windows.h>
+#include <imagehlp.h>
+
+// This is a very plain wrapper for loading dbghelp.dll. It does not offer
+//  any additional functionality. It takes care of locking.
+
+class outputStream;
+
+// Please note: dbghelp.dll may not have been loaded, or it may have been loaded but not
+//  all functions may be available (because on the target system dbghelp.dll is of an
+//  older version).
+// In all these cases we return an error from the WindowsDbgHelp::symXXXX() wrapper. We never
+//  assert. It should always be safe to call these functions, but caller has to process the
+//  return code (which he would have to do anyway).
+namespace WindowsDbgHelp {
+
+  DWORD symSetOptions(DWORD);
+  DWORD symGetOptions(void);
+  BOOL symInitialize(HANDLE, PCTSTR, BOOL);
+  BOOL symGetSymFromAddr64(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
+  DWORD unDecorateSymbolName(const char*, char*, DWORD, DWORD);
+  BOOL symSetSearchPath(HANDLE, PCTSTR);
+  BOOL symGetSearchPath(HANDLE, PTSTR, int);
+  BOOL stackWalk64(DWORD MachineType,
+                   HANDLE hProcess,
+                   HANDLE hThread,
+                   LPSTACKFRAME64 StackFrame,
+                   PVOID ContextRecord);
+  PVOID symFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase);
+  DWORD64 symGetModuleBase64(HANDLE hProcess, DWORD64 dwAddr);
+  BOOL miniDumpWriteDump(HANDLE hProcess, DWORD ProcessId, HANDLE hFile,
+                         MINIDUMP_TYPE DumpType, PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
+                         PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
+                         PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
+  BOOL symGetLineFromAddr64 (HANDLE hProcess, DWORD64 dwAddr,
+                             PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line);
+
+  // Print one liner describing state (if library loaded, which functions are
+  // missing - if any, and the dbhelp API version)
+  void print_state_on(outputStream* st);
+
+};
+
+
+#endif // OS_WINDOWS_VM_DBGHELPLOADER_HPP
+
--- a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -106,8 +106,8 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(4 == sizeof(I));
-  STATIC_CAST(4 == sizeof(D));
+  STATIC_ASSERT(4 == sizeof(I));
+  STATIC_ASSERT(4 == sizeof(D));
 
   D result;
 
@@ -129,8 +129,8 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(8 == sizeof(I));
-  STATIC_CAST(8 == sizeof(D));
+  STATIC_ASSERT(8 == sizeof(I));
+  STATIC_ASSERT(8 == sizeof(D));
 
   D result;
 
--- a/hotspot/src/os_cpu/aix_ppc/vm/thread_aix_ppc.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/aix_ppc/vm/thread_aix_ppc.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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.
  * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,7 +29,6 @@
  private:
   void pd_initialize() {
     _anchor.clear();
-    _last_interpreter_fp = NULL;
   }
 
   // The `last' frame is the youngest Java frame on the thread's stack.
@@ -60,20 +59,4 @@
   bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext,
                                            bool isInJava);
 
-  // -Xprof support
-  //
-  // In order to find the last Java fp from an async profile
-  // tick, we store the current interpreter fp in the thread.
-  // This value is only valid while we are in the C++ interpreter
-  // and profiling.
- protected:
-  intptr_t *_last_interpreter_fp;
-
- public:
-  static ByteSize last_interpreter_fp_offset() {
-    return byte_offset_of(JavaThread, _last_interpreter_fp);
-  }
-
-  intptr_t* last_interpreter_fp() { return _last_interpreter_fp; }
-
 #endif // OS_CPU_AIX_PPC_VM_THREAD_AIX_PPC_HPP
--- a/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -184,8 +184,8 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(4 == sizeof(I));
-  STATIC_CAST(4 == sizeof(D));
+  STATIC_ASSERT(4 == sizeof(I));
+  STATIC_ASSERT(4 == sizeof(D));
 
 #ifdef ARM
   return add_using_helper<int>(arm_add_and_fetch, add_value, dest);
@@ -201,8 +201,8 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(8 == sizeof(I));
-  STATIC_CAST(8 == sizeof(D));
+  STATIC_ASSERT(8 == sizeof(I));
+  STATIC_ASSERT(8 == sizeof(D));
 
   return __sync_add_and_fetch(dest, add_value);
 }
@@ -283,7 +283,7 @@
                                                 T volatile* dest,
                                                 T compare_value,
                                                 cmpxchg_memory_order order) const {
-  STATIC_CAST(4 == sizeof(T));
+  STATIC_ASSERT(4 == sizeof(T));
 #ifdef ARM
   return cmpxchg_using_helper<int>(arm_compare_and_swap, exchange_value, dest, compare_value);
 #else
@@ -301,7 +301,7 @@
                                                 T volatile* dest,
                                                 T compare_value,
                                                 cmpxchg_memory_order order) const {
-  STATIC_CAST(8 == sizeof(T));
+  STATIC_ASSERT(8 == sizeof(T));
   return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
 }
 
--- a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -104,8 +104,8 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(4 == sizeof(I));
-  STATIC_CAST(4 == sizeof(D));
+  STATIC_ASSERT(4 == sizeof(I));
+  STATIC_ASSERT(4 == sizeof(D));
 
   D result;
 
@@ -127,8 +127,8 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(8 == sizeof(I));
-  STATIC_CAST(8 == sizeof(D));
+  STATIC_ASSERT(8 == sizeof(I));
+  STATIC_ASSERT(8 == sizeof(D));
 
   D result;
 
--- a/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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.
  * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -30,7 +30,6 @@
 
   void pd_initialize() {
     _anchor.clear();
-    _last_interpreter_fp = NULL;
   }
 
   // The `last' frame is the youngest Java frame on the thread's stack.
@@ -62,22 +61,4 @@
 
   bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava);
 
- protected:
-
-  // -Xprof support
-  //
-  // In order to find the last Java fp from an async profile
-  // tick, we store the current interpreter fp in the thread.
-  // This value is only valid while we are in the C++ interpreter
-  // and profiling.
-  intptr_t *_last_interpreter_fp;
-
- public:
-
-  static ByteSize last_interpreter_fp_offset() {
-    return byte_offset_of(JavaThread, _last_interpreter_fp);
-  }
-
-  intptr_t* last_interpreter_fp() { return _last_interpreter_fp; }
-
 #endif // OS_CPU_LINUX_PPC_VM_THREAD_LINUX_PPC_HPP
--- a/hotspot/src/os_cpu/linux_s390/vm/atomic_linux_s390.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/linux_s390/vm/atomic_linux_s390.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -92,9 +92,9 @@
 
 template<>
 template<typename I, typename D>
-inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(4 == sizeof(I));
-  STATIC_CAST(4 == sizeof(D));
+inline D Atomic::PlatformAdd<4>::add_and_fetch(I inc, D volatile* dest) const {
+  STATIC_ASSERT(4 == sizeof(I));
+  STATIC_ASSERT(4 == sizeof(D));
 
   D old, upd;
 
@@ -143,9 +143,9 @@
 
 template<>
 template<typename I, typename D>
-inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(8 == sizeof(I));
-  STATIC_CAST(8 == sizeof(D));
+inline D Atomic::PlatformAdd<8>::add_and_fetch(I inc, D volatile* dest) const {
+  STATIC_ASSERT(8 == sizeof(I));
+  STATIC_ASSERT(8 == sizeof(D));
 
   D old, upd;
 
--- a/hotspot/src/os_cpu/linux_s390/vm/thread_linux_s390.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/linux_s390/vm/thread_linux_s390.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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.
  * Copyright (c) 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -30,7 +30,6 @@
 
   void pd_initialize() {
     _anchor.clear();
-    _last_interpreter_fp = NULL;
   }
 
   // The `last' frame is the youngest Java frame on the thread's stack.
@@ -61,22 +60,4 @@
 
   bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava);
 
- protected:
-
-  // -Xprof support
-  //
-  // In order to find the last Java fp from an async profile
-  // tick, we store the current interpreter fp in the thread.
-  // This value is only valid while we are in the C++ interpreter
-  // and profiling.
-  intptr_t *_last_interpreter_fp;
-
- public:
-
-  static ByteSize last_interpreter_fp_offset() {
-    return byte_offset_of(JavaThread, _last_interpreter_fp);
-  }
-
-  intptr_t* last_interpreter_fp() { return _last_interpreter_fp; }
-
 #endif // OS_CPU_LINUX_S390_VM_THREAD_LINUX_S390_HPP
--- a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -62,8 +62,8 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(4 == sizeof(I));
-  STATIC_CAST(4 == sizeof(D));
+  STATIC_ASSERT(4 == sizeof(I));
+  STATIC_ASSERT(4 == sizeof(D));
 
   D rv;
   __asm__ volatile(
@@ -81,10 +81,11 @@
   return rv;
 }
 
+template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(8 == sizeof(I));
-  STATIC_CAST(8 == sizeof(D));
+  STATIC_ASSERT(8 == sizeof(I));
+  STATIC_ASSERT(8 == sizeof(D));
 
   D rv;
   __asm__ volatile(
--- a/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -178,8 +178,8 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(4 == sizeof(I));
-  STATIC_CAST(4 == sizeof(D));
+  STATIC_ASSERT(4 == sizeof(I));
+  STATIC_ASSERT(4 == sizeof(D));
 
 #ifdef ARM
   return add_using_helper<int>(arm_add_and_fetch, add_value, dest);
@@ -195,8 +195,8 @@
 template<>
 template<typename I, typename D>
 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const {
-  STATIC_CAST(8 == sizeof(I));
-  STATIC_CAST(8 == sizeof(D));
+  STATIC_ASSERT(8 == sizeof(I));
+  STATIC_ASSERT(8 == sizeof(D));
 
   return __sync_add_and_fetch(dest, add_value);
 }
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -29,7 +29,6 @@
 #include "classfile/vmSymbols.hpp"
 #include "code/icBuffer.hpp"
 #include "code/vtableStubs.hpp"
-#include "decoder_windows.hpp"
 #include "interpreter/interpreter.hpp"
 #include "jvm_windows.h"
 #include "memory/allocation.inline.hpp"
@@ -51,10 +50,12 @@
 #include "runtime/stubRoutines.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
+#include "unwind_windows_x86.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
+#include "windbghelp.hpp"
 
-# include "unwind_windows_x86.hpp"
+
 #undef REG_SP
 #undef REG_FP
 #undef REG_PC
@@ -401,24 +402,18 @@
       lastpc = pc;
     }
 
-    PVOID p = WindowsDbgHelp::SymFunctionTableAccess64(GetCurrentProcess(), stk.AddrPC.Offset);
+    PVOID p = WindowsDbgHelp::symFunctionTableAccess64(GetCurrentProcess(), stk.AddrPC.Offset);
     if (!p) {
       // StackWalk64() can't handle this PC. Calling StackWalk64 again may cause crash.
       break;
     }
 
-    BOOL result = WindowsDbgHelp::StackWalk64(
+    BOOL result = WindowsDbgHelp::stackWalk64(
         IMAGE_FILE_MACHINE_AMD64,  // __in      DWORD MachineType,
         GetCurrentProcess(),       // __in      HANDLE hProcess,
         GetCurrentThread(),        // __in      HANDLE hThread,
         &stk,                      // __inout   LP STACKFRAME64 StackFrame,
-        &ctx,                      // __inout   PVOID ContextRecord,
-        NULL,                      // __in_opt  PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,
-        WindowsDbgHelp::pfnSymFunctionTableAccess64(),
-                                   // __in_opt  PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,
-        WindowsDbgHelp::pfnSymGetModuleBase64(),
-                                   // __in_opt  PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine,
-        NULL);                     // __in_opt  PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress
+        &ctx);                     // __inout   PVOID ContextRecord,
 
     if (!result) {
       break;
--- a/hotspot/src/share/vm/Xusage.txt	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/Xusage.txt	Sat Sep 09 14:36:45 2017 +0200
@@ -12,7 +12,6 @@
     -Xms<size>        set initial Java heap size
     -Xmx<size>        set maximum Java heap size
     -Xss<size>        set java thread stack size
-    -Xprof            output cpu profiling data (deprecated)
     -Xfuture          enable strictest checks, anticipating future default
     -Xrs              reduce use of OS signals by Java/VM (see documentation)
     -Xcheck:jni       perform additional checks for JNI functions
--- a/hotspot/src/share/vm/aot/aotCodeHeap.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/aot/aotCodeHeap.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -478,6 +478,8 @@
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_arrayof_oop_disjoint_arraycopy", address, StubRoutines::_arrayof_oop_disjoint_arraycopy);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_arrayof_oop_disjoint_arraycopy_uninit", address, StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit);
 
+    SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_unsafe_arraycopy", address, StubRoutines::_unsafe_arraycopy);
+
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_checkcast_arraycopy", address, StubRoutines::_checkcast_arraycopy);
 
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_aescrypt_encryptBlock", address, StubRoutines::_aescrypt_encryptBlock);
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -57,7 +57,6 @@
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/compilationPolicy.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
@@ -147,6 +146,7 @@
 ClassPathEntry* ClassLoader::_first_append_entry = NULL;
 ClassPathEntry* ClassLoader::_last_append_entry  = NULL;
 int             ClassLoader::_num_entries        = 0;
+int             ClassLoader::_num_boot_entries   = -1;
 #if INCLUDE_CDS
 GrowableArray<char*>* ClassLoader::_boot_modules_array = NULL;
 GrowableArray<char*>* ClassLoader::_platform_modules_array = NULL;
@@ -242,7 +242,7 @@
 
 // Given a fully qualified class name, find its defining package in the class loader's
 // package entry table.
-static PackageEntry* get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS) {
+PackageEntry* ClassLoader::get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS) {
   ResourceMark rm(THREAD);
   const char *pkg_name = ClassLoader::package_from_name(class_name);
   if (pkg_name == NULL) {
@@ -509,7 +509,7 @@
 #endif
 
       } else {
-        PackageEntry* package_entry = get_package_entry(name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL);
+        PackageEntry* package_entry = ClassLoader::get_package_entry(name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL);
         if (package_entry != NULL) {
           ResourceMark rm;
           // Get the module name
@@ -540,6 +540,13 @@
   return NULL;
 }
 
+JImageLocationRef ClassLoader::jimage_find_resource(JImageFile* jf,
+                                                    const char* module_name,
+                                                    const char* file_name,
+                                                    jlong &size) {
+  return ((*JImageFindResource)(jf, module_name, get_jimage_version_string(), file_name, &size));
+}
+
 #ifndef PRODUCT
 bool ctw_visitor(JImageFile* jimage,
         const char* module_name, const char* version, const char* package,
@@ -1066,7 +1073,7 @@
   char path[JVM_MAXPATHLEN];
   char ebuf[1024];
   void* handle = NULL;
-  if (os::dll_build_name(path, sizeof(path), Arguments::get_dll_dir(), "zip")) {
+  if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), "zip")) {
     handle = os::dll_load(path, ebuf, sizeof ebuf);
   }
   if (handle == NULL) {
@@ -1104,7 +1111,7 @@
   char path[JVM_MAXPATHLEN];
   char ebuf[1024];
   void* handle = NULL;
-  if (os::dll_build_name(path, sizeof(path), Arguments::get_dll_dir(), "jimage")) {
+  if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), "jimage")) {
     handle = os::dll_load(path, ebuf, sizeof ebuf);
   }
   if (handle == NULL) {
@@ -1434,7 +1441,6 @@
   const char* const class_name = name->as_C_string();
 
   EventMark m("loading class %s", class_name);
-  ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion);
 
   const char* const file_name = file_name_for_class_name(class_name,
                                                          name->utf8_length());
@@ -1459,9 +1465,6 @@
   // This would include:
   //   [--patch-module=<module>=<file>(<pathsep><file>)*]; [jimage | exploded module build]
   //
-  // DumpSharedSpaces and search_append_only are mutually exclusive and cannot
-  // be true at the same time.
-  assert(!(DumpSharedSpaces && search_append_only), "DumpSharedSpaces and search_append_only are both true");
 
   // Load Attempt #1: --patch-module
   // Determine the class' defining module.  If it appears in the _patch_mod_entries,
@@ -1507,6 +1510,11 @@
 
     e = _first_append_entry;
     while (e != NULL) {
+      if (DumpSharedSpaces && classpath_index >= _num_boot_entries) {
+        // Do not load any class from the app classpath using the boot loader. Let
+        // the built-in app class laoder load them.
+        break;
+      }
       stream = e->open_stream(file_name, CHECK_NULL);
       if (!context.check(stream, classpath_index)) {
         return NULL;
@@ -1520,9 +1528,6 @@
   }
 
   if (NULL == stream) {
-    if (DumpSharedSpaces) {
-      tty->print_cr("Preload Warning: Cannot find %s", class_name);
-    }
     return NULL;
   }
 
@@ -1548,6 +1553,100 @@
   return context.record_result(name, e, classpath_index, result, THREAD);
 }
 
+#if INCLUDE_CDS
+static char* skip_uri_protocol(char* source) {
+  if (strncmp(source, "file:", 5) == 0) {
+    // file: protocol path could start with file:/ or file:///
+    // locate the char after all the forward slashes
+    int offset = 5;
+    while (*(source + offset) == '/') {
+        offset++;
+    }
+    source += offset;
+  // for non-windows platforms, move back one char as the path begins with a '/'
+#ifndef _WINDOWS
+    source -= 1;
+#endif
+  } else if (strncmp(source, "jrt:/", 5) == 0) {
+    source += 5;
+  }
+  return source;
+}
+
+void ClassLoader::record_shared_class_loader_type(InstanceKlass* ik, const ClassFileStream* stream) {
+  assert(DumpSharedSpaces, "sanity");
+  assert(stream != NULL, "sanity");
+
+  if (ik->is_anonymous()) {
+    // We do not archive anonymous classes.
+    return;
+  }
+
+  if (stream->source() == NULL) {
+    if (ik->class_loader() == NULL) {
+      // JFR classes
+      ik->set_shared_classpath_index(0);
+      ik->set_class_loader_type(ClassLoader::BOOT_LOADER);
+    }
+    return;
+  }
+
+  assert(has_jrt_entry(), "CDS dumping does not support exploded JDK build");
+
+  ModuleEntry* module = ik->module();
+  ClassPathEntry* e = NULL;
+  int classpath_index = 0;
+
+  // Check if the class is from the runtime image
+  if (module != NULL && (module->location() != NULL) &&
+      (module->location()->starts_with("jrt:"))) {
+    e = _jrt_entry;
+    classpath_index = 0;
+  } else {
+    classpath_index = 1;
+    ResourceMark rm;
+    char* canonical_path = NEW_RESOURCE_ARRAY(char, JVM_MAXPATHLEN);
+    for (e = _first_append_entry; e != NULL; e = e->next()) {
+      if (get_canonical_path(e->name(), canonical_path, JVM_MAXPATHLEN)) {
+        char* src = (char*)stream->source();
+        // save the path from the file: protocol or the module name from the jrt: protocol
+        // if no protocol prefix is found, src is the same as stream->source() after the following call
+        src = skip_uri_protocol(src);
+        if (strcmp(canonical_path, os::native_path((char*)src)) == 0) {
+          break;
+        }
+        classpath_index ++;
+      }
+    }
+    if (e == NULL) {
+      assert(ik->shared_classpath_index() < 0,
+        "must be a class from a custom jar which isn't in the class path or boot class path");
+      return;
+    }
+  }
+
+  if (classpath_index < _num_boot_entries) {
+    // ik is either:
+    // 1) a boot class loaded from the runtime image during vm initialization (classpath_index = 0); or
+    // 2) a user's class from -Xbootclasspath/a (classpath_index > 0)
+    // In the second case, the classpath_index, classloader_type will be recorded via
+    // context.record_result() in ClassLoader::load_class(Symbol* name, bool search_append_only, TRAPS).
+    if (classpath_index > 0) {
+      return;
+    }
+  }
+
+  ResourceMark rm;
+  const char* const class_name = ik->name()->as_C_string();
+  const char* const file_name = file_name_for_class_name(class_name,
+                                                         ik->name()->utf8_length());
+  assert(file_name != NULL, "invariant");
+  Thread* THREAD = Thread::current();
+  ClassLoaderExt::Context context(class_name, file_name, CATCH);
+  context.record_result(ik->name(), e, classpath_index, ik, THREAD);
+}
+#endif // INCLUDE_CDS
+
 // Initialize the class loader's access to methods in libzip.  Parse and
 // process the boot classpath into a list ClassPathEntry objects.  Once
 // this list has been created, it must not change order (see class PackageInfo)
@@ -1632,6 +1731,7 @@
 #if INCLUDE_CDS
 void ClassLoader::initialize_shared_path() {
   if (DumpSharedSpaces) {
+    _num_boot_entries = _num_entries;
     ClassLoaderExt::setup_search_paths();
     _shared_paths_misc_info->write_jint(0); // see comments in SharedPathsMiscInfo::check()
   }
--- a/hotspot/src/share/vm/classfile/classLoader.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_CLASSFILE_CLASSLOADER_HPP
 #define SHARE_VM_CLASSFILE_CLASSLOADER_HPP
 
+#include "classfile/jimage.hpp"
 #include "runtime/orderAccess.hpp"
 #include "runtime/perfData.hpp"
 #include "utilities/exceptions.hpp"
@@ -47,6 +48,7 @@
 
 class JImageFile;
 class ClassFileStream;
+class PackageEntry;
 
 class ClassPathEntry : public CHeapObj<mtClass> {
 private:
@@ -103,7 +105,6 @@
   jlong pos;                    /* position of LOC header (if negative) or data */
 } jzentry;
 
-
 class ClassPathZipEntry: public ClassPathEntry {
  enum {
    _unknown = 0,
@@ -249,6 +250,10 @@
   //       the entries on the _first_append_entry linked list.
   static int _num_entries;
 
+  // number of entries in the boot class path including the
+  // java runtime image
+  static int _num_boot_entries;
+
   // Array of module names associated with the boot class loader
   CDS_ONLY(static GrowableArray<char*>* _boot_modules_array;)
 
@@ -289,6 +294,7 @@
   static bool get_canonical_path(const char* orig, char* out, int len);
   static const char* file_name_for_class_name(const char* class_name,
                                               int class_name_len);
+  static PackageEntry* get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS);
 
  public:
   static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
@@ -436,7 +442,10 @@
   static void initialize_module_loader_map(JImageFile* jimage);
   static s2 classloader_type(Symbol* class_name, ClassPathEntry* e,
                              int classpath_index, TRAPS);
+  static void record_shared_class_loader_type(InstanceKlass* ik, const ClassFileStream* stream);
 #endif
+  static JImageLocationRef jimage_find_resource(JImageFile* jf, const char* module_name,
+                                                const char* file_name, jlong &size);
 
   static void  trace_class_path(const char* msg, const char* name = NULL);
 
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -75,6 +75,9 @@
 #include "utilities/growableArray.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/ostream.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc/g1/g1SATBCardTableModRefBS.hpp"
+#endif // INCLUDE_ALL_GCS
 #if INCLUDE_TRACE
 #include "trace/tracing.hpp"
 #endif
@@ -764,6 +767,25 @@
   return OopHandle(_handles.add(h()));
 }
 
+void ClassLoaderData::remove_handle(OopHandle h) {
+  oop* ptr = h.ptr_raw();
+  if (ptr != NULL) {
+    assert(_handles.contains(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
+#if INCLUDE_ALL_GCS
+    // This barrier is used by G1 to remember the old oop values, so
+    // that we don't forget any objects that were live at the snapshot at
+    // the beginning.
+    if (UseG1GC) {
+      oop obj = *ptr;
+      if (obj != NULL) {
+        G1SATBCardTableModRefBS::enqueue(obj);
+      }
+    }
+#endif
+    *ptr = NULL;
+  }
+}
+
 void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) {
   MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
   if (dest.resolve() != NULL) {
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -364,6 +364,7 @@
   const char* loader_name();
 
   OopHandle add_handle(Handle h);
+  void remove_handle(OopHandle h);
   void init_handle_locked(OopHandle& pd, Handle h);  // used for concurrent access to ModuleEntry::_pd field
   void add_class(Klass* k, bool publicize = true);
   void remove_class(Klass* k);
--- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_CLASSFILE_CLASSLOADEREXT_HPP
 
 #include "classfile/classLoader.hpp"
+#include "classfile/systemDictionary.hpp"
 #include "oops/instanceKlass.hpp"
 #include "runtime/handles.hpp"
 
@@ -56,8 +57,15 @@
       if (ClassLoader::add_package(_file_name, classpath_index, THREAD)) {
 #if INCLUDE_CDS
         if (DumpSharedSpaces) {
-          s2 classloader_type = ClassLoader::classloader_type(
-                          class_name, e, classpath_index, CHECK_(result));
+          oop loader = result->class_loader();
+          s2 classloader_type = ClassLoader::BOOT_LOADER;
+          if (SystemDictionary::is_system_class_loader(loader)) {
+            classloader_type = ClassLoader::APP_LOADER;
+            ClassLoaderExt::set_has_app_classes();
+          } else if (SystemDictionary::is_platform_class_loader(loader)) {
+            classloader_type = ClassLoader::PLATFORM_LOADER;
+            ClassLoaderExt::set_has_platform_classes();
+          }
           result->set_shared_classpath_index(classpath_index);
           result->set_class_loader_type(classloader_type);
         }
@@ -82,6 +90,13 @@
    return true;
  }
   static Klass* load_one_class(ClassListParser* parser, TRAPS);
+#if INCLUDE_CDS
+  static void set_has_app_classes() {}
+  static void set_has_platform_classes() {}
+  static char* read_manifest(ClassPathEntry* entry, jint *manifest_size, TRAPS) {
+    return NULL;
+  }
+#endif
 };
 
 #endif // SHARE_VM_CLASSFILE_CLASSLOADEREXT_HPP
--- a/hotspot/src/share/vm/classfile/dictionary.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -85,6 +85,7 @@
 
 void Dictionary::free_entry(DictionaryEntry* entry) {
   // avoid recursion when deleting linked list
+  // pd_set is accessed during a safepoint.
   while (entry->pd_set() != NULL) {
     ProtectionDomainEntry* to_delete = entry->pd_set();
     entry->set_pd_set(to_delete->next());
@@ -101,7 +102,7 @@
   if (protection_domain == instance_klass()->protection_domain()) {
     // Ensure this doesn't show up in the pd_set (invariant)
     bool in_pd_set = false;
-    for (ProtectionDomainEntry* current = _pd_set;
+    for (ProtectionDomainEntry* current = pd_set_acquire();
                                 current != NULL;
                                 current = current->next()) {
       if (current->protection_domain() == protection_domain) {
@@ -121,7 +122,7 @@
     return true;
   }
 
-  for (ProtectionDomainEntry* current = _pd_set;
+  for (ProtectionDomainEntry* current = pd_set_acquire();
                               current != NULL;
                               current = current->next()) {
     if (current->protection_domain() == protection_domain) return true;
@@ -135,12 +136,12 @@
   if (!contains_protection_domain(protection_domain())) {
     ProtectionDomainCacheEntry* entry = SystemDictionary::cache_get(protection_domain);
     ProtectionDomainEntry* new_head =
-                new ProtectionDomainEntry(entry, _pd_set);
+                new ProtectionDomainEntry(entry, pd_set());
     // Warning: Preserve store ordering.  The SystemDictionary is read
     //          without locks.  The new ProtectionDomainEntry must be
     //          complete before other threads can be allowed to see it
     //          via a store to _pd_set.
-    OrderAccess::release_store_ptr(&_pd_set, new_head);
+    release_set_pd_set(new_head);
   }
   LogTarget(Trace, protectiondomain) lt;
   if (lt.is_enabled()) {
@@ -365,11 +366,21 @@
   for (int i = 0; i < table_size(); ++i) {
     DictionaryEntry* p = bucket(i);
     while (p != NULL) {
-      DictionaryEntry* tmp;
-      tmp = p->next();
-      p->set_next(master_list);
-      master_list = p;
-      p = tmp;
+      DictionaryEntry* next = p->next();
+      InstanceKlass*ik = p->instance_klass();
+      // we cannot include signed classes in the archive because the certificates
+      // used during dump time may be different than those used during
+      // runtime (due to expiration, etc).
+      if (ik->signers() != NULL) {
+        ResourceMark rm;
+        tty->print_cr("Preload Warning: Skipping %s from signed JAR",
+                       ik->name()->as_C_string());
+        free_entry(p);
+      } else {
+        p->set_next(master_list);
+        master_list = p;
+      }
+      p = next;
     }
     set_entry(i, NULL);
   }
--- a/hotspot/src/share/vm/classfile/dictionary.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -29,6 +29,7 @@
 #include "classfile/systemDictionary.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/oop.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/hashtable.hpp"
 #include "utilities/ostream.hpp"
 
@@ -48,21 +49,6 @@
   DictionaryEntry* get_entry(int index, unsigned int hash, Symbol* name);
 
 protected:
-  DictionaryEntry* bucket(int i) const {
-    return (DictionaryEntry*)Hashtable<InstanceKlass*, mtClass>::bucket(i);
-  }
-
-  // The following method is not MT-safe and must be done under lock.
-  DictionaryEntry** bucket_addr(int i) {
-    return (DictionaryEntry**)Hashtable<InstanceKlass*, mtClass>::bucket_addr(i);
-  }
-
-  void add_entry(int index, DictionaryEntry* new_entry) {
-    Hashtable<InstanceKlass*, mtClass>::add_entry(index, (HashtableEntry<InstanceKlass*, mtClass>*)new_entry);
-  }
-
-  void free_entry(DictionaryEntry* entry);
-
   static size_t entry_size();
 public:
   Dictionary(ClassLoaderData* loader_data, int table_size);
@@ -106,6 +92,24 @@
 
   void print_on(outputStream* st) const;
   void verify();
+  DictionaryEntry* bucket(int i) const {
+    return (DictionaryEntry*)Hashtable<InstanceKlass*, mtClass>::bucket(i);
+  }
+
+  // The following method is not MT-safe and must be done under lock.
+  DictionaryEntry** bucket_addr(int i) {
+    return (DictionaryEntry**)Hashtable<InstanceKlass*, mtClass>::bucket_addr(i);
+  }
+
+  void add_entry(int index, DictionaryEntry* new_entry) {
+    Hashtable<InstanceKlass*, mtClass>::add_entry(index, (HashtableEntry<InstanceKlass*, mtClass>*)new_entry);
+  }
+
+  void unlink_entry(DictionaryEntry* entry) {
+    Hashtable<InstanceKlass*, mtClass>::unlink_entry((HashtableEntry<InstanceKlass*, mtClass>*)entry);
+  }
+
+  void free_entry(DictionaryEntry* entry);
 };
 
 // An entry in the class loader data dictionaries, this describes a class as
@@ -134,7 +138,7 @@
   // It is essentially a cache to avoid repeated Java up-calls to
   // ClassLoader.checkPackageAccess().
   //
-  ProtectionDomainEntry* _pd_set;
+  ProtectionDomainEntry* volatile _pd_set;
 
  public:
   // Tells whether a protection is in the approved set.
@@ -153,8 +157,15 @@
     return (DictionaryEntry**)HashtableEntry<InstanceKlass*, mtClass>::next_addr();
   }
 
-  ProtectionDomainEntry* pd_set() const { return _pd_set; }
-  void set_pd_set(ProtectionDomainEntry* pd_set) { _pd_set = pd_set; }
+  ProtectionDomainEntry* pd_set() const            { return _pd_set; }
+  void set_pd_set(ProtectionDomainEntry* new_head) {  _pd_set = new_head; }
+
+  ProtectionDomainEntry* pd_set_acquire() const    {
+    return (ProtectionDomainEntry*)OrderAccess::load_ptr_acquire(&_pd_set);
+  }
+  void release_set_pd_set(ProtectionDomainEntry* new_head) {
+    OrderAccess::release_store_ptr(&_pd_set, new_head);
+  }
 
   // Tells whether the initiating class' protection domain can access the klass in this entry
   bool is_valid_protection_domain(Handle protection_domain) {
@@ -167,7 +178,7 @@
   }
 
   void verify_protection_domain_set() {
-    for (ProtectionDomainEntry* current = _pd_set;
+    for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint
                                 current != NULL;
                                 current = current->_next) {
       current->_pd_cache->protection_domain()->verify();
@@ -181,7 +192,7 @@
 
   void print_count(outputStream *st) {
     int count = 0;
-    for (ProtectionDomainEntry* current = _pd_set;
+    for (ProtectionDomainEntry* current = pd_set();  // accessed inside SD lock
                                 current != NULL;
                                 current = current->_next) {
       count++;
@@ -246,10 +257,6 @@
 class SymbolPropertyTable : public Hashtable<Symbol*, mtSymbol> {
   friend class VMStructs;
 private:
-  SymbolPropertyEntry* bucket(int i) {
-    return (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::bucket(i);
-  }
-
   // The following method is not MT-safe and must be done under lock.
   SymbolPropertyEntry** bucket_addr(int i) {
     return (SymbolPropertyEntry**) Hashtable<Symbol*, mtSymbol>::bucket_addr(i);
@@ -303,5 +310,9 @@
   void methods_do(void f(Method*));
 
   void verify();
+
+  SymbolPropertyEntry* bucket(int i) {
+    return (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::bucket(i);
+  }
 };
 #endif // SHARE_VM_CLASSFILE_DICTIONARY_HPP
--- a/hotspot/src/share/vm/classfile/klassFactory.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/klassFactory.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -70,11 +70,25 @@
       ClassLoaderData* loader_data =
         ClassLoaderData::class_loader_data(class_loader());
       int path_index = ik->shared_classpath_index();
-      SharedClassPathEntry* ent =
-        (SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
+      const char* pathname;
+      if (path_index < 0) {
+        // shared classes loaded by user defined class loader
+        // do not have shared_classpath_index
+        ModuleEntry* mod_entry = ik->module();
+        if (mod_entry != NULL && (mod_entry->location() != NULL)) {
+          ResourceMark rm;
+          pathname = (const char*)(mod_entry->location()->as_C_string());
+        } else {
+          pathname = "";
+        }
+      } else {
+        SharedClassPathEntry* ent =
+          (SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
+        pathname = ent == NULL ? NULL : ent->name();
+      }
       ClassFileStream* stream = new ClassFileStream(ptr,
                                                     end_ptr - ptr,
-                                                    ent == NULL ? NULL : ent->name(),
+                                                    pathname,
                                                     ClassFileStream::verify);
       ClassFileParser parser(stream,
                              class_name,
@@ -215,8 +229,10 @@
 
   TRACE_KLASS_CREATION(result, parser, THREAD);
 
-#if INCLUDE_CDS && INCLUDE_JVMTI
+#if INCLUDE_CDS
   if (DumpSharedSpaces) {
+    ClassLoader::record_shared_class_loader_type(result, stream);
+#if INCLUDE_JVMTI
     assert(cached_class_file == NULL, "Sanity");
     // Archive the class stream data into the optional data section
     JvmtiCachedClassFileData *p;
@@ -233,8 +249,9 @@
     p->length = len;
     memcpy(p->data, bytes, len);
     result->set_archived_class_data(p);
+#endif // INCLUDE_JVMTI
   }
-#endif
+#endif // INCLUDE_CDS
 
   return result;
 }
--- a/hotspot/src/share/vm/classfile/stringTable.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -729,7 +729,6 @@
   }
 
   G1CollectedHeap::heap()->end_archive_alloc_range(string_space, os::vm_allocation_granularity());
-  assert(string_space->length() <= 2, "sanity");
   return true;
 }
 
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -66,6 +66,7 @@
 #include "prims/resolvedMethodTable.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/arguments_ext.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/fieldType.hpp"
 #include "runtime/handles.inline.hpp"
@@ -869,7 +870,7 @@
             // during compilations.
             MutexLocker mu(Compile_lock, THREAD);
             update_dictionary(d_index, d_hash, p_index, p_hash,
-                              k, class_loader, THREAD);
+              k, class_loader, THREAD);
           }
 
           if (JvmtiExport::should_post_class_load()) {
@@ -910,12 +911,9 @@
   if (protection_domain() == NULL) return k;
 
   // Check the protection domain has the right access
-  {
-    MutexLocker mu(SystemDictionary_lock, THREAD);
-    if (dictionary->is_valid_protection_domain(d_index, d_hash, name,
-                                               protection_domain)) {
-      return k;
-    }
+  if (dictionary->is_valid_protection_domain(d_index, d_hash, name,
+                                             protection_domain)) {
+    return k;
   }
 
   // Verify protection domain. If it fails an exception is thrown
@@ -1009,7 +1007,6 @@
     // Create a new CLD for anonymous class, that uses the same class loader
     // as the host_klass
     guarantee(host_klass->class_loader() == class_loader(), "should be the same");
-    guarantee(!DumpSharedSpaces, "must not create anonymous classes when dumping");
     loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader(), CHECK_NULL);
   } else {
     loader_data = ClassLoaderData::class_loader_data(class_loader());
@@ -1078,6 +1075,15 @@
                                                      Handle protection_domain,
                                                      ClassFileStream* st,
                                                      TRAPS) {
+#if INCLUDE_CDS
+  ResourceMark rm(THREAD);
+  if (DumpSharedSpaces && !class_loader.is_null() &&
+      !ArgumentsExt::using_AppCDS() && strcmp(class_name->as_C_string(), "Unnamed") != 0) {
+    // If AppCDS is not enabled, don't define the class at dump time (except for the "Unnamed"
+    // class, which is used by MethodHandles).
+    THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string());
+  }
+#endif
 
   HandleMark hm(THREAD);
 
@@ -1104,11 +1110,13 @@
  InstanceKlass* k = NULL;
 
 #if INCLUDE_CDS
-  k = SystemDictionaryShared::lookup_from_stream(class_name,
-                                                 class_loader,
-                                                 protection_domain,
-                                                 st,
-                                                 CHECK_NULL);
+  if (!DumpSharedSpaces) {
+    k = SystemDictionaryShared::lookup_from_stream(class_name,
+                                                   class_loader,
+                                                   protection_domain,
+                                                   st,
+                                                   CHECK_NULL);
+  }
 #endif
 
   if (k == NULL) {
@@ -1217,6 +1225,16 @@
          "Cannot use sharing if java.base is patched");
   ResourceMark rm;
   int path_index = ik->shared_classpath_index();
+  ClassLoaderData* loader_data = class_loader_data(class_loader);
+  if (path_index < 0) {
+    // path_index < 0 indicates that the class is intended for a custom loader
+    // and should not be loaded by boot/platform/app loaders
+    if (loader_data->is_builtin_class_loader_data()) {
+      return false;
+    } else {
+      return true;
+    }
+  }
   SharedClassPathEntry* ent =
             (SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
   if (!Universe::is_module_initialized()) {
@@ -1230,7 +1248,6 @@
   PackageEntry* pkg_entry = NULL;
   ModuleEntry* mod_entry = NULL;
   const char* pkg_string = NULL;
-  ClassLoaderData* loader_data = class_loader_data(class_loader);
   pkg_name = InstanceKlass::package_from_name(class_name, CHECK_false);
   if (pkg_name != NULL) {
     pkg_string = pkg_name->as_C_string();
@@ -1403,6 +1420,18 @@
   }
   return ik;
 }
+
+void SystemDictionary::clear_invoke_method_table() {
+  SymbolPropertyEntry* spe = NULL;
+  for (int index = 0; index < _invoke_method_table->table_size(); index++) {
+    SymbolPropertyEntry* p = _invoke_method_table->bucket(index);
+    while (p != NULL) {
+      spe = p;
+      p = p->next();
+      _invoke_method_table->free_entry(spe);
+    }
+  }
+}
 #endif // INCLUDE_CDS
 
 InstanceKlass* SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
@@ -1449,7 +1478,6 @@
         }
       }
     } else {
-      assert(!DumpSharedSpaces, "Archive dumped after module system initialization");
       // After the module system has been initialized, check if the class'
       // package is in a module defined to the boot loader.
       if (pkg_name == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
@@ -1968,8 +1996,19 @@
   invoke_method_table()->methods_do(f);
 }
 
+class RemoveClassesClosure : public CLDClosure {
+  public:
+    void do_cld(ClassLoaderData* cld) {
+      if (cld->is_system_class_loader_data() || cld->is_platform_class_loader_data()) {
+        cld->dictionary()->remove_classes_in_error_state();
+      }
+    }
+};
+
 void SystemDictionary::remove_classes_in_error_state() {
   ClassLoaderData::the_null_class_loader_data()->dictionary()->remove_classes_in_error_state();
+  RemoveClassesClosure rcc;
+  ClassLoaderDataGraph::cld_do(&rcc);
 }
 
 // ----------------------------------------------------------------------------
@@ -2910,6 +2949,56 @@
   }
 }
 
+class CombineDictionariesClosure : public CLDClosure {
+  private:
+    Dictionary* _master_dictionary;
+  public:
+    CombineDictionariesClosure(Dictionary* master_dictionary) :
+      _master_dictionary(master_dictionary) {}
+    void do_cld(ClassLoaderData* cld) {
+      ResourceMark rm;
+      if (cld->is_system_class_loader_data() || cld->is_platform_class_loader_data()) {
+        for (int i = 0; i < cld->dictionary()->table_size(); ++i) {
+          Dictionary* curr_dictionary = cld->dictionary();
+          DictionaryEntry* p = curr_dictionary->bucket(i);
+          while (p != NULL) {
+            Symbol* name = p->instance_klass()->name();
+            unsigned int d_hash = _master_dictionary->compute_hash(name);
+            int d_index = _master_dictionary->hash_to_index(d_hash);
+            DictionaryEntry* next = p->next();
+            if (p->literal()->class_loader_data() != cld) {
+              // This is an initiating class loader entry; don't use it
+              log_trace(cds)("Skipping initiating cl entry: %s", name->as_C_string());
+              curr_dictionary->free_entry(p);
+            } else {
+              log_trace(cds)("Moved to boot dictionary: %s", name->as_C_string());
+              curr_dictionary->unlink_entry(p);
+              p->set_pd_set(NULL); // pd_set is runtime only information and will be reconstructed.
+              _master_dictionary->add_entry(d_index, p);
+            }
+            p = next;
+          }
+          *curr_dictionary->bucket_addr(i) = NULL;
+        }
+      }
+    }
+};
+
+// Combining platform and system loader dictionaries into boot loader dictionaries.
+// During run time, we only have one shared dictionary.
+void SystemDictionary::combine_shared_dictionaries() {
+  assert(DumpSharedSpaces, "dump time only");
+  Dictionary* master_dictionary = ClassLoaderData::the_null_class_loader_data()->dictionary();
+  CombineDictionariesClosure cdc(master_dictionary);
+  ClassLoaderDataGraph::cld_do(&cdc);
+
+  // These tables are no longer valid or necessary. Keeping them around will
+  // cause SystemDictionary::verify() to fail. Let's empty them.
+  _placeholders        = new PlaceholderTable(_placeholder_table_size);
+  _loader_constraints  = new LoaderConstraintTable(_loader_constraint_size);
+
+  NOT_PRODUCT(SystemDictionary::verify());
+}
 
 // caller needs ResourceMark
 const char* SystemDictionary::loader_name(const oop loader) {
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -385,6 +385,7 @@
 public:
   // Sharing support.
   static void reorder_dictionary_for_sharing();
+  static void combine_shared_dictionaries();
   static size_t count_bytes_for_buckets();
   static size_t count_bytes_for_table();
   static void copy_buckets(char* top, char* end);
@@ -643,6 +644,7 @@
                                           TRAPS);
   static bool is_system_class_loader(oop class_loader);
   static bool is_platform_class_loader(oop class_loader);
+  static void clear_invoke_method_table();
 
 protected:
   static InstanceKlass* find_shared_class(Symbol* class_name);
--- a/hotspot/src/share/vm/code/nmethod.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -1220,7 +1220,7 @@
     // for stack scanning.
     if (state == not_entrant) {
       mark_as_seen_on_stack();
-      OrderAccess::storestore();
+      OrderAccess::storestore(); // _stack_traversal_mark and _state
     }
 
     // Change state
--- a/hotspot/src/share/vm/code/nmethod.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -136,7 +136,7 @@
   // stack.  An not_entrant method can be removed when there are no
   // more activations, i.e., when the _stack_traversal_mark is less than
   // current sweep traversal index.
-  volatile jlong _stack_traversal_mark;
+  volatile long _stack_traversal_mark;
 
   // The _hotness_counter indicates the hotness of a method. The higher
   // the value the hotter the method. The hotness counter of a nmethod is
@@ -396,8 +396,8 @@
  public:
 
   // Sweeper support
-  jlong  stack_traversal_mark()                    { return OrderAccess::load_acquire(&_stack_traversal_mark); }
-  void  set_stack_traversal_mark(jlong l)          { OrderAccess::release_store(&_stack_traversal_mark, l); }
+  long  stack_traversal_mark()                    { return _stack_traversal_mark; }
+  void  set_stack_traversal_mark(long l)          { _stack_traversal_mark = l; }
 
   // implicit exceptions support
   address continuation_for_implicit_exception(address pc);
--- a/hotspot/src/share/vm/compiler/disassembler.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 #include "gc/shared/collectedHeap.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/stubCodeGenerator.hpp"
@@ -163,7 +162,6 @@
   bool          _print_pc;
   bool          _print_bytes;
   address       _cur_insn;
-  int           _total_ticks;
   int           _bytes_per_line; // arch-specific formatting option
 
   static bool match(const char* event, const char* tag) {
@@ -213,18 +211,6 @@
       _nm->print_code_comment_on(st, COMMENT_COLUMN, pc0, pc);
       // this calls reloc_string_for which calls oop::print_value_on
     }
-
-    // Output pc bucket ticks if we have any
-    if (total_ticks() != 0) {
-      address bucket_pc = FlatProfiler::bucket_start_for(pc);
-      if (bucket_pc != NULL && bucket_pc > pc0 && bucket_pc <= pc) {
-        int bucket_count = FlatProfiler::bucket_count_for(pc0);
-        if (bucket_count != 0) {
-          st->bol();
-          st->print_cr("%3.1f%% [%d]", bucket_count*100.0/total_ticks(), bucket_count);
-        }
-      }
-    }
     // follow each complete insn by a nice newline
     st->cr();
   }
@@ -233,8 +219,6 @@
 
   outputStream* output() { return _output; }
   address cur_insn() { return _cur_insn; }
-  int total_ticks() { return _total_ticks; }
-  void set_total_ticks(int n) { _total_ticks = n; }
   const char* options() { return _option_buf; }
 };
 
@@ -561,20 +545,6 @@
 #endif
   env.output()->print_cr("  [" PTR_FORMAT ", " PTR_FORMAT "]  " JLONG_FORMAT " bytes", p2i(p), p2i(end), ((jlong)(end - p)));
 
-  // If there has been profiling, print the buckets.
-  if (FlatProfiler::bucket_start_for(p) != NULL) {
-    unsigned char* p1 = p;
-    int total_bucket_count = 0;
-    while (p1 < end) {
-      unsigned char* p0 = p1;
-      p1 += pd_instruction_alignment();
-      address bucket_pc = FlatProfiler::bucket_start_for(p1);
-      if (bucket_pc != NULL && bucket_pc > p0 && bucket_pc <= p1)
-        total_bucket_count += FlatProfiler::bucket_count_for(p0);
-    }
-    env.set_total_ticks(total_bucket_count);
-  }
-
   // Print constant table.
   if (nm->consts_size() > 0) {
     nm->print_nmethod_labels(env.output(), nm->consts_begin());
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -1719,7 +1719,6 @@
                              G1BlockOffsetTable::compute_size(g1_rs.size() / HeapWordSize),
                              G1BlockOffsetTable::heap_map_factor());
 
-  ReservedSpace cardtable_rs(G1SATBCardTableLoggingModRefBS::compute_size(g1_rs.size() / HeapWordSize));
   G1RegionToSpaceMapper* cardtable_storage =
     create_aux_memory_mapper("Card Table",
                              G1SATBCardTableLoggingModRefBS::compute_size(g1_rs.size() / HeapWordSize),
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -54,7 +54,6 @@
   _gc_par_phases[UniverseRoots] = new WorkerDataArray<double>(max_gc_threads, "Universe Roots (ms):");
   _gc_par_phases[JNIRoots] = new WorkerDataArray<double>(max_gc_threads, "JNI Handles Roots (ms):");
   _gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray<double>(max_gc_threads, "ObjectSynchronizer Roots (ms):");
-  _gc_par_phases[FlatProfilerRoots] = new WorkerDataArray<double>(max_gc_threads, "FlatProfiler Roots (ms):");
   _gc_par_phases[ManagementRoots] = new WorkerDataArray<double>(max_gc_threads, "Management Roots (ms):");
   _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray<double>(max_gc_threads, "SystemDictionary Roots (ms):");
   _gc_par_phases[CLDGRoots] = new WorkerDataArray<double>(max_gc_threads, "CLDG Roots (ms):");
--- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -49,7 +49,6 @@
     UniverseRoots,
     JNIRoots,
     ObjectSynchronizerRoots,
-    FlatProfilerRoots,
     ManagementRoots,
     SystemDictionaryRoots,
     CLDGRoots,
--- a/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -62,7 +62,7 @@
       oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
       if (_g1h->is_obj_dead_cond(obj, _vo)) {
         Log(gc, verify) log;
-        log.info("Root location " PTR_FORMAT " points to dead obj " PTR_FORMAT, p2i(p), p2i(obj));
+        log.error("Root location " PTR_FORMAT " points to dead obj " PTR_FORMAT, p2i(p), p2i(obj));
         if (_vo == VerifyOption_G1UseMarkWord) {
           log.error("  Mark word: " PTR_FORMAT, p2i(obj->mark()));
         }
--- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -48,7 +48,6 @@
 #include "prims/jvmtiExport.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/biasedLocking.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/synchronizer.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/vmThread.hpp"
--- a/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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,6 @@
 #include "gc/g1/g1RootProcessor.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
 #include "memory/allocation.inline.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/mutex.hpp"
 #include "services/management.hpp"
 #include "utilities/macros.hpp"
@@ -272,13 +271,6 @@
   }
 
   {
-    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::FlatProfilerRoots, worker_i);
-    if (!_process_strong_tasks.is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) {
-      FlatProfiler::oops_do(strong_roots);
-    }
-  }
-
-  {
     G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i);
     if (!_process_strong_tasks.is_task_claimed(G1RP_PS_Management_oops_do)) {
       Management::oops_do(strong_roots);
--- a/hotspot/src/share/vm/gc/g1/g1RootProcessor.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1RootProcessor.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -57,7 +57,6 @@
     G1RP_PS_Universe_oops_do,
     G1RP_PS_JNIHandles_oops_do,
     G1RP_PS_ObjectSynchronizer_oops_do,
-    G1RP_PS_FlatProfiler_oops_do,
     G1RP_PS_Management_oops_do,
     G1RP_PS_SystemDictionary_oops_do,
     G1RP_PS_ClassLoaderDataGraph_oops_do,
--- a/hotspot/src/share/vm/gc/parallel/pcTasks.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/parallel/pcTasks.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -39,7 +39,6 @@
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/jniHandles.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/vmThread.hpp"
@@ -105,10 +104,6 @@
       ObjectSynchronizer::oops_do(&mark_and_push_closure);
       break;
 
-    case flat_profiler:
-      FlatProfiler::oops_do(&mark_and_push_closure);
-      break;
-
     case management:
       Management::oops_do(&mark_and_push_closure);
       break;
--- a/hotspot/src/share/vm/gc/parallel/pcTasks.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/parallel/pcTasks.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -94,12 +94,11 @@
     jni_handles           = 2,
     threads               = 3,
     object_synchronizer   = 4,
-    flat_profiler         = 5,
-    management            = 6,
-    jvmti                 = 7,
-    system_dictionary     = 8,
-    class_loader_data     = 9,
-    code_cache            = 10
+    management            = 5,
+    jvmti                 = 6,
+    system_dictionary     = 7,
+    class_loader_data     = 8,
+    code_cache            = 9
   };
  private:
   RootType _root_type;
--- a/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -50,7 +50,6 @@
 #include "logging/log.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/biasedLocking.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/vmThread.hpp"
 #include "services/management.hpp"
@@ -514,7 +513,6 @@
     MarkingCodeBlobClosure each_active_code_blob(mark_and_push_closure(), !CodeBlobToOopClosure::FixRelocations);
     Threads::oops_do(mark_and_push_closure(), &each_active_code_blob);
     ObjectSynchronizer::oops_do(mark_and_push_closure());
-    FlatProfiler::oops_do(mark_and_push_closure());
     Management::oops_do(mark_and_push_closure());
     JvmtiExport::oops_do(mark_and_push_closure());
     SystemDictionary::always_strong_oops_do(mark_and_push_closure());
@@ -607,7 +605,6 @@
   JNIHandles::oops_do(adjust_pointer_closure());   // Global (strong) JNI handles
   Threads::oops_do(adjust_pointer_closure(), NULL);
   ObjectSynchronizer::oops_do(adjust_pointer_closure());
-  FlatProfiler::oops_do(adjust_pointer_closure());
   Management::oops_do(adjust_pointer_closure());
   JvmtiExport::oops_do(adjust_pointer_closure());
   SystemDictionary::oops_do(adjust_pointer_closure());
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -60,7 +60,6 @@
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/vmThread.hpp"
 #include "services/management.hpp"
@@ -2086,7 +2085,6 @@
     // We scan the thread roots in parallel
     Threads::create_thread_roots_marking_tasks(q);
     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::object_synchronizer));
-    q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::flat_profiler));
     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::management));
     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::system_dictionary));
     q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::class_loader_data));
@@ -2169,7 +2167,6 @@
   JNIHandles::oops_do(&oop_closure);   // Global (strong) JNI handles
   Threads::oops_do(&oop_closure, NULL);
   ObjectSynchronizer::oops_do(&oop_closure);
-  FlatProfiler::oops_do(&oop_closure);
   Management::oops_do(&oop_closure);
   JvmtiExport::oops_do(&oop_closure);
   SystemDictionary::oops_do(&oop_closure);
--- a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -49,7 +49,6 @@
 #include "logging/log.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/biasedLocking.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/threadCritical.hpp"
 #include "runtime/vmThread.hpp"
@@ -381,7 +380,6 @@
       // We scan the thread roots in parallel
       Threads::create_thread_roots_tasks(q);
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::object_synchronizer));
-      q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::flat_profiler));
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::management));
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::system_dictionary));
       q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::class_loader_data));
--- a/hotspot/src/share/vm/gc/parallel/psTasks.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/parallel/psTasks.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,6 @@
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/vmThread.hpp"
 #include "services/management.hpp"
@@ -74,10 +73,6 @@
       ObjectSynchronizer::oops_do(&roots_closure);
       break;
 
-    case flat_profiler:
-      FlatProfiler::oops_do(&roots_closure);
-      break;
-
     case system_dictionary:
       SystemDictionary::oops_do(&roots_closure);
       break;
--- a/hotspot/src/share/vm/gc/parallel/psTasks.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/parallel/psTasks.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -57,12 +57,11 @@
     jni_handles           = 2,
     threads               = 3,
     object_synchronizer   = 4,
-    flat_profiler         = 5,
-    system_dictionary     = 6,
-    class_loader_data     = 7,
-    management            = 8,
-    jvmti                 = 9,
-    code_cache            = 10
+    system_dictionary     = 5,
+    class_loader_data     = 6,
+    management            = 7,
+    jvmti                 = 8,
+    code_cache            = 9
   };
  private:
   RootType _root_type;
--- a/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -46,7 +46,6 @@
 #include "oops/instanceRefKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/synchronizer.hpp"
 #include "runtime/thread.inline.hpp"
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -47,7 +47,6 @@
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/biasedLocking.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
@@ -71,7 +70,6 @@
   GCH_PS_Universe_oops_do,
   GCH_PS_JNIHandles_oops_do,
   GCH_PS_ObjectSynchronizer_oops_do,
-  GCH_PS_FlatProfiler_oops_do,
   GCH_PS_Management_oops_do,
   GCH_PS_SystemDictionary_oops_do,
   GCH_PS_ClassLoaderDataGraph_oops_do,
@@ -606,9 +604,6 @@
   if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) {
     ObjectSynchronizer::oops_do(strong_roots);
   }
-  if (!_process_strong_tasks->is_task_claimed(GCH_PS_FlatProfiler_oops_do)) {
-    FlatProfiler::oops_do(strong_roots);
-  }
   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) {
     Management::oops_do(strong_roots);
   }
--- a/hotspot/src/share/vm/interpreter/rewriter.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/interpreter/rewriter.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -109,6 +109,11 @@
     MetadataFactory::free_metadata(loader_data, cache);
     _pool->set_cache(NULL);  // so the verifier isn't confused
   }
+
+  DEBUG_ONLY(
+  if (DumpSharedSpaces) {
+    cache->verify_just_initialized();
+  })
 }
 
 
--- a/hotspot/src/share/vm/logging/logTag.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/logging/logTag.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -140,6 +140,7 @@
   LOG_TAG(timer) \
   LOG_TAG(update) \
   LOG_TAG(unload) /* Trace unloading of classes */ \
+  LOG_TAG(unshareable) \
   LOG_TAG(verification) \
   LOG_TAG(verify) \
   LOG_TAG(vmoperation) \
--- a/hotspot/src/share/vm/memory/metaspaceClosure.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/memory/metaspaceClosure.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -275,7 +275,8 @@
       address, bool,
       UniqueMetaspaceClosure::my_hash,   // solaris compiler doesn't like: primitive_hash<address>
       UniqueMetaspaceClosure::my_equals, // solaris compiler doesn't like: primitive_equals<address>
-    16384> _has_been_visited;
+      15889,                             // prime number
+      ResourceObj::C_HEAP> _has_been_visited;
 };
 
 #endif // SHARE_VM_MEMORY_METASPACE_ITERATOR_HPP
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -374,25 +374,63 @@
 // Global object for holding classes that have been loaded.  Since this
 // is run at a safepoint just before exit, this is the entire set of classes.
 static GrowableArray<Klass*>* _global_klass_objects;
+
+static void collect_array_classes(Klass* k) {
+  _global_klass_objects->append_if_missing(k);
+  if (k->is_array_klass()) {
+    // Add in the array classes too
+    ArrayKlass* ak = ArrayKlass::cast(k);
+    Klass* h = ak->higher_dimension();
+    if (h != NULL) {
+      h->array_klasses_do(collect_array_classes);
+    }
+  }
+}
+
 class CollectClassesClosure : public KlassClosure {
   void do_klass(Klass* k) {
     if (!(k->is_instance_klass() && InstanceKlass::cast(k)->is_in_error_state())) {
       _global_klass_objects->append_if_missing(k);
     }
+    if (k->is_array_klass()) {
+      // Add in the array classes too
+      ArrayKlass* ak = ArrayKlass::cast(k);
+      Klass* h = ak->higher_dimension();
+      if (h != NULL) {
+        h->array_klasses_do(collect_array_classes);
+      }
+    }
   }
 };
 
 static void remove_unshareable_in_classes() {
   for (int i = 0; i < _global_klass_objects->length(); i++) {
     Klass* k = _global_klass_objects->at(i);
-    k->remove_unshareable_info();
+    if (!k->is_objArray_klass()) {
+      // InstanceKlass and TypeArrayKlass will in turn call remove_unshareable_info
+      // on their array classes.
+      assert(k->is_instance_klass() || k->is_typeArray_klass(), "must be");
+      k->remove_unshareable_info();
+    }
+  }
+}
+
+static void remove_java_mirror_in_classes() {
+  for (int i = 0; i < _global_klass_objects->length(); i++) {
+    Klass* k = _global_klass_objects->at(i);
+    if (!k->is_objArray_klass()) {
+      // InstanceKlass and TypeArrayKlass will in turn call remove_unshareable_info
+      // on their array classes.
+      assert(k->is_instance_klass() || k->is_typeArray_klass(), "must be");
+      k->remove_java_mirror();
+    }
   }
 }
 
 static void rewrite_nofast_bytecode(Method* method) {
-  RawBytecodeStream bcs(method);
+  BytecodeStream bcs(method);
   while (!bcs.is_last_bytecode()) {
-    Bytecodes::Code opcode = bcs.raw_next();
+    Bytecodes::Code opcode = bcs.next();
     switch (opcode) {
     case Bytecodes::_getfield:      *bcs.bcp() = Bytecodes::_nofast_getfield;      break;
     case Bytecodes::_putfield:      *bcs.bcp() = Bytecodes::_nofast_putfield;      break;
@@ -446,6 +484,17 @@
   }
 }
 
+NOT_PRODUCT(
+static void assert_not_anonymous_class(InstanceKlass* k) {
+  assert(!(k->is_anonymous()), "cannot archive anonymous classes");
+}
+
+// Anonymous classes are not stored inside any dictionaries. They are created by
+// SystemDictionary::parse_stream() with a non-null host_klass.
+static void assert_no_anonymoys_classes_in_dictionaries() {
+  ClassLoaderDataGraph::dictionary_classes_do(assert_not_anonymous_class);
+})
+
 // Objects of the Metadata types (such as Klass and ConstantPool) have C++ vtables.
 // (In GCC this is the field <Type>::_vptr, i.e., first word in the object.)
 //
@@ -957,8 +1006,8 @@
     }
     memcpy(p, obj, bytes);
     bool isnew = _new_loc_table->put(obj, (address)p);
+    log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes);
     assert(isnew, "must be");
-    log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes);
 
     _alloc_stats->record(ref->msotype(), int(newtop - oldtop), read_only);
     if (ref->msotype() == MetaspaceObj::SymbolType) {
@@ -1151,6 +1200,9 @@
   // Reorder the system dictionary. Moving the symbols affects
   // how the hash table indices are calculated.
   SystemDictionary::reorder_dictionary_for_sharing();
+  tty->print("Removing java_mirror ... ");
+  remove_java_mirror_in_classes();
+  tty->print_cr("done. ");
   NOT_PRODUCT(SystemDictionary::verify();)
 
   size_t buckets_bytes = SystemDictionary::count_bytes_for_buckets();
@@ -1218,11 +1270,20 @@
   rewrite_nofast_bytecodes_and_calculate_fingerprints();
   tty->print_cr("done. ");
 
+  // Move classes from platform/system dictionaries into the boot dictionary
+  SystemDictionary::combine_shared_dictionaries();
+
   // Remove all references outside the metadata
   tty->print("Removing unshareable information ... ");
   remove_unshareable_in_classes();
   tty->print_cr("done. ");
 
+  // We don't support archiving anonymous classes. Verify that they are not stored in
+  // the any dictionaries.
+  NOT_PRODUCT(assert_no_anonymoys_classes_in_dictionaries());
+
+  SystemDictionaryShared::finalize_verification_constraints();
+
   ArchiveCompactor::initialize();
   ArchiveCompactor::copy_and_compact();
 
@@ -1312,6 +1373,14 @@
     ArchiveCompactor::alloc_stats()->print_stats(int(_ro_region.used()), int(_rw_region.used()),
                                                  int(_mc_region.used()), int(_md_region.used()));
   }
+
+  if (PrintSystemDictionaryAtExit) {
+    SystemDictionary::print();
+  }
+  // There may be other pending VM operations that operate on the InstanceKlasses,
+  // which will fail because InstanceKlasses::remove_unshareable_info()
+  // has been called. Forget these operations and exit the VM directly.
+  vm_direct_exit(0);
 }
 
 void VM_PopulateDumpSharedSpace::print_region_stats() {
@@ -1438,10 +1507,6 @@
       exit(1);
     }
   }
-
-  // Copy the verification constraints from C_HEAP-alloced GrowableArrays to RO-alloced
-  // Arrays
-  SystemDictionaryShared::finalize_verification_constraints();
 }
 
 void MetaspaceShared::prepare_for_dumping() {
@@ -1509,17 +1574,11 @@
     link_and_cleanup_shared_classes(CATCH);
     tty->print_cr("Rewriting and linking classes: done");
 
+    SystemDictionary::clear_invoke_method_table();
+
     VM_PopulateDumpSharedSpace op;
     VMThread::execute(&op);
   }
-
-  if (PrintSystemDictionaryAtExit) {
-    SystemDictionary::print();
-  }
-
-  // Since various initialization steps have been undone by this process,
-  // it is not reasonable to continue running a java process.
-  exit(0);
 }
 
 
@@ -1529,8 +1588,14 @@
 
     while (parser.parse_one_line()) {
       Klass* klass = ClassLoaderExt::load_one_class(&parser, THREAD);
-
-      CLEAR_PENDING_EXCEPTION;
+      if (HAS_PENDING_EXCEPTION) {
+        if (klass == NULL &&
+             (PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_ClassNotFoundException())) {
+          // print a warning only when the pending exception is class not found
+          tty->print_cr("Preload Warning: Cannot find %s", parser.current_class_name());
+        }
+        CLEAR_PENDING_EXCEPTION;
+      }
       if (klass != NULL) {
         if (log_is_enabled(Trace, cds)) {
           ResourceMark rm;
--- a/hotspot/src/share/vm/memory/universe.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/memory/universe.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -63,7 +63,6 @@
 #include "runtime/atomic.hpp"
 #include "runtime/commandLineFlagConstraintList.hpp"
 #include "runtime/deoptimization.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/java.hpp"
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -187,12 +187,29 @@
 
 void ArrayKlass::remove_unshareable_info() {
   Klass::remove_unshareable_info();
+  if (_higher_dimension != NULL) {
+    ArrayKlass *ak = ArrayKlass::cast(higher_dimension());
+    ak->remove_unshareable_info();
+  }
+}
+
+void ArrayKlass::remove_java_mirror() {
+  Klass::remove_java_mirror();
+  if (_higher_dimension != NULL) {
+    ArrayKlass *ak = ArrayKlass::cast(higher_dimension());
+    ak->remove_java_mirror();
+  }
 }
 
 void ArrayKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
   assert(loader_data == ClassLoaderData::the_null_class_loader_data(), "array classes belong to null loader");
   Klass::restore_unshareable_info(loader_data, protection_domain, CHECK);
   // Klass recreates the component mirror also
+
+  if (_higher_dimension != NULL) {
+    ArrayKlass *ak = ArrayKlass::cast(higher_dimension());
+    ak->restore_unshareable_info(loader_data, protection_domain, CHECK);
+  }
 }
 
 // Printing
--- a/hotspot/src/share/vm/oops/arrayKlass.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/arrayKlass.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -130,6 +130,7 @@
 
   // CDS support - remove and restore oops from metadata. Oops are not shared.
   virtual void remove_unshareable_info();
+  virtual void remove_java_mirror();
   virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
 
   // Printing
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -89,8 +89,6 @@
 
 void ConstantPool::deallocate_contents(ClassLoaderData* loader_data) {
   if (cache() != NULL) {
-    MetadataFactory::free_array<u2>(loader_data, reference_map());
-    set_reference_map(NULL);
     MetadataFactory::free_metadata(loader_data, cache());
     set_cache(NULL);
   }
@@ -259,10 +257,14 @@
   }
 
   objArrayOop rr = resolved_references();
+  Array<u2>* ref_map = reference_map();
   if (rr != NULL) {
-    for (int i = 0; i < rr->length(); i++) {
+    int ref_map_len = ref_map == NULL ? 0 : ref_map->length();
+    int rr_len = rr->length();
+    for (int i = 0; i < rr_len; i++) {
       oop p = rr->obj_at(i);
-      if (p != NULL) {
+      rr->obj_at_put(i, NULL);
+      if (p != NULL && i < ref_map_len) {
         int index = object_to_cp_index(i);
         // Skip the entry if the string hash code is 0 since the string
         // is not included in the shared string_table, see StringTable::copy_shared_string.
@@ -273,11 +275,10 @@
           // have a 'bad' reference in the archived resolved_reference
           // array.
           rr->obj_at_put(i, op);
-        } else {
-          rr->obj_at_put(i, NULL);
         }
       }
     }
+
     oop archived = MetaspaceShared::archive_heap_object(rr, THREAD);
     _cache->set_archived_references(archived);
     set_resolved_references(NULL);
@@ -348,6 +349,26 @@
   // class redefinition. Since shared ConstantPools cannot be deallocated anyway,
   // we always set _on_stack to true to avoid having to change _flags during runtime.
   _flags |= (_on_stack | _is_shared);
+  int num_klasses = 0;
+  for (int index = 1; index < length(); index++) { // Index 0 is unused
+    assert(!tag_at(index).is_unresolved_klass_in_error(), "This must not happen during dump time");
+    if (tag_at(index).is_klass()) {
+      // This class was resolved as a side effect of executing Java code
+      // during dump time. We need to restore it back to an UnresolvedClass,
+      // so that the proper class loading and initialization can happen
+      // at runtime.
+      CPKlassSlot kslot = klass_slot_at(index);
+      int resolved_klass_index = kslot.resolved_klass_index();
+      int name_index = kslot.name_index();
+      assert(tag_at(name_index).is_symbol(), "sanity");
+      resolved_klasses()->at_put(resolved_klass_index, NULL);
+      tag_at_put(index, JVM_CONSTANT_UnresolvedClass);
+      assert(klass_name_at(index) == symbol_at(name_index), "sanity");
+    }
+  }
+  if (cache() != NULL) {
+    cache()->remove_unshareable_info();
+  }
 }
 
 int ConstantPool::cp_to_object_index(int cp_index) {
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -23,9 +23,12 @@
  */
 
 #include "precompiled.hpp"
+#include "interpreter/bytecodeStream.hpp"
+#include "interpreter/bytecodes.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/rewriter.hpp"
 #include "logging/log.hpp"
+#include "memory/metadataFactory.hpp"
 #include "memory/metaspaceClosure.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.inline.hpp"
@@ -48,6 +51,24 @@
   assert(constant_pool_index() == index, "");
 }
 
+void ConstantPoolCacheEntry::verify_just_initialized(bool f2_used) {
+  assert((_indices & (~cp_index_mask)) == 0, "sanity");
+  assert(_f1 == NULL, "sanity");
+  assert(_flags == 0, "sanity");
+  if (!f2_used) {
+    assert(_f2 == 0, "sanity");
+  }
+}
+
+void ConstantPoolCacheEntry::reinitialize(bool f2_used) {
+  _indices &= cp_index_mask;
+  _f1 = NULL;
+  _flags = 0;
+  if (!f2_used) {
+    _f2 = 0;
+  }
+}
+
 int ConstantPoolCacheEntry::make_flags(TosState state,
                                        int option_bits,
                                        int field_index_or_method_params) {
@@ -608,6 +629,74 @@
   }
 }
 
+void ConstantPoolCache::verify_just_initialized() {
+  DEBUG_ONLY(walk_entries_for_initialization(/*check_only = */ true));
+}
+
+void ConstantPoolCache::remove_unshareable_info() {
+  walk_entries_for_initialization(/*check_only = */ false);
+}
+
+void ConstantPoolCache::walk_entries_for_initialization(bool check_only) {
+  assert(DumpSharedSpaces, "sanity");
+  // When dumping the archive, we want to clean up the ConstantPoolCache
+  // to remove any effect of linking due to the execution of Java code --
+  // each ConstantPoolCacheEntry will have the same contents as if
+  // ConstantPoolCache::initialize has just returned:
+  //
+  // - We keep the ConstantPoolCache::constant_pool_index() bits for all entries.
+  // - We keep the "f2" field for entries used by invokedynamic and invokehandle
+  // - All other bits in the entries are cleared to zero.
+  ResourceMark rm;
+
+  InstanceKlass* ik = constant_pool()->pool_holder();
+  bool* f2_used = NEW_RESOURCE_ARRAY(bool, length());
+  memset(f2_used, 0, sizeof(bool) * length());
+
+  // Find all the slots that we need to preserve f2
+  for (int i = 0; i < ik->methods()->length(); i++) {
+    Method* m = ik->methods()->at(i);
+    RawBytecodeStream bcs(m);
+    while (!bcs.is_last_bytecode()) {
+      Bytecodes::Code opcode = bcs.raw_next();
+      switch (opcode) {
+      case Bytecodes::_invokedynamic: {
+          int index = Bytes::get_native_u4(bcs.bcp() + 1);
+          int cp_cache_index = constant_pool()->invokedynamic_cp_cache_index(index);
+          f2_used[cp_cache_index] = 1;
+        }
+        break;
+      case Bytecodes::_invokehandle: {
+          int cp_cache_index = Bytes::get_native_u2(bcs.bcp() + 1);
+          f2_used[cp_cache_index] = 1;
+        }
+        break;
+      default:
+        break;
+      }
+    }
+  }
+
+  if (check_only) {
+    DEBUG_ONLY(
+      for (int i=0; i<length(); i++) {
+        entry_at(i)->verify_just_initialized(f2_used[i]);
+      })
+  } else {
+    for (int i=0; i<length(); i++) {
+      entry_at(i)->reinitialize(f2_used[i]);
+    }
+  }
+}
+
+void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
+  assert(!is_shared(), "shared caches are not deallocated");
+  data->remove_handle(_resolved_references);
+  set_resolved_references(NULL);
+  MetadataFactory::free_array<u2>(data, _reference_map);
+  set_reference_map(NULL);
+}
+
 #if INCLUDE_CDS_JAVA_HEAP
 oop ConstantPoolCache::archived_references() {
   assert(UseSharedSpaces, "UseSharedSpaces expected.");
--- a/hotspot/src/share/vm/oops/cpCache.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/cpCache.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -393,6 +393,9 @@
     // When shifting flags as a 32-bit int, make sure we don't need an extra mask for tos_state:
     assert((((u4)-1 >> tos_state_shift) & ~tos_state_mask) == 0, "no need for tos_state mask");
   }
+
+  void verify_just_initialized(bool f2_used);
+  void reinitialize(bool f2_used);
 };
 
 
@@ -464,7 +467,11 @@
   // Assembly code support
   static int resolved_references_offset_in_bytes() { return offset_of(ConstantPoolCache, _resolved_references); }
 
+  // CDS support
+  void remove_unshareable_info();
+  void verify_just_initialized();
  private:
+  void walk_entries_for_initialization(bool check_only);
   void set_length(int length)                    { _length = length; }
 
   static int header_size()                       { return sizeof(ConstantPoolCache) / wordSize; }
@@ -510,9 +517,9 @@
   void dump_cache();
 #endif // INCLUDE_JVMTI
 
-  // Deallocate - no fields to deallocate
+  // RedefineClasses support
   DEBUG_ONLY(bool on_stack() { return false; })
-  void deallocate_contents(ClassLoaderData* data) {}
+  void deallocate_contents(ClassLoaderData* data);
   bool is_klass() const { return false; }
 
   // Printing
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -747,10 +747,10 @@
       char* message = NEW_RESOURCE_ARRAY(char, msglen);
       if (NULL == message) {
         // Out of memory: can't create detailed error message
-        THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className);
+          THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className);
       } else {
         jio_snprintf(message, msglen, "%s%s", desc, className);
-        THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), message);
+          THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), message);
       }
     }
 
@@ -2067,14 +2067,14 @@
     m->remove_unshareable_info();
   }
 
+  // do array classes also.
+  if (array_klasses() != NULL) {
+    array_klasses()->remove_unshareable_info();
+  }
+
   // These are not allocated from metaspace, but they should should all be empty
-  // during dump time, so we don't need to worry about them in InstanceKlass::metaspace_pointers_do().
+  // during dump time, so we don't need to worry about them in InstanceKlass::iterate().
   guarantee(_source_debug_extension == NULL, "must be");
-  guarantee(_oop_map_cache == NULL, "must be");
-  guarantee(_init_thread == NULL, "must be");
-  guarantee(_oop_map_cache == NULL, "must be");
-  guarantee(_jni_ids == NULL, "must be");
-  guarantee(_methods_jmethod_ids == NULL, "must be");
   guarantee(_dep_context == DependencyContext::EMPTY, "must be");
   guarantee(_osr_nmethods_head == NULL, "must be");
 
@@ -2082,12 +2082,20 @@
   guarantee(_breakpoints == NULL, "must be");
   guarantee(_previous_versions == NULL, "must be");
 #endif
+
+ _init_thread = NULL;
+ _methods_jmethod_ids = NULL;
+ _jni_ids = NULL;
+ _oop_map_cache = NULL;
 }
 
-static void restore_unshareable_in_class(Klass* k, TRAPS) {
-  // Array classes have null protection domain.
-  // --> see ArrayKlass::complete_create_array_klass()
-  k->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);
+void InstanceKlass::remove_java_mirror() {
+  Klass::remove_java_mirror();
+
+  // do array classes also.
+  if (array_klasses() != NULL) {
+    array_klasses()->remove_java_mirror();
+  }
 }
 
 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
@@ -2114,7 +2122,11 @@
   // restore constant pool resolved references
   constants()->restore_unshareable_info(CHECK);
 
-  array_klasses_do(restore_unshareable_in_class, CHECK);
+  if (array_klasses() != NULL) {
+    // Array classes have null protection domain.
+    // --> see ArrayKlass::complete_create_array_klass()
+    array_klasses()->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK);
+  }
 }
 
 // returns true IFF is_in_error_state() has been changed as a result of this call.
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -327,8 +327,6 @@
   }
 
   void set_class_loader_type(s2 loader_type) {
-    assert(( _misc_flags & loader_type_bits()) == 0,
-           "Should only be called once for each class.");
     switch (loader_type) {
     case ClassLoader::BOOT_LOADER:
       _misc_flags |= _misc_is_shared_boot_class;
@@ -1335,6 +1333,7 @@
 public:
   // CDS support - remove and restore oops from metadata. Oops are not shared.
   virtual void remove_unshareable_info();
+  virtual void remove_java_mirror();
   virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
 
   // jvm support
--- a/hotspot/src/share/vm/oops/klass.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/klass.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -512,11 +512,13 @@
 void Klass::remove_unshareable_info() {
   assert (DumpSharedSpaces, "only called for DumpSharedSpaces");
   TRACE_REMOVE_ID(this);
+  if (log_is_enabled(Trace, cds, unshareable)) {
+    ResourceMark rm;
+    log_trace(cds, unshareable)("remove: %s", external_name());
+  }
 
   set_subklass(NULL);
   set_next_sibling(NULL);
-  // Clear the java mirror
-  set_java_mirror(NULL);
   set_next_link(NULL);
 
   // Null out class_loader_data because we don't share that yet.
@@ -524,10 +526,23 @@
   set_is_shared();
 }
 
+void Klass::remove_java_mirror() {
+  assert (DumpSharedSpaces, "only called for DumpSharedSpaces");
+  if (log_is_enabled(Trace, cds, unshareable)) {
+    ResourceMark rm;
+    log_trace(cds, unshareable)("remove java_mirror: %s", external_name());
+  }
+  set_java_mirror(NULL);
+}
+
 void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) {
   assert(is_klass(), "ensure C++ vtable is restored");
   assert(is_shared(), "must be set");
   TRACE_RESTORE_ID(this);
+  if (log_is_enabled(Trace, cds, unshareable)) {
+    ResourceMark rm;
+    log_trace(cds, unshareable)("restore: %s", external_name());
+  }
 
   // If an exception happened during CDS restore, some of these fields may already be
   // set.  We leave the class on the CLD list, even if incomplete so that we don't
--- a/hotspot/src/share/vm/oops/klass.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/klass.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -479,6 +479,7 @@
 
   // CDS support - remove and restore oops from metadata. Oops are not shared.
   virtual void remove_unshareable_info();
+  virtual void remove_java_mirror();
   virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS);
 
  protected:
--- a/hotspot/src/share/vm/oops/method.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/method.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -944,10 +944,6 @@
   _from_compiled_entry = cds_adapter->get_c2i_entry_trampoline();
   assert(*((int*)_from_compiled_entry) == 0, "must be NULL during dump time, to be initialized at run time");
 
-
-  // In case of DumpSharedSpaces, _method_data should always be NULL.
-  assert(_method_data == NULL, "unexpected method data?");
-
   set_method_data(NULL);
   clear_method_counters();
 }
--- a/hotspot/src/share/vm/oops/oopHandle.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/oops/oopHandle.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -46,6 +46,9 @@
   OopHandle(oop* w) : _obj(w) {}
 
   oop resolve() const { return (_obj == NULL) ? (oop)NULL : *_obj; }
+
+  // Used only for removing handle.
+  oop* ptr_raw() { return _obj; }
 };
 
 #endif // SHARE_VM_OOPS_OOPHANDLE_HPP
--- a/hotspot/src/share/vm/opto/runtime.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/opto/runtime.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -61,7 +61,6 @@
 #include "opto/runtime.hpp"
 #include "opto/subnode.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/javaCalls.hpp"
--- a/hotspot/src/share/vm/prims/jni.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/prims/jni.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -62,7 +62,6 @@
 #include "runtime/atomic.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/fieldDescriptor.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/java.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -2497,14 +2497,13 @@
       library = os::dll_load(agent, ebuf, sizeof ebuf);
     } else {
       // Try to load the agent from the standard dll directory
-      if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
+      if (os::dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(),
                              agent)) {
         library = os::dll_load(buffer, ebuf, sizeof ebuf);
       }
       if (library == NULL) {
-        // not found - try local path
-        char ns[1] = {0};
-        if (os::dll_build_name(buffer, sizeof(buffer), ns, agent)) {
+        // not found - try OS default library path
+        if (os::dll_build_name(buffer, sizeof(buffer), agent)) {
           library = os::dll_load(buffer, ebuf, sizeof ebuf);
         }
       }
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -78,7 +78,6 @@
 char*  Arguments::_java_command                 = NULL;
 SystemProperty* Arguments::_system_properties   = NULL;
 const char*  Arguments::_gc_log_filename        = NULL;
-bool   Arguments::_has_profile                  = false;
 size_t Arguments::_conservative_max_heap_alignment = 0;
 size_t Arguments::_min_heap_size                = 0;
 Arguments::Mode Arguments::_mode                = _mixed;
@@ -379,6 +378,9 @@
   { "MaxGCMinorPauseMillis",        JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() },
   { "UseConcMarkSweepGC",           JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
   { "MonitorInUseLists",            JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() },
+  { "MaxRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
+  { "MinRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
+  { "InitialRAMFraction",           JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
 
   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
@@ -1291,13 +1293,11 @@
                                            "jdk.module.limitmods",
                                            "jdk.module.path",
                                            "jdk.module.upgrade.path",
-                                           "jdk.module.addmods.0",
                                            "jdk.module.patch.0" };
   const char* unsupported_options[] = { "-m", // cannot use at dump time
                                         "--limit-modules", // ignored at dump time
                                         "--module-path", // ignored at dump time
                                         "--upgrade-module-path", // ignored at dump time
-                                        "--add-modules", // ignored at dump time
                                         "--patch-module" // ignored at dump time
                                       };
   assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
@@ -2069,20 +2069,33 @@
     }
   }
 
+  // Convert deprecated flags
+  if (FLAG_IS_DEFAULT(MaxRAMPercentage) &&
+      !FLAG_IS_DEFAULT(MaxRAMFraction))
+    MaxRAMPercentage = 100.0 / MaxRAMFraction;
+
+  if (FLAG_IS_DEFAULT(MinRAMPercentage) &&
+      !FLAG_IS_DEFAULT(MinRAMFraction))
+    MinRAMPercentage = 100.0 / MinRAMFraction;
+
+  if (FLAG_IS_DEFAULT(InitialRAMPercentage) &&
+      !FLAG_IS_DEFAULT(InitialRAMFraction))
+    InitialRAMPercentage = 100.0 / InitialRAMFraction;
+
   // If the maximum heap size has not been set with -Xmx,
   // then set it as fraction of the size of physical memory,
   // respecting the maximum and minimum sizes of the heap.
   if (FLAG_IS_DEFAULT(MaxHeapSize)) {
-    julong reasonable_max = phys_mem / MaxRAMFraction;
-
-    if (phys_mem <= MaxHeapSize * MinRAMFraction) {
+    julong reasonable_max = (julong)((phys_mem * MaxRAMPercentage) / 100);
+    if (phys_mem <= (julong)((MaxHeapSize * MinRAMPercentage) / 100)) {
       // Small physical memory, so use a minimum fraction of it for the heap
-      reasonable_max = phys_mem / MinRAMFraction;
+      reasonable_max = (julong)((phys_mem * MinRAMPercentage) / 100);
     } else {
       // Not-small physical memory, so require a heap at least
       // as large as MaxHeapSize
       reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize);
     }
+
     if (!FLAG_IS_DEFAULT(ErgoHeapSizeLimit) && ErgoHeapSizeLimit != 0) {
       // Limit the heap size to ErgoHeapSizeLimit
       reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit);
@@ -2135,7 +2148,7 @@
     reasonable_minimum = limit_by_allocatable_memory(reasonable_minimum);
 
     if (InitialHeapSize == 0) {
-      julong reasonable_initial = phys_mem / InitialRAMFraction;
+      julong reasonable_initial = (julong)((phys_mem * InitialRAMPercentage) / 100);
 
       reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)min_heap_size());
       reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize);
@@ -2667,17 +2680,11 @@
   }
 
   // Do final processing now that all arguments have been parsed
-  result = finalize_vm_init_args();
+  result = finalize_vm_init_args(patch_mod_javabase);
   if (result != JNI_OK) {
     return result;
   }
 
-#if INCLUDE_CDS
-  if (UseSharedSpaces && patch_mod_javabase) {
-    no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
-  }
-#endif
-
   return JNI_OK;
 }
 
@@ -3152,16 +3159,12 @@
       if (FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true) != Flag::SUCCESS) {
         return JNI_EINVAL;
       }
-    // -Xprof
+      // -Xprof
     } else if (match_option(option, "-Xprof")) {
-#if INCLUDE_FPROF
-      log_warning(arguments)("Option -Xprof was deprecated in version 9 and will likely be removed in a future release.");
-      _has_profile = true;
-#else // INCLUDE_FPROF
-      jio_fprintf(defaultStream::error_stream(),
-        "Flat profiling is not supported in this VM.\n");
-      return JNI_ERR;
-#endif // INCLUDE_FPROF
+      char version[256];
+      // Obsolete in JDK 10
+      JDK_Version::jdk(10).to_string(version, sizeof(version));
+      warning("Ignoring option %s; support was removed in %s", option->optionString, version);
     // -Xconcurrentio
     } else if (match_option(option, "-Xconcurrentio")) {
       if (FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true) != Flag::SUCCESS) {
@@ -3602,7 +3605,7 @@
   return nonEmptyDirs;
 }
 
-jint Arguments::finalize_vm_init_args() {
+jint Arguments::finalize_vm_init_args(bool patch_mod_javabase) {
   // check if the default lib/endorsed directory exists; if so, error
   char path[JVM_MAXPATHLEN];
   const char* fileSep = os::file_separator();
@@ -3723,6 +3726,17 @@
   }
 #endif
 
+#if INCLUDE_CDS
+  if (DumpSharedSpaces) {
+    // Disable biased locking now as it interferes with the clean up of
+    // the archived Klasses and Java string objects (at dump time only).
+    UseBiasedLocking = false;
+  }
+  if (UseSharedSpaces && patch_mod_javabase) {
+    no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched.");
+  }
+#endif
+
   return JNI_OK;
 }
 
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -412,7 +412,6 @@
   static bool   _sun_java_launcher_is_altjvm;
 
   // Option flags
-  static bool   _has_profile;
   static const char*  _gc_log_filename;
   // Value of the conservative maximum heap alignment needed
   static size_t  _conservative_max_heap_alignment;
@@ -536,7 +535,7 @@
                                  const JavaVMInitArgs *java_options_args,
                                  const JavaVMInitArgs *cmd_line_args);
   static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, Flag::Flags origin);
-  static jint finalize_vm_init_args();
+  static jint finalize_vm_init_args(bool patch_mod_javabase);
   static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type);
 
   static bool is_bad_option(const JavaVMOption* option, jboolean ignore) {
@@ -696,9 +695,6 @@
   // -Dsun.java.launcher.pid
   static int sun_java_launcher_pid()        { return _sun_java_launcher_pid; }
 
-  // -Xprof
-  static bool has_profile()                 { return _has_profile; }
-
   // -Xms
   static size_t min_heap_size()             { return _min_heap_size; }
   static void  set_min_heap_size(size_t v)  { _min_heap_size = v;  }
--- a/hotspot/src/share/vm/runtime/arguments_ext.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/arguments_ext.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -36,6 +36,7 @@
   // Otherwise returns false.
   static inline bool process_options(const JavaVMOption *option) { return false; }
   static inline void report_unsupported_options() { }
+  static inline bool using_AppCDS() { return false; }
 };
 
 void ArgumentsExt::set_gc_specific_flags() {
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1623 +0,0 @@
-/*
- * Copyright (c) 1997, 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.
- *
- */
-
-#include "precompiled.hpp"
-#include "classfile/classLoader.hpp"
-#include "code/codeCache.hpp"
-#include "code/vtableStubs.hpp"
-#include "gc/shared/collectedHeap.inline.hpp"
-#include "interpreter/interpreter.hpp"
-#include "memory/allocation.inline.hpp"
-#include "memory/resourceArea.hpp"
-#include "memory/universe.inline.hpp"
-#include "oops/oop.inline.hpp"
-#include "oops/symbol.hpp"
-#include "runtime/deoptimization.hpp"
-#include "runtime/fprofiler.hpp"
-#include "runtime/mutexLocker.hpp"
-#include "runtime/stubCodeGenerator.hpp"
-#include "runtime/stubRoutines.hpp"
-#include "runtime/task.hpp"
-#include "runtime/thread.inline.hpp"
-#include "runtime/vframe.hpp"
-#include "utilities/macros.hpp"
-
-// Static fields of FlatProfiler
-int               FlatProfiler::received_gc_ticks   = 0;
-int               FlatProfiler::vm_operation_ticks  = 0;
-int               FlatProfiler::threads_lock_ticks  = 0;
-int               FlatProfiler::class_loader_ticks  = 0;
-int               FlatProfiler::extra_ticks         = 0;
-int               FlatProfiler::blocked_ticks       = 0;
-int               FlatProfiler::deopt_ticks         = 0;
-int               FlatProfiler::unknown_ticks       = 0;
-int               FlatProfiler::interpreter_ticks   = 0;
-int               FlatProfiler::compiler_ticks      = 0;
-int               FlatProfiler::received_ticks      = 0;
-int               FlatProfiler::delivered_ticks     = 0;
-int*              FlatProfiler::bytecode_ticks      = NULL;
-int*              FlatProfiler::bytecode_ticks_stub = NULL;
-int               FlatProfiler::all_int_ticks       = 0;
-int               FlatProfiler::all_comp_ticks      = 0;
-int               FlatProfiler::all_ticks           = 0;
-bool              FlatProfiler::full_profile_flag   = false;
-ThreadProfiler*   FlatProfiler::thread_profiler     = NULL;
-ThreadProfiler*   FlatProfiler::vm_thread_profiler  = NULL;
-FlatProfilerTask* FlatProfiler::task                = NULL;
-elapsedTimer      FlatProfiler::timer;
-int               FlatProfiler::interval_ticks_previous = 0;
-IntervalData*     FlatProfiler::interval_data       = NULL;
-
-ThreadProfiler::ThreadProfiler() {
-  // Space for the ProfilerNodes
-  const int area_size = 1 * ProfilerNodeSize * 1024;
-  area_bottom = AllocateHeap(area_size, mtInternal);
-  area_top    = area_bottom;
-  area_limit  = area_bottom + area_size;
-
-  // ProfilerNode pointer table
-  table = NEW_C_HEAP_ARRAY(ProfilerNode*, table_size, mtInternal);
-  initialize();
-  engaged = false;
-}
-
-ThreadProfiler::~ThreadProfiler() {
-  FreeHeap(area_bottom);
-  area_bottom = NULL;
-  area_top = NULL;
-  area_limit = NULL;
-  FreeHeap(table);
-  table = NULL;
-}
-
-// Statics for ThreadProfiler
-int ThreadProfiler::table_size = 1024;
-
-int ThreadProfiler::entry(int  value) {
-  value = (value > 0) ? value : -value;
-  return value % table_size;
-}
-
-ThreadProfilerMark::ThreadProfilerMark(ThreadProfilerMark::Region r) {
-  _r = r;
-  _pp = NULL;
-  assert(((r > ThreadProfilerMark::noRegion) && (r < ThreadProfilerMark::maxRegion)), "ThreadProfilerMark::Region out of bounds");
-  Thread* tp = Thread::current();
-  if (tp != NULL && tp->is_Java_thread()) {
-    JavaThread* jtp = (JavaThread*) tp;
-    ThreadProfiler* pp = jtp->get_thread_profiler();
-    _pp = pp;
-    if (pp != NULL) {
-      pp->region_flag[r] = true;
-    }
-  }
-}
-
-ThreadProfilerMark::~ThreadProfilerMark() {
-  if (_pp != NULL) {
-    _pp->region_flag[_r] = false;
-  }
-  _pp = NULL;
-}
-
-// Random other statics
-static const int col1 = 2;      // position of output column 1
-static const int col2 = 11;     // position of output column 2
-static const int col3 = 25;     // position of output column 3
-static const int col4 = 55;     // position of output column 4
-
-
-// Used for detailed profiling of nmethods.
-class PCRecorder : AllStatic {
- private:
-  static int*    counters;
-  static address base;
-  enum {
-   bucket_size = 16
-  };
-  static int     index_for(address pc) { return (pc - base)/bucket_size;   }
-  static address pc_for(int index)     { return base + (index * bucket_size); }
-  static int     size() {
-    return ((int)CodeCache::max_capacity())/bucket_size * BytesPerWord;
-  }
- public:
-  static address bucket_start_for(address pc) {
-    if (counters == NULL) return NULL;
-    return pc_for(index_for(pc));
-  }
-  static int bucket_count_for(address pc)  { return counters[index_for(pc)]; }
-  static void init();
-  static void record(address pc);
-  static void print();
-  static void print_blobs(CodeBlob* cb);
-};
-
-int*    PCRecorder::counters = NULL;
-address PCRecorder::base     = NULL;
-
-void PCRecorder::init() {
-  MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-  int s = size();
-  counters = NEW_C_HEAP_ARRAY(int, s, mtInternal);
-  for (int index = 0; index < s; index++) {
-    counters[index] = 0;
-  }
-  base = CodeCache::low_bound();
-}
-
-void PCRecorder::record(address pc) {
-  if (counters == NULL) return;
-  assert(CodeCache::contains(pc), "must be in CodeCache");
-  counters[index_for(pc)]++;
-}
-
-
-address FlatProfiler::bucket_start_for(address pc) {
-  return PCRecorder::bucket_start_for(pc);
-}
-
-int FlatProfiler::bucket_count_for(address pc) {
-  return PCRecorder::bucket_count_for(pc);
-}
-
-void PCRecorder::print() {
-  if (counters == NULL) return;
-
-  tty->cr();
-  tty->print_cr("Printing compiled methods with PC buckets having more than " INTX_FORMAT " ticks", ProfilerPCTickThreshold);
-  tty->print_cr("===================================================================");
-  tty->cr();
-
-  GrowableArray<CodeBlob*>* candidates = new GrowableArray<CodeBlob*>(20);
-
-
-  int s;
-  {
-    MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-    s = size();
-  }
-
-  for (int index = 0; index < s; index++) {
-    int count = counters[index];
-    if (count > ProfilerPCTickThreshold) {
-      address pc = pc_for(index);
-      CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
-      if (cb != NULL && candidates->find(cb) < 0) {
-        candidates->push(cb);
-      }
-    }
-  }
-  for (int i = 0; i < candidates->length(); i++) {
-    print_blobs(candidates->at(i));
-  }
-}
-
-void PCRecorder::print_blobs(CodeBlob* cb) {
-  if (cb != NULL) {
-    cb->print();
-    if (cb->is_nmethod()) {
-      ((nmethod*)cb)->print_code();
-    }
-    tty->cr();
-  } else {
-    tty->print_cr("stub code");
-  }
-}
-
-class tick_counter {            // holds tick info for one node
- public:
-  int ticks_in_code;
-  int ticks_in_native;
-
-  tick_counter()                     {  ticks_in_code = ticks_in_native = 0; }
-  tick_counter(int code, int native) {  ticks_in_code = code; ticks_in_native = native; }
-
-  int total() const {
-    return (ticks_in_code + ticks_in_native);
-  }
-
-  void add(tick_counter* a) {
-    ticks_in_code += a->ticks_in_code;
-    ticks_in_native += a->ticks_in_native;
-  }
-
-  void update(TickPosition where) {
-    switch(where) {
-      case tp_code:     ticks_in_code++;       break;
-      case tp_native:   ticks_in_native++;      break;
-    }
-  }
-
-  void print_code(outputStream* st, int total_ticks) {
-    st->print("%5.1f%% %5d ", total() * 100.0 / total_ticks, ticks_in_code);
-  }
-
-  void print_native(outputStream* st) {
-    st->print(" + %5d ", ticks_in_native);
-  }
-};
-
-class ProfilerNode {
- private:
-  ProfilerNode* _next;
- public:
-  tick_counter ticks;
-
- public:
-
-  void* operator new(size_t size, ThreadProfiler* tp) throw();
-  void  operator delete(void* p);
-
-  ProfilerNode() {
-    _next = NULL;
-  }
-
-  virtual ~ProfilerNode() {
-    if (_next)
-      delete _next;
-  }
-
-  void set_next(ProfilerNode* n) { _next = n; }
-  ProfilerNode* next()           { return _next; }
-
-  void update(TickPosition where) { ticks.update(where);}
-  int total_ticks() { return ticks.total(); }
-
-  virtual bool is_interpreted() const { return false; }
-  virtual bool is_compiled()    const { return false; }
-  virtual bool is_stub()        const { return false; }
-  virtual bool is_runtime_stub() const{ return false; }
-  virtual void oops_do(OopClosure* f) = 0;
-
-  virtual bool interpreted_match(Method* m) const { return false; }
-  virtual bool compiled_match(Method* m ) const { return false; }
-  virtual bool stub_match(Method* m, const char* name) const { return false; }
-  virtual bool adapter_match() const { return false; }
-  virtual bool runtimeStub_match(const CodeBlob* stub, const char* name) const { return false; }
-  virtual bool unknown_compiled_match(const CodeBlob* cb) const { return false; }
-
-  static void print_title(outputStream* st) {
-    st->print(" + native");
-    st->fill_to(col3);
-    st->print("Method");
-    st->fill_to(col4);
-    st->cr();
-  }
-
-  static void print_total(outputStream* st, tick_counter* t, int total, const char* msg) {
-    t->print_code(st, total);
-    st->fill_to(col2);
-    t->print_native(st);
-    st->fill_to(col3);
-    st->print("%s", msg);
-    st->cr();
-  }
-
-  virtual Method* method()         = 0;
-
-  virtual void print_method_on(outputStream* st) {
-    int limit;
-    int i;
-    Method* m = method();
-    Symbol* k = m->klass_name();
-    // Print the class name with dots instead of slashes
-    limit = k->utf8_length();
-    for (i = 0 ; i < limit ; i += 1) {
-      char c = (char) k->byte_at(i);
-      if (c == '/') {
-        c = '.';
-      }
-      st->print("%c", c);
-    }
-    if (limit > 0) {
-      st->print(".");
-    }
-    Symbol* n = m->name();
-    limit = n->utf8_length();
-    for (i = 0 ; i < limit ; i += 1) {
-      char c = (char) n->byte_at(i);
-      st->print("%c", c);
-    }
-    if (Verbose || WizardMode) {
-      // Disambiguate overloaded methods
-      Symbol* sig = m->signature();
-      sig->print_symbol_on(st);
-    } else if (MethodHandles::is_signature_polymorphic(m->intrinsic_id()))
-      // compare with Method::print_short_name
-      MethodHandles::print_as_basic_type_signature_on(st, m->signature(), true);
-  }
-
-  virtual void print(outputStream* st, int total_ticks) {
-    ticks.print_code(st, total_ticks);
-    st->fill_to(col2);
-    ticks.print_native(st);
-    st->fill_to(col3);
-    print_method_on(st);
-    st->cr();
-  }
-
-  // for hashing into the table
-  static int hash(Method* method) {
-      // The point here is to try to make something fairly unique
-      // out of the fields we can read without grabbing any locks
-      // since the method may be locked when we need the hash.
-      return (
-          method->code_size() ^
-          method->max_stack() ^
-          method->max_locals() ^
-          method->size_of_parameters());
-  }
-
-  // for sorting
-  static int compare(ProfilerNode** a, ProfilerNode** b) {
-    return (*b)->total_ticks() - (*a)->total_ticks();
-  }
-};
-
-void* ProfilerNode::operator new(size_t size, ThreadProfiler* tp) throw() {
-  void* result = (void*) tp->area_top;
-  tp->area_top += size;
-
-  if (tp->area_top > tp->area_limit) {
-    fatal("flat profiler buffer overflow");
-  }
-  return result;
-}
-
-void ProfilerNode::operator delete(void* p){
-}
-
-class interpretedNode : public ProfilerNode {
- private:
-   Method* _method;
-   oop       _class_loader;  // needed to keep metadata for the method alive
- public:
-   interpretedNode(Method* method, TickPosition where) : ProfilerNode() {
-     _method = method;
-     _class_loader = method->method_holder()->class_loader();
-     update(where);
-   }
-
-   bool is_interpreted() const { return true; }
-
-   bool interpreted_match(Method* m) const {
-      return _method == m;
-   }
-
-   void oops_do(OopClosure* f) {
-     f->do_oop(&_class_loader);
-   }
-
-   Method* method() { return _method; }
-
-   static void print_title(outputStream* st) {
-     st->fill_to(col1);
-     st->print("%11s", "Interpreted");
-     ProfilerNode::print_title(st);
-   }
-
-   void print(outputStream* st, int total_ticks) {
-     ProfilerNode::print(st, total_ticks);
-   }
-
-   void print_method_on(outputStream* st) {
-     ProfilerNode::print_method_on(st);
-     MethodCounters* mcs = method()->method_counters();
-     if (Verbose && mcs != NULL) mcs->invocation_counter()->print_short();
-   }
-};
-
-class compiledNode : public ProfilerNode {
- private:
-   Method* _method;
-   oop       _class_loader;  // needed to keep metadata for the method alive
- public:
-   compiledNode(Method* method, TickPosition where) : ProfilerNode() {
-     _method = method;
-     _class_loader = method->method_holder()->class_loader();
-     update(where);
-  }
-  bool is_compiled()    const { return true; }
-
-  bool compiled_match(Method* m) const {
-    return _method == m;
-  }
-
-  Method* method()         { return _method; }
-
-  void oops_do(OopClosure* f) {
-    f->do_oop(&_class_loader);
-  }
-
-  static void print_title(outputStream* st) {
-    st->fill_to(col1);
-    st->print("%11s", "Compiled");
-    ProfilerNode::print_title(st);
-  }
-
-  void print(outputStream* st, int total_ticks) {
-    ProfilerNode::print(st, total_ticks);
-  }
-
-  void print_method_on(outputStream* st) {
-    ProfilerNode::print_method_on(st);
-  }
-};
-
-class stubNode : public ProfilerNode {
- private:
-  Method* _method;
-  oop       _class_loader;  // needed to keep metadata for the method alive
-  const char* _symbol;   // The name of the nearest VM symbol (for +ProfileVM). Points to a unique string
- public:
-   stubNode(Method* method, const char* name, TickPosition where) : ProfilerNode() {
-     _method = method;
-     _class_loader = method->method_holder()->class_loader();
-     _symbol = name;
-     update(where);
-   }
-
-   bool is_stub() const { return true; }
-
-   void oops_do(OopClosure* f) {
-     f->do_oop(&_class_loader);
-   }
-
-   bool stub_match(Method* m, const char* name) const {
-     return (_method == m) && (_symbol == name);
-   }
-
-   Method* method() { return _method; }
-
-   static void print_title(outputStream* st) {
-     st->fill_to(col1);
-     st->print("%11s", "Stub");
-     ProfilerNode::print_title(st);
-   }
-
-   void print(outputStream* st, int total_ticks) {
-     ProfilerNode::print(st, total_ticks);
-   }
-
-   void print_method_on(outputStream* st) {
-     ProfilerNode::print_method_on(st);
-     print_symbol_on(st);
-   }
-
-  void print_symbol_on(outputStream* st) {
-    if(_symbol) {
-      st->print("  (%s)", _symbol);
-    }
-  }
-};
-
-class adapterNode : public ProfilerNode {
- public:
-   adapterNode(TickPosition where) : ProfilerNode() {
-     update(where);
-  }
-  bool is_compiled()    const { return true; }
-
-  bool adapter_match() const { return true; }
-
-  Method* method()         { return NULL; }
-
-  void oops_do(OopClosure* f) {
-    ;
-  }
-
-  void print(outputStream* st, int total_ticks) {
-    ProfilerNode::print(st, total_ticks);
-  }
-
-  void print_method_on(outputStream* st) {
-    st->print("%s", "adapters");
-  }
-};
-
-class runtimeStubNode : public ProfilerNode {
- private:
-  const RuntimeStub* _stub;
-  const char* _symbol;     // The name of the nearest VM symbol when ProfileVM is on. Points to a unique string.
- public:
-   runtimeStubNode(const CodeBlob* stub, const char* name, TickPosition where) : ProfilerNode(), _stub(NULL),  _symbol(name) {
-     assert(stub->is_runtime_stub(), "wrong code blob");
-     _stub = (RuntimeStub*) stub;
-     update(where);
-   }
-
-  bool is_runtime_stub() const { return true; }
-
-  bool runtimeStub_match(const CodeBlob* stub, const char* name) const {
-    assert(stub->is_runtime_stub(), "wrong code blob");
-    return _stub->entry_point() == ((RuntimeStub*)stub)->entry_point() &&
-            (_symbol == name);
-  }
-
-  Method* method() { return NULL; }
-
-  static void print_title(outputStream* st) {
-    st->fill_to(col1);
-    st->print("%11s", "Runtime stub");
-    ProfilerNode::print_title(st);
-  }
-
-  void oops_do(OopClosure* f) {
-    ;
-  }
-
-  void print(outputStream* st, int total_ticks) {
-    ProfilerNode::print(st, total_ticks);
-  }
-
-  void print_method_on(outputStream* st) {
-    st->print("%s", _stub->name());
-    print_symbol_on(st);
-  }
-
-  void print_symbol_on(outputStream* st) {
-    if(_symbol) {
-      st->print("  (%s)", _symbol);
-    }
-  }
-};
-
-
-class unknown_compiledNode : public ProfilerNode {
- const char *_name;
- public:
-   unknown_compiledNode(const CodeBlob* cb, TickPosition where) : ProfilerNode() {
-     if ( cb->is_buffer_blob() )
-       _name = ((const BufferBlob*)cb)->name();
-     else
-       _name = ((const SingletonBlob*)cb)->name();
-     update(where);
-  }
-  bool is_compiled()    const { return true; }
-
-  bool unknown_compiled_match(const CodeBlob* cb) const {
-     if ( cb->is_buffer_blob() )
-       return !strcmp(((const BufferBlob*)cb)->name(), _name);
-     else
-       return !strcmp(((const SingletonBlob*)cb)->name(), _name);
-  }
-
-  Method* method()         { return NULL; }
-
-  void oops_do(OopClosure* f) {
-    ;
-  }
-
-  void print(outputStream* st, int total_ticks) {
-    ProfilerNode::print(st, total_ticks);
-  }
-
-  void print_method_on(outputStream* st) {
-    st->print("%s", _name);
-  }
-};
-
-class vmNode : public ProfilerNode {
- private:
-  const char* _name; // "optional" name obtained by os means such as dll lookup
- public:
-  vmNode(const TickPosition where) : ProfilerNode() {
-    _name = NULL;
-    update(where);
-  }
-
-  vmNode(const char* name, const TickPosition where) : ProfilerNode() {
-    _name = os::strdup(name);
-    update(where);
-  }
-
-  ~vmNode() {
-    if (_name != NULL) {
-      os::free((void*)_name);
-    }
-  }
-
-  const char *name()    const { return _name; }
-  bool is_compiled()    const { return true; }
-
-  bool vm_match(const char* name) const { return strcmp(name, _name) == 0; }
-
-  Method* method()          { return NULL; }
-
-  static int hash(const char* name){
-    // Compute a simple hash
-    const char* cp = name;
-    int h = 0;
-
-    if(name != NULL){
-      while(*cp != '\0'){
-        h = (h << 1) ^ *cp;
-        cp++;
-      }
-    }
-    return h;
-  }
-
-  void oops_do(OopClosure* f) {
-    ;
-  }
-
-  void print(outputStream* st, int total_ticks) {
-    ProfilerNode::print(st, total_ticks);
-  }
-
-  void print_method_on(outputStream* st) {
-    if(_name==NULL){
-      st->print("%s", "unknown code");
-    }
-    else {
-      st->print("%s", _name);
-    }
-  }
-};
-
-void ThreadProfiler::interpreted_update(Method* method, TickPosition where) {
-  int index = entry(ProfilerNode::hash(method));
-  if (!table[index]) {
-    table[index] = new (this) interpretedNode(method, where);
-  } else {
-    ProfilerNode* prev = table[index];
-    for(ProfilerNode* node = prev; node; node = node->next()) {
-      if (node->interpreted_match(method)) {
-        node->update(where);
-        return;
-      }
-      prev = node;
-    }
-    prev->set_next(new (this) interpretedNode(method, where));
-  }
-}
-
-void ThreadProfiler::compiled_update(Method* method, TickPosition where) {
-  int index = entry(ProfilerNode::hash(method));
-  if (!table[index]) {
-    table[index] = new (this) compiledNode(method, where);
-  } else {
-    ProfilerNode* prev = table[index];
-    for(ProfilerNode* node = prev; node; node = node->next()) {
-      if (node->compiled_match(method)) {
-        node->update(where);
-        return;
-      }
-      prev = node;
-    }
-    prev->set_next(new (this) compiledNode(method, where));
-  }
-}
-
-void ThreadProfiler::stub_update(Method* method, const char* name, TickPosition where) {
-  int index = entry(ProfilerNode::hash(method));
-  if (!table[index]) {
-    table[index] = new (this) stubNode(method, name, where);
-  } else {
-    ProfilerNode* prev = table[index];
-    for(ProfilerNode* node = prev; node; node = node->next()) {
-      if (node->stub_match(method, name)) {
-        node->update(where);
-        return;
-      }
-      prev = node;
-    }
-    prev->set_next(new (this) stubNode(method, name, where));
-  }
-}
-
-void ThreadProfiler::adapter_update(TickPosition where) {
-  int index = 0;
-  if (!table[index]) {
-    table[index] = new (this) adapterNode(where);
-  } else {
-    ProfilerNode* prev = table[index];
-    for(ProfilerNode* node = prev; node; node = node->next()) {
-      if (node->adapter_match()) {
-        node->update(where);
-        return;
-      }
-      prev = node;
-    }
-    prev->set_next(new (this) adapterNode(where));
-  }
-}
-
-void ThreadProfiler::runtime_stub_update(const CodeBlob* stub, const char* name, TickPosition where) {
-  int index = 0;
-  if (!table[index]) {
-    table[index] = new (this) runtimeStubNode(stub, name, where);
-  } else {
-    ProfilerNode* prev = table[index];
-    for(ProfilerNode* node = prev; node; node = node->next()) {
-      if (node->runtimeStub_match(stub, name)) {
-        node->update(where);
-        return;
-      }
-      prev = node;
-    }
-    prev->set_next(new (this) runtimeStubNode(stub, name, where));
-  }
-}
-
-
-void ThreadProfiler::unknown_compiled_update(const CodeBlob* cb, TickPosition where) {
-  int index = 0;
-  if (!table[index]) {
-    table[index] = new (this) unknown_compiledNode(cb, where);
-  } else {
-    ProfilerNode* prev = table[index];
-    for(ProfilerNode* node = prev; node; node = node->next()) {
-      if (node->unknown_compiled_match(cb)) {
-        node->update(where);
-        return;
-      }
-      prev = node;
-    }
-    prev->set_next(new (this) unknown_compiledNode(cb, where));
-  }
-}
-
-void ThreadProfiler::vm_update(TickPosition where) {
-  vm_update(NULL, where);
-}
-
-void ThreadProfiler::vm_update(const char* name, TickPosition where) {
-  int index = entry(vmNode::hash(name));
-  assert(index >= 0, "Must be positive");
-  // Note that we call strdup below since the symbol may be resource allocated
-  if (!table[index]) {
-    table[index] = new (this) vmNode(name, where);
-  } else {
-    ProfilerNode* prev = table[index];
-    for(ProfilerNode* node = prev; node; node = node->next()) {
-      if (((vmNode *)node)->vm_match(name)) {
-        node->update(where);
-        return;
-      }
-      prev = node;
-    }
-    prev->set_next(new (this) vmNode(name, where));
-  }
-}
-
-
-class FlatProfilerTask : public PeriodicTask {
-public:
-  FlatProfilerTask(int interval_time) : PeriodicTask(interval_time) {}
-  void task();
-};
-
-void FlatProfiler::record_vm_operation() {
-  if (Universe::heap()->is_gc_active()) {
-    FlatProfiler::received_gc_ticks += 1;
-    return;
-  }
-
-  if (DeoptimizationMarker::is_active()) {
-    FlatProfiler::deopt_ticks += 1;
-    return;
-  }
-
-  FlatProfiler::vm_operation_ticks += 1;
-}
-
-void FlatProfiler::record_vm_tick() {
-  // Profile the VM Thread itself if needed
-  // This is done without getting the Threads_lock and we can go deep
-  // inside Safepoint, etc.
-  if( ProfileVM  ) {
-    ResourceMark rm;
-    ExtendedPC epc;
-    const char *name = NULL;
-    char buf[256];
-    buf[0] = '\0';
-
-    vm_thread_profiler->inc_thread_ticks();
-
-    // Get a snapshot of a current VMThread pc (and leave it running!)
-    // The call may fail in some circumstances
-    epc = os::get_thread_pc(VMThread::vm_thread());
-    if(epc.pc() != NULL) {
-      if (os::dll_address_to_function_name(epc.pc(), buf, sizeof(buf), NULL)) {
-         name = buf;
-      }
-    }
-    if (name != NULL) {
-      vm_thread_profiler->vm_update(name, tp_native);
-    }
-  }
-}
-
-void FlatProfiler::record_thread_ticks() {
-
-  int maxthreads, suspendedthreadcount;
-  JavaThread** threadsList;
-  bool interval_expired = false;
-
-  if (ProfileIntervals &&
-      (FlatProfiler::received_ticks >= interval_ticks_previous + ProfileIntervalsTicks)) {
-    interval_expired = true;
-    interval_ticks_previous = FlatProfiler::received_ticks;
-  }
-
-  // Try not to wait for the Threads_lock
-  if (Threads_lock->try_lock()) {
-    {  // Threads_lock scope
-      maxthreads = Threads::number_of_threads();
-      threadsList = NEW_C_HEAP_ARRAY(JavaThread *, maxthreads, mtInternal);
-      suspendedthreadcount = 0;
-      for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) {
-        if (tp->is_Compiler_thread()) {
-          // Only record ticks for active compiler threads
-          CompilerThread* cthread = (CompilerThread*)tp;
-          if (cthread->task() != NULL) {
-            // The compiler is active.  If we need to access any of the fields
-            // of the compiler task we should suspend the CompilerThread first.
-            FlatProfiler::compiler_ticks += 1;
-            continue;
-          }
-        }
-
-        // First externally suspend all threads by marking each for
-        // external suspension - so it will stop at its next transition
-        // Then do a safepoint
-        ThreadProfiler* pp = tp->get_thread_profiler();
-        if (pp != NULL && pp->engaged) {
-          MutexLockerEx ml(tp->SR_lock(), Mutex::_no_safepoint_check_flag);
-          if (!tp->is_external_suspend() && !tp->is_exiting()) {
-            tp->set_external_suspend();
-            threadsList[suspendedthreadcount++] = tp;
-          }
-        }
-      }
-      Threads_lock->unlock();
-    }
-    // Suspend each thread. This call should just return
-    // for any threads that have already self-suspended
-    // Net result should be one safepoint
-    for (int j = 0; j < suspendedthreadcount; j++) {
-      JavaThread *tp = threadsList[j];
-      if (tp) {
-        tp->java_suspend();
-      }
-    }
-
-    // We are responsible for resuming any thread on this list
-    for (int i = 0; i < suspendedthreadcount; i++) {
-      JavaThread *tp = threadsList[i];
-      if (tp) {
-        ThreadProfiler* pp = tp->get_thread_profiler();
-        if (pp != NULL && pp->engaged) {
-          HandleMark hm;
-          FlatProfiler::delivered_ticks += 1;
-          if (interval_expired) {
-          FlatProfiler::interval_record_thread(pp);
-          }
-          // This is the place where we check to see if a user thread is
-          // blocked waiting for compilation.
-          if (tp->blocked_on_compilation()) {
-            pp->compiler_ticks += 1;
-            pp->interval_data_ref()->inc_compiling();
-          } else {
-            pp->record_tick(tp);
-          }
-        }
-        MutexLocker ml(Threads_lock);
-        tp->java_resume();
-      }
-    }
-    if (interval_expired) {
-      FlatProfiler::interval_print();
-      FlatProfiler::interval_reset();
-    }
-
-    FREE_C_HEAP_ARRAY(JavaThread *, threadsList);
-  } else {
-    // Couldn't get the threads lock, just record that rather than blocking
-    FlatProfiler::threads_lock_ticks += 1;
-  }
-
-}
-
-void FlatProfilerTask::task() {
-  FlatProfiler::received_ticks += 1;
-
-  if (ProfileVM) {
-    FlatProfiler::record_vm_tick();
-  }
-
-  VM_Operation* op = VMThread::vm_operation();
-  if (op != NULL) {
-    FlatProfiler::record_vm_operation();
-    if (SafepointSynchronize::is_at_safepoint()) {
-      return;
-    }
-  }
-  FlatProfiler::record_thread_ticks();
-}
-
-void ThreadProfiler::record_interpreted_tick(JavaThread* thread, frame fr, TickPosition where, int* ticks) {
-  FlatProfiler::all_int_ticks++;
-  if (!FlatProfiler::full_profile()) {
-    return;
-  }
-
-  if (!fr.is_interpreted_frame_valid(thread)) {
-    // tick came at a bad time
-    interpreter_ticks += 1;
-    FlatProfiler::interpreter_ticks += 1;
-    return;
-  }
-
-  // The frame has been fully validated so we can trust the method and bci
-
-  Method* method = *fr.interpreter_frame_method_addr();
-
-  interpreted_update(method, where);
-
-  // update byte code table
-  InterpreterCodelet* desc = Interpreter::codelet_containing(fr.pc());
-  if (desc != NULL && desc->bytecode() >= 0) {
-    ticks[desc->bytecode()]++;
-  }
-}
-
-void ThreadProfiler::record_compiled_tick(JavaThread* thread, frame fr, TickPosition where) {
-  const char *name = NULL;
-  TickPosition localwhere = where;
-
-  FlatProfiler::all_comp_ticks++;
-  if (!FlatProfiler::full_profile()) return;
-
-  CodeBlob* cb = fr.cb();
-
-  // For runtime stubs, record as native rather than as compiled
-  if (cb->is_runtime_stub()) {
-    RegisterMap map(thread, false);
-    fr = fr.sender(&map);
-    cb = fr.cb();
-    localwhere = tp_native;
- }
-
-  Method* method = cb->is_compiled() ? cb->as_compiled_method()->method() : (Method*) NULL;
-  if (method == NULL) {
-    if (cb->is_runtime_stub())
-      runtime_stub_update(cb, name, localwhere);
-    else
-      unknown_compiled_update(cb, localwhere);
-  }
-  else {
-    if (method->is_native()) {
-      stub_update(method, name, localwhere);
-    } else {
-      compiled_update(method, localwhere);
-    }
-  }
-}
-
-extern "C" void find(int x);
-
-
-void ThreadProfiler::record_tick_for_running_frame(JavaThread* thread, frame fr) {
-  // The tick happened in real code -> non VM code
-  if (fr.is_interpreted_frame()) {
-    interval_data_ref()->inc_interpreted();
-    record_interpreted_tick(thread, fr, tp_code, FlatProfiler::bytecode_ticks);
-    return;
-  }
-
-  if (CodeCache::contains(fr.pc())) {
-    interval_data_ref()->inc_compiled();
-    PCRecorder::record(fr.pc());
-    record_compiled_tick(thread, fr, tp_code);
-    return;
-  }
-
-  if (VtableStubs::stub_containing(fr.pc()) != NULL) {
-    unknown_ticks_array[ut_vtable_stubs] += 1;
-    return;
-  }
-
-  frame caller = fr.profile_find_Java_sender_frame(thread);
-
-  if (caller.sp() != NULL && caller.pc() != NULL) {
-    record_tick_for_calling_frame(thread, caller);
-    return;
-  }
-
-  unknown_ticks_array[ut_running_frame] += 1;
-  FlatProfiler::unknown_ticks += 1;
-}
-
-void ThreadProfiler::record_tick_for_calling_frame(JavaThread* thread, frame fr) {
-  // The tick happened in VM code
-  interval_data_ref()->inc_native();
-  if (fr.is_interpreted_frame()) {
-    record_interpreted_tick(thread, fr, tp_native, FlatProfiler::bytecode_ticks_stub);
-    return;
-  }
-  if (CodeCache::contains(fr.pc())) {
-    record_compiled_tick(thread, fr, tp_native);
-    return;
-  }
-
-  frame caller = fr.profile_find_Java_sender_frame(thread);
-
-  if (caller.sp() != NULL && caller.pc() != NULL) {
-    record_tick_for_calling_frame(thread, caller);
-    return;
-  }
-
-  unknown_ticks_array[ut_calling_frame] += 1;
-  FlatProfiler::unknown_ticks += 1;
-}
-
-void ThreadProfiler::record_tick(JavaThread* thread) {
-  FlatProfiler::all_ticks++;
-  thread_ticks += 1;
-
-  // Here's another way to track global state changes.
-  // When the class loader starts it marks the ThreadProfiler to tell it it is in the class loader
-  // and we check that here.
-  // This is more direct, and more than one thread can be in the class loader at a time,
-  // but it does mean the class loader has to know about the profiler.
-  if (region_flag[ThreadProfilerMark::classLoaderRegion]) {
-    class_loader_ticks += 1;
-    FlatProfiler::class_loader_ticks += 1;
-    return;
-  } else if (region_flag[ThreadProfilerMark::extraRegion]) {
-    extra_ticks += 1;
-    FlatProfiler::extra_ticks += 1;
-    return;
-  }
-  // Note that the WatcherThread can now stop for safepoints
-  uint32_t debug_bits = 0;
-  if (!thread->wait_for_ext_suspend_completion(SuspendRetryCount,
-      SuspendRetryDelay, &debug_bits)) {
-    unknown_ticks_array[ut_unknown_thread_state] += 1;
-    FlatProfiler::unknown_ticks += 1;
-    return;
-  }
-
-  frame fr;
-
-  switch (thread->thread_state()) {
-  case _thread_in_native:
-  case _thread_in_native_trans:
-  case _thread_in_vm:
-  case _thread_in_vm_trans:
-    if (thread->profile_last_Java_frame(&fr)) {
-      if (fr.is_runtime_frame()) {
-        RegisterMap map(thread, false);
-        fr = fr.sender(&map);
-      }
-      record_tick_for_calling_frame(thread, fr);
-    } else {
-      unknown_ticks_array[ut_no_last_Java_frame] += 1;
-      FlatProfiler::unknown_ticks += 1;
-    }
-    break;
-  // handle_special_runtime_exit_condition self-suspends threads in Java
-  case _thread_in_Java:
-  case _thread_in_Java_trans:
-    if (thread->profile_last_Java_frame(&fr)) {
-      if (fr.is_safepoint_blob_frame()) {
-        RegisterMap map(thread, false);
-        fr = fr.sender(&map);
-      }
-      record_tick_for_running_frame(thread, fr);
-    } else {
-      unknown_ticks_array[ut_no_last_Java_frame] += 1;
-      FlatProfiler::unknown_ticks += 1;
-    }
-    break;
-  case _thread_blocked:
-  case _thread_blocked_trans:
-    if (thread->osthread() && thread->osthread()->get_state() == RUNNABLE) {
-        if (thread->profile_last_Java_frame(&fr)) {
-          if (fr.is_safepoint_blob_frame()) {
-            RegisterMap map(thread, false);
-            fr = fr.sender(&map);
-            record_tick_for_running_frame(thread, fr);
-          } else {
-            record_tick_for_calling_frame(thread, fr);
-          }
-        } else {
-          unknown_ticks_array[ut_no_last_Java_frame] += 1;
-          FlatProfiler::unknown_ticks += 1;
-        }
-    } else {
-          blocked_ticks += 1;
-          FlatProfiler::blocked_ticks += 1;
-    }
-    break;
-  case _thread_uninitialized:
-  case _thread_new:
-  // not used, included for completeness
-  case _thread_new_trans:
-     unknown_ticks_array[ut_no_last_Java_frame] += 1;
-     FlatProfiler::unknown_ticks += 1;
-     break;
-  default:
-    unknown_ticks_array[ut_unknown_thread_state] += 1;
-    FlatProfiler::unknown_ticks += 1;
-    break;
-  }
-  return;
-}
-
-void ThreadProfiler::engage() {
-  engaged = true;
-  timer.start();
-}
-
-void ThreadProfiler::disengage() {
-  engaged = false;
-  timer.stop();
-}
-
-void ThreadProfiler::initialize() {
-  for (int index = 0; index < table_size; index++) {
-    table[index] = NULL;
-  }
-  thread_ticks = 0;
-  blocked_ticks = 0;
-  compiler_ticks = 0;
-  interpreter_ticks = 0;
-  for (int ut = 0; ut < ut_end; ut += 1) {
-    unknown_ticks_array[ut] = 0;
-  }
-  region_flag[ThreadProfilerMark::classLoaderRegion] = false;
-  class_loader_ticks = 0;
-  region_flag[ThreadProfilerMark::extraRegion] = false;
-  extra_ticks = 0;
-  timer.start();
-  interval_data_ref()->reset();
-}
-
-void ThreadProfiler::reset() {
-  timer.stop();
-  if (table != NULL) {
-    for (int index = 0; index < table_size; index++) {
-      ProfilerNode* n = table[index];
-      if (n != NULL) {
-        delete n;
-      }
-    }
-  }
-  initialize();
-}
-
-void FlatProfiler::allocate_table() {
-  { // Bytecode table
-    bytecode_ticks      = NEW_C_HEAP_ARRAY(int, Bytecodes::number_of_codes, mtInternal);
-    bytecode_ticks_stub = NEW_C_HEAP_ARRAY(int, Bytecodes::number_of_codes, mtInternal);
-    for(int index = 0; index < Bytecodes::number_of_codes; index++) {
-      bytecode_ticks[index]      = 0;
-      bytecode_ticks_stub[index] = 0;
-    }
-  }
-
-  if (ProfilerRecordPC) PCRecorder::init();
-
-  interval_data         = NEW_C_HEAP_ARRAY(IntervalData, interval_print_size, mtInternal);
-  FlatProfiler::interval_reset();
-}
-
-void FlatProfiler::engage(JavaThread* mainThread, bool fullProfile) {
-  full_profile_flag = fullProfile;
-  if (bytecode_ticks == NULL) {
-    allocate_table();
-  }
-  if(ProfileVM && (vm_thread_profiler == NULL)){
-    vm_thread_profiler = new ThreadProfiler();
-  }
-  if (task == NULL) {
-    task = new FlatProfilerTask(WatcherThread::delay_interval);
-    task->enroll();
-  }
-  timer.start();
-  if (mainThread != NULL) {
-    // When mainThread was created, it might not have a ThreadProfiler
-    ThreadProfiler* pp = mainThread->get_thread_profiler();
-    if (pp == NULL) {
-      mainThread->set_thread_profiler(new ThreadProfiler());
-    } else {
-      pp->reset();
-    }
-    mainThread->get_thread_profiler()->engage();
-  }
-  // This is where we would assign thread_profiler
-  // if we wanted only one thread_profiler for all threads.
-  thread_profiler = NULL;
-}
-
-void FlatProfiler::disengage() {
-  if (!task) {
-    return;
-  }
-  timer.stop();
-  task->disenroll();
-  delete task;
-  task = NULL;
-  if (thread_profiler != NULL) {
-    thread_profiler->disengage();
-  } else {
-    MutexLocker tl(Threads_lock);
-    for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) {
-      ThreadProfiler* pp = tp->get_thread_profiler();
-      if (pp != NULL) {
-        pp->disengage();
-      }
-    }
-  }
-}
-
-void FlatProfiler::reset() {
-  if (task) {
-    disengage();
-  }
-
-  class_loader_ticks = 0;
-  extra_ticks        = 0;
-  received_gc_ticks  = 0;
-  vm_operation_ticks = 0;
-  compiler_ticks     = 0;
-  deopt_ticks        = 0;
-  interpreter_ticks  = 0;
-  blocked_ticks      = 0;
-  unknown_ticks      = 0;
-  received_ticks     = 0;
-  delivered_ticks    = 0;
-  timer.stop();
-}
-
-bool FlatProfiler::is_active() {
-  return task != NULL;
-}
-
-void FlatProfiler::print_byte_code_statistics() {
-  GrowableArray <ProfilerNode*>* array = new GrowableArray<ProfilerNode*>(200);
-
-  tty->print_cr(" Bytecode ticks:");
-  for (int index = 0; index < Bytecodes::number_of_codes; index++) {
-    if (FlatProfiler::bytecode_ticks[index] > 0 || FlatProfiler::bytecode_ticks_stub[index] > 0) {
-      tty->print_cr("  %4d %4d = %s",
-        FlatProfiler::bytecode_ticks[index],
-        FlatProfiler::bytecode_ticks_stub[index],
-        Bytecodes::name( (Bytecodes::Code) index));
-    }
-  }
-  tty->cr();
-}
-
-void print_ticks(const char* title, int ticks, int total) {
-  if (ticks > 0) {
-    tty->print("%5.1f%% %5d", ticks * 100.0 / total, ticks);
-    tty->fill_to(col3);
-    tty->print("%s", title);
-    tty->cr();
-  }
-}
-
-void ThreadProfiler::print(const char* thread_name) {
-  ResourceMark rm;
-  MutexLocker ppl(ProfilePrint_lock);
-  int index = 0; // Declared outside for loops for portability
-
-  if (table == NULL) {
-    return;
-  }
-
-  if (thread_ticks <= 0) {
-    return;
-  }
-
-  const char* title = "too soon to tell";
-  double secs = timer.seconds();
-
-  GrowableArray <ProfilerNode*>* array = new GrowableArray<ProfilerNode*>(200);
-  for(index = 0; index < table_size; index++) {
-    for(ProfilerNode* node = table[index]; node; node = node->next())
-      array->append(node);
-  }
-
-  array->sort(&ProfilerNode::compare);
-
-  // compute total (sanity check)
-  int active =
-    class_loader_ticks +
-    compiler_ticks +
-    interpreter_ticks +
-    unknown_ticks();
-  for (index = 0; index < array->length(); index++) {
-    active += array->at(index)->ticks.total();
-  }
-  int total = active + blocked_ticks;
-
-  tty->cr();
-  tty->print_cr("Flat profile of %3.2f secs (%d total ticks): %s", secs, total, thread_name);
-  if (total != thread_ticks) {
-    print_ticks("Lost ticks", thread_ticks-total, thread_ticks);
-  }
-  tty->cr();
-
-  // print interpreted methods
-  tick_counter interpreted_ticks;
-  bool has_interpreted_ticks = false;
-  int print_count = 0;
-  for (index = 0; index < array->length(); index++) {
-    ProfilerNode* n = array->at(index);
-    if (n->is_interpreted()) {
-      interpreted_ticks.add(&n->ticks);
-      if (!has_interpreted_ticks) {
-        interpretedNode::print_title(tty);
-        has_interpreted_ticks = true;
-      }
-      if (print_count++ < ProfilerNumberOfInterpretedMethods) {
-        n->print(tty, active);
-      }
-    }
-  }
-  if (has_interpreted_ticks) {
-    if (print_count <= ProfilerNumberOfInterpretedMethods) {
-      title = "Total interpreted";
-    } else {
-      title = "Total interpreted (including elided)";
-    }
-    interpretedNode::print_total(tty, &interpreted_ticks, active, title);
-    tty->cr();
-  }
-
-  // print compiled methods
-  tick_counter compiled_ticks;
-  bool has_compiled_ticks = false;
-  print_count = 0;
-  for (index = 0; index < array->length(); index++) {
-    ProfilerNode* n = array->at(index);
-    if (n->is_compiled()) {
-      compiled_ticks.add(&n->ticks);
-      if (!has_compiled_ticks) {
-        compiledNode::print_title(tty);
-        has_compiled_ticks = true;
-      }
-      if (print_count++ < ProfilerNumberOfCompiledMethods) {
-        n->print(tty, active);
-      }
-    }
-  }
-  if (has_compiled_ticks) {
-    if (print_count <= ProfilerNumberOfCompiledMethods) {
-      title = "Total compiled";
-    } else {
-      title = "Total compiled (including elided)";
-    }
-    compiledNode::print_total(tty, &compiled_ticks, active, title);
-    tty->cr();
-  }
-
-  // print stub methods
-  tick_counter stub_ticks;
-  bool has_stub_ticks = false;
-  print_count = 0;
-  for (index = 0; index < array->length(); index++) {
-    ProfilerNode* n = array->at(index);
-    if (n->is_stub()) {
-      stub_ticks.add(&n->ticks);
-      if (!has_stub_ticks) {
-        stubNode::print_title(tty);
-        has_stub_ticks = true;
-      }
-      if (print_count++ < ProfilerNumberOfStubMethods) {
-        n->print(tty, active);
-      }
-    }
-  }
-  if (has_stub_ticks) {
-    if (print_count <= ProfilerNumberOfStubMethods) {
-      title = "Total stub";
-    } else {
-      title = "Total stub (including elided)";
-    }
-    stubNode::print_total(tty, &stub_ticks, active, title);
-    tty->cr();
-  }
-
-  // print runtime stubs
-  tick_counter runtime_stub_ticks;
-  bool has_runtime_stub_ticks = false;
-  print_count = 0;
-  for (index = 0; index < array->length(); index++) {
-    ProfilerNode* n = array->at(index);
-    if (n->is_runtime_stub()) {
-      runtime_stub_ticks.add(&n->ticks);
-      if (!has_runtime_stub_ticks) {
-        runtimeStubNode::print_title(tty);
-        has_runtime_stub_ticks = true;
-      }
-      if (print_count++ < ProfilerNumberOfRuntimeStubNodes) {
-        n->print(tty, active);
-      }
-    }
-  }
-  if (has_runtime_stub_ticks) {
-    if (print_count <= ProfilerNumberOfRuntimeStubNodes) {
-      title = "Total runtime stubs";
-    } else {
-      title = "Total runtime stubs (including elided)";
-    }
-    runtimeStubNode::print_total(tty, &runtime_stub_ticks, active, title);
-    tty->cr();
-  }
-
-  if (blocked_ticks + class_loader_ticks + interpreter_ticks + compiler_ticks + unknown_ticks() != 0) {
-    tty->fill_to(col1);
-    tty->print_cr("Thread-local ticks:");
-    print_ticks("Blocked (of total)",  blocked_ticks,      total);
-    print_ticks("Class loader",        class_loader_ticks, active);
-    print_ticks("Extra",               extra_ticks,        active);
-    print_ticks("Interpreter",         interpreter_ticks,  active);
-    print_ticks("Compilation",         compiler_ticks,     active);
-    print_ticks("Unknown: vtable stubs",  unknown_ticks_array[ut_vtable_stubs],         active);
-    print_ticks("Unknown: null method",   unknown_ticks_array[ut_null_method],          active);
-    print_ticks("Unknown: running frame", unknown_ticks_array[ut_running_frame],        active);
-    print_ticks("Unknown: calling frame", unknown_ticks_array[ut_calling_frame],        active);
-    print_ticks("Unknown: no pc",         unknown_ticks_array[ut_no_pc],                active);
-    print_ticks("Unknown: no last frame", unknown_ticks_array[ut_no_last_Java_frame],   active);
-    print_ticks("Unknown: thread_state",  unknown_ticks_array[ut_unknown_thread_state], active);
-    tty->cr();
-  }
-
-  if (WizardMode) {
-    tty->print_cr("Node area used: " INTX_FORMAT " Kb", (area_top - area_bottom) / 1024);
-  }
-  reset();
-}
-
-/*
-ThreadProfiler::print_unknown(){
-  if (table == NULL) {
-    return;
-  }
-
-  if (thread_ticks <= 0) {
-    return;
-  }
-} */
-
-void FlatProfiler::print(int unused) {
-  ResourceMark rm;
-  if (thread_profiler != NULL) {
-    thread_profiler->print("All threads");
-  } else {
-    MutexLocker tl(Threads_lock);
-    for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) {
-      ThreadProfiler* pp = tp->get_thread_profiler();
-      if (pp != NULL) {
-        pp->print(tp->get_thread_name());
-      }
-    }
-  }
-
-  if (ProfilerPrintByteCodeStatistics) {
-    print_byte_code_statistics();
-  }
-
-  if (non_method_ticks() > 0) {
-    tty->cr();
-    tty->print_cr("Global summary of %3.2f seconds:", timer.seconds());
-    print_ticks("Received ticks",      received_ticks,     received_ticks);
-    print_ticks("Received GC ticks",   received_gc_ticks,  received_ticks);
-    print_ticks("Compilation",         compiler_ticks,     received_ticks);
-    print_ticks("Deoptimization",      deopt_ticks,        received_ticks);
-    print_ticks("Other VM operations", vm_operation_ticks, received_ticks);
-#ifndef PRODUCT
-    print_ticks("Blocked ticks",       blocked_ticks,      received_ticks);
-    print_ticks("Threads_lock blocks", threads_lock_ticks, received_ticks);
-    print_ticks("Delivered ticks",     delivered_ticks,    received_ticks);
-    print_ticks("All ticks",           all_ticks,          received_ticks);
-#endif
-    print_ticks("Class loader",        class_loader_ticks, received_ticks);
-    print_ticks("Extra       ",        extra_ticks,        received_ticks);
-    print_ticks("Interpreter",         interpreter_ticks,  received_ticks);
-    print_ticks("Unknown code",        unknown_ticks,      received_ticks);
-  }
-
-  PCRecorder::print();
-
-  if(ProfileVM){
-    tty->cr();
-    vm_thread_profiler->print("VM Thread");
-  }
-}
-
-void IntervalData::print_header(outputStream* st) {
-  st->print("i/c/n/g");
-}
-
-void IntervalData::print_data(outputStream* st) {
-  st->print("%d/%d/%d/%d", interpreted(), compiled(), native(), compiling());
-}
-
-void FlatProfiler::interval_record_thread(ThreadProfiler* tp) {
-  IntervalData id = tp->interval_data();
-  int total = id.total();
-  tp->interval_data_ref()->reset();
-
-  // Insertion sort the data, if it's relevant.
-  for (int i = 0; i < interval_print_size; i += 1) {
-    if (total > interval_data[i].total()) {
-      for (int j = interval_print_size - 1; j > i; j -= 1) {
-        interval_data[j] = interval_data[j-1];
-      }
-      interval_data[i] = id;
-      break;
-    }
-  }
-}
-
-void FlatProfiler::interval_print() {
-  if ((interval_data[0].total() > 0)) {
-    tty->stamp();
-    tty->print("\t");
-    IntervalData::print_header(tty);
-    for (int i = 0; i < interval_print_size; i += 1) {
-      if (interval_data[i].total() > 0) {
-        tty->print("\t");
-        interval_data[i].print_data(tty);
-      }
-    }
-    tty->cr();
-  }
-}
-
-void FlatProfiler::interval_reset() {
-  for (int i = 0; i < interval_print_size; i += 1) {
-    interval_data[i].reset();
-  }
-}
-
-void ThreadProfiler::oops_do(OopClosure* f) {
-  if (table == NULL) return;
-
-  for(int index = 0; index < table_size; index++) {
-    for(ProfilerNode* node = table[index]; node; node = node->next())
-      node->oops_do(f);
-  }
-}
-
-void FlatProfiler::oops_do(OopClosure* f) {
-  if (thread_profiler != NULL) {
-    thread_profiler->oops_do(f);
-  } else {
-    for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) {
-      ThreadProfiler* pp = tp->get_thread_profiler();
-      if (pp != NULL) {
-        pp->oops_do(f);
-      }
-    }
-  }
-}
--- a/hotspot/src/share/vm/runtime/fprofiler.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,319 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * 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.
- *
- */
-
-#ifndef SHARE_VM_RUNTIME_FPROFILER_HPP
-#define SHARE_VM_RUNTIME_FPROFILER_HPP
-
-#include "utilities/macros.hpp"
-#include "runtime/timer.hpp"
-
-// a simple flat profiler for Java
-
-
-// Forward declaration of classes defined in this header file
-class ThreadProfiler;
-class ThreadProfilerMark;
-class FlatProfiler;
-class IntervalData;
-
-// Declarations of classes defined only in the implementation.
-class ProfilerNode;
-class FlatProfilerTask;
-
-enum TickPosition {
-  tp_code,
-  tp_native
-};
-
-// One of these guys is constructed as we enter interesting regions
-// and destructed as we exit the region.  While we are in the region
-// ticks are allotted to the region.
-class ThreadProfilerMark: public StackObj {
-public:
-  // For now, the only thread-specific region is the class loader.
-  enum Region { noRegion, classLoaderRegion, extraRegion, maxRegion };
-
-  ThreadProfilerMark(Region)  NOT_FPROF_RETURN;
-  ~ThreadProfilerMark()       NOT_FPROF_RETURN;
-
-private:
-  ThreadProfiler* _pp;
-  Region _r;
-};
-
-#if INCLUDE_FPROF
-
-class IntervalData VALUE_OBJ_CLASS_SPEC {
-  // Just to keep these things all together
-private:
-  int _interpreted;
-  int _compiled;
-  int _native;
-  int _compiling;
-public:
-  int interpreted() {
-    return _interpreted;
-  }
-  int compiled() {
-    return _compiled;
-  }
-  int native() {
-    return _native;
-  }
-  int compiling() {
-    return _compiling;
-  }
-  int total() {
-    return (interpreted() + compiled() + native() + compiling());
-  }
-  void inc_interpreted() {
-    _interpreted += 1;
-  }
-  void inc_compiled() {
-    _compiled += 1;
-  }
-  void inc_native() {
-    _native += 1;
-  }
-  void inc_compiling() {
-    _compiling += 1;
-  }
-  void reset() {
-    _interpreted = 0;
-    _compiled = 0;
-    _native = 0;
-    _compiling = 0;
-  }
-  static void print_header(outputStream* st);
-  void print_data(outputStream* st);
-};
-#endif // INCLUDE_FPROF
-
-class ThreadProfiler: public CHeapObj<mtInternal> {
-public:
-  ThreadProfiler()    NOT_FPROF_RETURN;
-  ~ThreadProfiler()   NOT_FPROF_RETURN;
-
-  // Resets the profiler
-  void reset()        NOT_FPROF_RETURN;
-
-  // Activates the profiler for a certain thread
-  void engage()       NOT_FPROF_RETURN;
-
-  // Deactivates the profiler
-  void disengage()    NOT_FPROF_RETURN;
-
-  // Prints the collected profiling information
-  void print(const char* thread_name) NOT_FPROF_RETURN;
-
-  // Garbage Collection Support
-  void oops_do(OopClosure* f)         NOT_FPROF_RETURN;
-
-#if INCLUDE_FPROF
-private:
-  // for recording ticks.
-  friend class ProfilerNode;
-  char* area_bottom; // preallocated area for pnodes
-  char* area_top;
-  char* area_limit;
-  static int            table_size;
-  ProfilerNode** table;
-
-private:
-  void record_interpreted_tick(JavaThread* thread, frame fr, TickPosition where, int* ticks);
-  void record_compiled_tick   (JavaThread* thread, frame fr, TickPosition where);
-  void interpreted_update(Method* method, TickPosition where);
-  void compiled_update   (Method* method, TickPosition where);
-  void stub_update       (Method* method, const char* name, TickPosition where);
-  void adapter_update    (TickPosition where);
-
-  void runtime_stub_update(const CodeBlob* stub, const char* name, TickPosition where);
-  void unknown_compiled_update    (const CodeBlob* cb, TickPosition where);
-
-  void vm_update    (TickPosition where);
-  void vm_update    (const char* name, TickPosition where);
-
-  void record_tick_for_running_frame(JavaThread* thread, frame fr);
-  void record_tick_for_calling_frame(JavaThread* thread, frame fr);
-
-  void initialize();
-
-  static int  entry(int value);
-
-
-private:
-  friend class FlatProfiler;
-  void record_tick(JavaThread* thread);
-  bool engaged;
-  // so we can do percentages for this thread, and quick checks for activity
-  int thread_ticks;
-  int compiler_ticks;
-  int interpreter_ticks;
-
-public:
-  void inc_thread_ticks() { thread_ticks += 1; }
-
-private:
-  friend class ThreadProfilerMark;
-  // counters for thread-specific regions
-  bool region_flag[ThreadProfilerMark::maxRegion];
-  int class_loader_ticks;
-  int extra_ticks;
-
-private:
-  // other thread-specific regions
-  int blocked_ticks;
-  enum UnknownTickSites {
-      ut_null_method,
-      ut_vtable_stubs,
-      ut_running_frame,
-      ut_calling_frame,
-      ut_no_pc,
-      ut_no_last_Java_frame,
-      ut_unknown_thread_state,
-      ut_end
-  };
-  int unknown_ticks_array[ut_end];
-  int unknown_ticks() {
-    int result = 0;
-    for (int ut = 0; ut < ut_end; ut += 1) {
-      result += unknown_ticks_array[ut];
-    }
-    return result;
-  }
-
-  elapsedTimer timer;
-
-  // For interval timing
-private:
-  IntervalData _interval_data;
-  IntervalData interval_data() {
-    return _interval_data;
-  }
-  IntervalData* interval_data_ref() {
-    return &_interval_data;
-  }
-#endif // INCLUDE_FPROF
-};
-
-class FlatProfiler: AllStatic {
-public:
-  static void reset() NOT_FPROF_RETURN ;
-  static void engage(JavaThread* mainThread, bool fullProfile) NOT_FPROF_RETURN ;
-  static void disengage() NOT_FPROF_RETURN ;
-  static void print(int unused) NOT_FPROF_RETURN ;
-  static bool is_active() NOT_FPROF_RETURN_(false) ;
-
-  // This is NULL if each thread has its own thread profiler,
-  // else this is the single thread profiler used by all threads.
-  // In particular it makes a difference during garbage collection,
-  // where you only want to traverse each thread profiler once.
-  static ThreadProfiler* get_thread_profiler() NOT_FPROF_RETURN_(NULL);
-
-  // Garbage Collection Support
-  static void oops_do(OopClosure* f) NOT_FPROF_RETURN ;
-
-  // Support for disassembler to inspect the PCRecorder
-
-  // Returns the start address for a given pc
-  // NULL is returned if the PCRecorder is inactive
-  static address bucket_start_for(address pc) NOT_FPROF_RETURN_(NULL);
-
-  enum { MillisecsPerTick = 10 };   // ms per profiling ticks
-
-  // Returns the number of ticks recorded for the bucket
-  // pc belongs to.
-  static int bucket_count_for(address pc) NOT_FPROF_RETURN_(0);
-
-#if INCLUDE_FPROF
-
- private:
-  static bool full_profile() {
-    return full_profile_flag;
-  }
-
-  friend class ThreadProfiler;
-  // the following group of ticks cover everything that's not attributed to individual Java methods
-  static int  received_gc_ticks;      // ticks during which gc was active
-  static int vm_operation_ticks;      // total ticks in vm_operations other than GC
-  static int threads_lock_ticks;      // the number of times we couldn't get the Threads_lock without blocking
-  static int      blocked_ticks;      // ticks when the thread was blocked.
-  static int class_loader_ticks;      // total ticks in class loader
-  static int        extra_ticks;      // total ticks an extra temporary measuring
-  static int     compiler_ticks;      // total ticks in compilation
-  static int  interpreter_ticks;      // ticks in unknown interpreted method
-  static int        deopt_ticks;      // ticks in deoptimization
-  static int      unknown_ticks;      // ticks that cannot be categorized
-  static int     received_ticks;      // ticks that were received by task
-  static int    delivered_ticks;      // ticks that were delivered by task
-  static int non_method_ticks() {
-    return
-      ( received_gc_ticks
-      + vm_operation_ticks
-      + deopt_ticks
-      + threads_lock_ticks
-      + blocked_ticks
-      + compiler_ticks
-      + interpreter_ticks
-      + unknown_ticks );
-  }
-  static elapsedTimer timer;
-
-  // Counts of each of the byte codes
-  static int*           bytecode_ticks;
-  static int*           bytecode_ticks_stub;
-  static void print_byte_code_statistics();
-
-  // the ticks below are for continuous profiling (to adjust recompilation, etc.)
-  static int          all_ticks;      // total count of ticks received so far
-  static int      all_int_ticks;      // ticks in interpreter
-  static int     all_comp_ticks;      // ticks in compiled code (+ native)
-  static bool full_profile_flag;      // collecting full profile?
-
-  // to accumulate thread-specific data
-  // if we aren't profiling individual threads.
-  static ThreadProfiler* thread_profiler;
-  static ThreadProfiler* vm_thread_profiler;
-
-  static void allocate_table();
-
-  // The task that periodically interrupts things.
-  friend class FlatProfilerTask;
-  static FlatProfilerTask* task;
-  static void record_vm_operation();
-  static void record_vm_tick();
-  static void record_thread_ticks();
-
-  // For interval analysis
- private:
-  static int interval_ticks_previous;  // delivered_ticks from the last interval
-  static void interval_record_thread(ThreadProfiler* tp); // extract ticks from ThreadProfiler.
-  static void interval_print();       // print interval data.
-  static void interval_reset();       // reset interval data.
-  enum {interval_print_size = 10};
-  static IntervalData* interval_data;
-#endif // INCLUDE_FPROF
-};
-
-#endif // SHARE_VM_RUNTIME_FPROFILER_HPP
--- a/hotspot/src/share/vm/runtime/globals.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -2037,7 +2037,7 @@
                                                                             \
   product(size_t, ErgoHeapSizeLimit, 0,                                     \
           "Maximum ergonomically set heap size (in bytes); zero means use " \
-          "MaxRAM / MaxRAMFraction")                                        \
+          "MaxRAM * MaxRAMPercentage / 100")                                \
           range(0, max_uintx)                                               \
                                                                             \
   experimental(bool, UseCGroupMemoryLimitForHeap, false,                    \
@@ -2046,18 +2046,34 @@
                                                                             \
   product(uintx, MaxRAMFraction, 4,                                         \
           "Maximum fraction (1/n) of real memory used for maximum heap "    \
-          "size")                                                           \
+          "size. "                                                          \
+          "Deprecated, use MaxRAMPercentage instead")                       \
           range(1, max_uintx)                                               \
                                                                             \
   product(uintx, MinRAMFraction, 2,                                         \
           "Minimum fraction (1/n) of real memory used for maximum heap "    \
-          "size on systems with small physical memory size")                \
+          "size on systems with small physical memory size. "               \
+          "Deprecated, use MinRAMPercentage instead")                       \
           range(1, max_uintx)                                               \
                                                                             \
   product(uintx, InitialRAMFraction, 64,                                    \
-          "Fraction (1/n) of real memory used for initial heap size")       \
+          "Fraction (1/n) of real memory used for initial heap size. "      \
+          "Deprecated, use InitialRAMPercentage instead")                   \
           range(1, max_uintx)                                               \
                                                                             \
+  product(double, MaxRAMPercentage, 25.0,                                   \
+          "Maximum percentage of real memory used for maximum heap size")   \
+          range(0.0, 100.0)                                                 \
+                                                                            \
+  product(double, MinRAMPercentage, 50.0,                                   \
+          "Minimum percentage of real memory used for maximum heap"         \
+          "size on systems with small physical memory size")                \
+          range(0.0, 100.0)                                                 \
+                                                                            \
+  product(double, InitialRAMPercentage, 1.5625,                             \
+          "Percentage of real memory used for initial heap size")           \
+          range(0.0, 100.0)                                                 \
+                                                                            \
   develop(uintx, MaxVirtMemFraction, 2,                                     \
           "Maximum fraction (1/n) of virtual memory used for ergonomically "\
           "determining maximum heap size")                                  \
--- a/hotspot/src/share/vm/runtime/java.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/java.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -55,7 +55,6 @@
 #include "runtime/biasedLocking.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/deoptimization.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/java.hpp"
@@ -465,12 +464,6 @@
     WatcherThread::stop();
   }
 
-  // Print statistics gathered (profiling ...)
-  if (Arguments::has_profile()) {
-    FlatProfiler::disengage();
-    FlatProfiler::print(10);
-  }
-
   // shut down the StatSampler task
   StatSampler::disengage();
   StatSampler::destroy();
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/javaCalls.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -308,9 +308,6 @@
 }
 
 void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaCallArguments* args, TRAPS) {
-  // During dumping, Java execution environment is not fully initialized. Also, Java execution
-  // may cause undesirable side-effects in the class metadata.
-  assert(!DumpSharedSpaces, "must not execute Java bytecodes when dumping");
 
   JavaThread* thread = (JavaThread*)THREAD;
   assert(thread->is_Java_thread(), "must be called by a java thread");
--- a/hotspot/src/share/vm/runtime/os.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/os.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -235,6 +235,82 @@
   return OS_OK;
 }
 
+bool os::dll_build_name(char* buffer, size_t size, const char* fname) {
+  int n = jio_snprintf(buffer, size, "%s%s%s", JNI_LIB_PREFIX, fname, JNI_LIB_SUFFIX);
+  return (n != -1);
+}
+
+// Helper for dll_locate_lib.
+// Pass buffer and printbuffer as we already printed the path to buffer
+// when we called get_current_directory. This way we avoid another buffer
+// of size MAX_PATH.
+static bool conc_path_file_and_check(char *buffer, char *printbuffer, size_t printbuflen,
+                                     const char* pname, char lastchar, const char* fname) {
+
+  // Concatenate path and file name, but don't print double path separators.
+  const char *filesep = (WINDOWS_ONLY(lastchar == ':' ||) lastchar == os::file_separator()[0]) ?
+                        "" : os::file_separator();
+  int ret = jio_snprintf(printbuffer, printbuflen, "%s%s%s", pname, filesep, fname);
+  // Check whether file exists.
+  if (ret != -1) {
+    struct stat statbuf;
+    return os::stat(buffer, &statbuf) == 0;
+  }
+  return false;
+}
+
+bool os::dll_locate_lib(char *buffer, size_t buflen,
+                        const char* pname, const char* fname) {
+  bool retval = false;
+
+  size_t fullfnamelen = strlen(JNI_LIB_PREFIX) + strlen(fname) + strlen(JNI_LIB_SUFFIX);
+  char* fullfname = (char*)NEW_C_HEAP_ARRAY(char, fullfnamelen + 1, mtInternal);
+  if (dll_build_name(fullfname, fullfnamelen + 1, fname)) {
+    const size_t pnamelen = pname ? strlen(pname) : 0;
+
+    if (pnamelen == 0) {
+      // If no path given, use current working directory.
+      const char* p = get_current_directory(buffer, buflen);
+      if (p != NULL) {
+        const size_t plen = strlen(buffer);
+        const char lastchar = buffer[plen - 1];
+        retval = conc_path_file_and_check(buffer, &buffer[plen], buflen - plen,
+                                          "", lastchar, fullfname);
+      }
+    } else if (strchr(pname, *os::path_separator()) != NULL) {
+      // A list of paths. Search for the path that contains the library.
+      int n;
+      char** pelements = split_path(pname, &n);
+      if (pelements != NULL) {
+        for (int i = 0; i < n; i++) {
+          char* path = pelements[i];
+          // Really shouldn't be NULL, but check can't hurt.
+          size_t plen = (path == NULL) ? 0 : strlen(path);
+          if (plen == 0) {
+            continue; // Skip the empty path values.
+          }
+          const char lastchar = path[plen - 1];
+          retval = conc_path_file_and_check(buffer, buffer, buflen, path, lastchar, fullfname);
+          if (retval) break;
+        }
+        // Release the storage allocated by split_path.
+        for (int i = 0; i < n; i++) {
+          if (pelements[i] != NULL) {
+            FREE_C_HEAP_ARRAY(char, pelements[i]);
+          }
+        }
+        FREE_C_HEAP_ARRAY(char*, pelements);
+      }
+    } else {
+      // A definite path.
+      const char lastchar = pname[pnamelen-1];
+      retval = conc_path_file_and_check(buffer, buffer, buflen, pname, lastchar, fullfname);
+    }
+  }
+
+  FREE_C_HEAP_ARRAY(char*, fullfname);
+  return retval;
+}
 
 // --------------------- sun.misc.Signal (optional) ---------------------
 
@@ -427,13 +503,13 @@
     // Try to load verify dll first. In 1.3 java dll depends on it and is not
     // always able to find it when the loading executable is outside the JDK.
     // In order to keep working with 1.2 we ignore any loading errors.
-    if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
+    if (dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(),
                        "verify")) {
       dll_load(buffer, ebuf, sizeof(ebuf));
     }
 
     // Load java dll
-    if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
+    if (dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(),
                        "java")) {
       _native_java_library = dll_load(buffer, ebuf, sizeof(ebuf));
     }
@@ -444,7 +520,7 @@
 #if defined(__OpenBSD__)
     // Work-around OpenBSD's lack of $ORIGIN support by pre-loading libnet.so
     // ignore errors
-    if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
+    if (dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(),
                        "net")) {
       dll_load(buffer, ebuf, sizeof(ebuf));
     }
--- a/hotspot/src/share/vm/runtime/os.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/os.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -476,7 +476,6 @@
   static frame      fetch_frame_from_context(const void* ucVoid);
   static frame      fetch_frame_from_ucontext(Thread* thread, void* ucVoid);
 
-  static ExtendedPC get_thread_pc(Thread *thread);
   static void breakpoint();
   static bool start_debugging(char *buf, int buflen);
 
@@ -541,9 +540,16 @@
   static const char*    get_temp_directory();
   static const char*    get_current_directory(char *buf, size_t buflen);
 
-  // Builds a platform-specific full library path given a ld path and lib name
-  // Returns true if buffer contains full path to existing file, false otherwise
+  // Builds the platform-specific name of a library.
+  // Returns false if the buffer is too small.
   static bool           dll_build_name(char* buffer, size_t size,
+                                       const char* fname);
+
+  // Builds a platform-specific full library path given an ld path and
+  // unadorned library name. Returns true if the buffer contains a full
+  // path to an existing file, false otherwise. If pathname is empty,
+  // uses the path to the current directory.
+  static bool           dll_locate_lib(char* buffer, size_t size,
                                        const char* pathname, const char* fname);
 
   // Symbol lookup, find nearest function name; basically it implements
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -53,7 +53,7 @@
  public:
   int traversal;
   int compile_id;
-  jlong traversal_mark;
+  long traversal_mark;
   int state;
   const char* kind;
   address vep;
@@ -62,7 +62,7 @@
 
   void print() {
       tty->print_cr("traversal = %d compile_id = %d %s uep = " PTR_FORMAT " vep = "
-                    PTR_FORMAT " state = %d traversal_mark "JLONG_FORMAT" line = %d",
+                    PTR_FORMAT " state = %d traversal_mark %ld line = %d",
                     traversal,
                     compile_id,
                     kind == NULL ? "" : kind,
@@ -629,6 +629,7 @@
   } else if (cm->is_not_entrant()) {
     // If there are no current activations of this method on the
     // stack we can safely convert it to a zombie method
+    OrderAccess::loadload(); // _stack_traversal_mark and _state
     if (cm->can_convert_to_zombie()) {
       // Clear ICStubs to prevent back patching stubs of zombie or flushed
       // nmethods during the next safepoint (see ICStub::finalize).
--- a/hotspot/src/share/vm/runtime/thread.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -63,7 +63,6 @@
 #include "runtime/commandLineFlagWriteableList.hpp"
 #include "runtime/commandLineFlagRangeList.hpp"
 #include "runtime/deoptimization.hpp"
-#include "runtime/fprofiler.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/init.hpp"
@@ -748,19 +747,6 @@
 }
 #endif // PRODUCT
 
-// Called by flat profiler
-// Callers have already called wait_for_ext_suspend_completion
-// The assertion for that is currently too complex to put here:
-bool JavaThread::profile_last_Java_frame(frame* _fr) {
-  bool gotframe = false;
-  // self suspension saves needed state.
-  if (has_last_Java_frame() && _anchor.walkable()) {
-    *_fr = pd_last_frame();
-    gotframe = true;
-  }
-  return gotframe;
-}
-
 void Thread::interrupt(Thread* thread) {
   debug_only(check_for_dangling_thread_pointer(thread);)
   os::interrupt(thread);
@@ -1381,14 +1367,6 @@
   while (watcher_thread() != NULL) {
     // This wait should make safepoint checks, wait without a timeout,
     // and wait as a suspend-equivalent condition.
-    //
-    // Note: If the FlatProfiler is running, then this thread is waiting
-    // for the WatcherThread to terminate and the WatcherThread, via the
-    // FlatProfiler task, is waiting for the external suspend request on
-    // this thread to complete. wait_for_ext_suspend_completion() will
-    // eventually timeout, but that takes time. Making this wait a
-    // suspend-equivalent condition solves that timeout problem.
-    //
     Terminator_lock->wait(!Mutex::_no_safepoint_check_flag, 0,
                           Mutex::_as_suspend_equivalent_flag);
   }
@@ -1505,16 +1483,6 @@
   }
 #endif // PRODUCT
 
-  set_thread_profiler(NULL);
-  if (FlatProfiler::is_active()) {
-    // This is where we would decide to either give each thread it's own profiler
-    // or use one global one from FlatProfiler,
-    // or up to some count of the number of profiled threads, etc.
-    ThreadProfiler* pp = new ThreadProfiler();
-    pp->engage();
-    set_thread_profiler(pp);
-  }
-
   // Setup safepoint state info for this thread
   ThreadSafepointState::create(this);
 
@@ -1660,7 +1628,6 @@
 
   // All Java related clean up happens in exit
   ThreadSafepointState::destroy(this);
-  if (_thread_profiler != NULL) delete _thread_profiler;
   if (_thread_stat != NULL) delete _thread_stat;
 
 #if INCLUDE_JVMCI
@@ -1775,13 +1742,6 @@
   Handle threadObj(this, this->threadObj());
   assert(threadObj.not_null(), "Java thread object should be created");
 
-  if (get_thread_profiler() != NULL) {
-    get_thread_profiler()->disengage();
-    ResourceMark rm;
-    get_thread_profiler()->print(get_thread_name());
-  }
-
-
   // FIXIT: This code should be moved into else part, when reliable 1.2/1.3 check is in place
   {
     EXCEPTION_MARK;
@@ -1983,12 +1943,6 @@
 #endif // INCLUDE_ALL_GCS
 
 void JavaThread::cleanup_failed_attach_current_thread() {
-  if (get_thread_profiler() != NULL) {
-    get_thread_profiler()->disengage();
-    ResourceMark rm;
-    get_thread_profiler()->print(get_thread_name());
-  }
-
   if (active_handles() != NULL) {
     JNIHandleBlock* block = active_handles();
     set_active_handles(NULL);
@@ -2786,9 +2740,6 @@
   // Verify that the deferred card marks have been flushed.
   assert(deferred_card_mark().is_empty(), "Should be empty during GC");
 
-  // The ThreadProfiler oops_do is done from FlatProfiler::oops_do
-  // since there may be more than one thread using each ThreadProfiler.
-
   // Traverse the GCHandles
   Thread::oops_do(f, cf);
 
@@ -3717,14 +3668,6 @@
 
   Thread* THREAD = Thread::current();
 
-  // At this point, the Universe is initialized, but we have not executed
-  // any byte code.  Now is a good time (the only time) to dump out the
-  // internal state of the JVM for sharing.
-  if (DumpSharedSpaces) {
-    MetaspaceShared::preload_and_dump(CHECK_JNI_ERR);
-    ShouldNotReachHere();
-  }
-
   // Always call even when there are not JVMTI environments yet, since environments
   // may be attached late and JVMTI must track phases of VM execution
   JvmtiExport::enter_early_start_phase();
@@ -3849,7 +3792,6 @@
   }
 #endif // INCLUDE_MANAGEMENT
 
-  if (Arguments::has_profile())       FlatProfiler::engage(main_thread, true);
   if (MemProfiling)                   MemProfiler::engage();
   StatSampler::engage();
   if (CheckJNICalls)                  JniPeriodicChecker::engage();
@@ -3887,6 +3829,12 @@
 #ifdef ASSERT
   _vm_complete = true;
 #endif
+
+  if (DumpSharedSpaces) {
+    MetaspaceShared::preload_and_dump(CHECK_JNI_ERR);
+    ShouldNotReachHere();
+  }
+
   return JNI_OK;
 }
 
@@ -3925,13 +3873,12 @@
       }
     } else {
       // Try to load the agent from the standard dll directory
-      if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(),
+      if (os::dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(),
                              name)) {
         library = os::dll_load(buffer, ebuf, sizeof ebuf);
       }
-      if (library == NULL) { // Try the local directory
-        char ns[1] = {0};
-        if (os::dll_build_name(buffer, sizeof(buffer), ns, name)) {
+      if (library == NULL) { // Try the library path directory.
+        if (os::dll_build_name(buffer, sizeof(buffer), name)) {
           library = os::dll_load(buffer, ebuf, sizeof ebuf);
         }
         if (library == NULL) {
@@ -4139,7 +4086,7 @@
 //   + Call before_exit(), prepare for VM exit
 //      > run VM level shutdown hooks (they are registered through JVM_OnExit(),
 //        currently the only user of this mechanism is File.deleteOnExit())
-//      > stop flat profiler, StatSampler, watcher thread, CMS threads,
+//      > stop StatSampler, watcher thread, CMS threads,
 //        post thread end and vm death events to JVMTI,
 //        stop signal thread
 //   + Call JavaThread::exit(), it will:
@@ -4168,14 +4115,6 @@
     while (Threads::number_of_non_daemon_threads() > 1)
       // This wait should make safepoint checks, wait without a timeout,
       // and wait as a suspend-equivalent condition.
-      //
-      // Note: If the FlatProfiler is running and this thread is waiting
-      // for another non-daemon thread to finish, then the FlatProfiler
-      // is waiting for the external suspend request on this thread to
-      // complete. wait_for_ext_suspend_completion() will eventually
-      // timeout, but that takes time. Making this wait a suspend-
-      // equivalent condition solves that timeout problem.
-      //
       Threads_lock->wait(!Mutex::_no_safepoint_check_flag, 0,
                          Mutex::_as_suspend_equivalent_flag);
   }
--- a/hotspot/src/share/vm/runtime/thread.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -56,7 +56,6 @@
 #endif
 
 class ThreadSafepointState;
-class ThreadProfiler;
 
 class JvmtiThreadState;
 class JvmtiGetLoadedClassesClosure;
@@ -1720,23 +1719,6 @@
 
   void deoptimized_wrt_marked_nmethods();
 
-  // Profiling operation (see fprofile.cpp)
- public:
-  bool profile_last_Java_frame(frame* fr);
-
- private:
-  ThreadProfiler* _thread_profiler;
- private:
-  friend class FlatProfiler;                    // uses both [gs]et_thread_profiler.
-  friend class FlatProfilerTask;                // uses get_thread_profiler.
-  friend class ThreadProfilerMark;              // uses get_thread_profiler.
-  ThreadProfiler* get_thread_profiler()         { return _thread_profiler; }
-  ThreadProfiler* set_thread_profiler(ThreadProfiler* tp) {
-    ThreadProfiler* result = _thread_profiler;
-    _thread_profiler = tp;
-    return result;
-  }
-
  public:
   // Returns the running thread as a JavaThread
   static inline JavaThread* current();
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -841,7 +841,7 @@
   nonstatic_field(nmethod,                     _verified_entry_point,                         address)                               \
   nonstatic_field(nmethod,                     _osr_entry_point,                              address)                               \
   volatile_nonstatic_field(nmethod,            _lock_count,                                   jint)                                  \
-  volatile_nonstatic_field(nmethod,            _stack_traversal_mark,                         jlong)                                 \
+  volatile_nonstatic_field(nmethod,            _stack_traversal_mark,                         long)                                  \
   nonstatic_field(nmethod,                     _compile_id,                                   int)                                   \
   nonstatic_field(nmethod,                     _comp_level,                                   int)                                   \
                                                                                                                                      \
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -414,11 +414,7 @@
 }
 
 void SystemGCDCmd::execute(DCmdSource source, TRAPS) {
-  if (!DisableExplicitGC) {
-    Universe::heap()->collect(GCCause::_dcmd_gc_run);
-  } else {
-    output()->print_cr("Explicit GC is disabled, no GC has been performed.");
-  }
+  Universe::heap()->collect(GCCause::_dcmd_gc_run);
 }
 
 void RunFinalizationDCmd::execute(DCmdSource source, TRAPS) {
--- a/hotspot/src/share/vm/utilities/decoder.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/utilities/decoder.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -30,6 +30,7 @@
 
 #if defined(_WINDOWS)
   #include "decoder_windows.hpp"
+  #include "windbghelp.hpp"
 #elif defined(__APPLE__)
   #include "decoder_machO.hpp"
 #elif defined(AIX)
@@ -162,3 +163,9 @@
   _shared_decoder = &_do_nothing_decoder;
 }
 
+void Decoder::print_state_on(outputStream* st) {
+#ifdef _WINDOWS
+  WindowsDbgHelp::print_state_on(st);
+#endif
+}
+
--- a/hotspot/src/share/vm/utilities/decoder.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/utilities/decoder.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -29,6 +29,7 @@
 #include "memory/allocation.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/mutexLocker.hpp"
+#include "utilities/ostream.hpp"
 
 class AbstractDecoder : public CHeapObj<mtInternal> {
 public:
@@ -41,7 +42,6 @@
          out_of_memory,        // out of memory
          file_invalid,         // invalid elf file
          file_not_found,       // could not found symbol file (on windows), such as jvm.pdb or jvm.map
-         helper_not_found,     // could not load dbghelp.dll (Windows only)
          helper_func_error,    // decoding functions not found (Windows only)
          helper_init_error     // SymInitialize failed (Windows only)
   };
@@ -117,6 +117,9 @@
 
   // shutdown shared instance
   static void shutdown();
+
+  static void print_state_on(outputStream* st);
+
 protected:
   // shared decoder instance, _shared_instance_lock is needed
   static AbstractDecoder* get_shared_instance();
--- a/hotspot/src/share/vm/utilities/exceptions.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -87,13 +87,9 @@
 #endif // ASSERT
 
   if (thread->is_VM_thread()
-      || !thread->can_call_java()
-      || DumpSharedSpaces ) {
+      || !thread->can_call_java()) {
     // We do not care what kind of exception we get for the vm-thread or a thread which
     // is compiling.  We just install a dummy exception object
-    //
-    // We also cannot throw a proper exception when dumping, because we cannot run
-    // Java bytecodes now. A dummy exception will suffice.
     thread->set_pending_exception(Universe::vm_exception(), file, line);
     return true;
   }
@@ -114,13 +110,9 @@
   }
 
   if (thread->is_VM_thread()
-      || !thread->can_call_java()
-      || DumpSharedSpaces ) {
+      || !thread->can_call_java()) {
     // We do not care what kind of exception we get for the vm-thread or a thread which
     // is compiling.  We just install a dummy exception object
-    //
-    // We also cannot throw a proper exception when dumping, because we cannot run
-    // Java bytecodes now. A dummy exception will suffice.
     thread->set_pending_exception(Universe::vm_exception(), file, line);
     return true;
   }
--- a/hotspot/src/share/vm/utilities/macros.hpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/utilities/macros.hpp	Sat Sep 09 14:36:45 2017 +0200
@@ -65,18 +65,6 @@
 #define NOT_JVMTI_RETURN_(code) { return code; }
 #endif // INCLUDE_JVMTI
 
-#ifndef INCLUDE_FPROF
-#define INCLUDE_FPROF 1
-#endif
-
-#if INCLUDE_FPROF
-#define NOT_FPROF_RETURN        /* next token must be ; */
-#define NOT_FPROF_RETURN_(code) /* next token must be ; */
-#else
-#define NOT_FPROF_RETURN                {}
-#define NOT_FPROF_RETURN_(code) { return code; }
-#endif // INCLUDE_FPROF
-
 #ifndef INCLUDE_VM_STRUCTS
 #define INCLUDE_VM_STRUCTS 1
 #endif
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -890,6 +890,13 @@
        st->cr();
      }
 
+  STEP("printing native decoder state")
+
+     if (_verbose) {
+       Decoder::print_state_on(st);
+       st->cr();
+     }
+
   STEP("printing VM options")
 
      if (_verbose) {
--- a/hotspot/test/Makefile	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/test/Makefile	Sat Sep 09 14:36:45 2017 +0200
@@ -70,8 +70,8 @@
   CONCURRENCY := 12
 endif
 
-# Make sure MaxRAMFraction is high enough to not cause OOM or swapping since we may end up with a lot of JVM's
-JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMFraction=$(shell expr $(CONCURRENCY) \* 4)
+# Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since we may end up with a lot of JVM's
+JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(shell expr 25 / $(CONCURRENCY))
 
 # Include the common base file with most of the logic
 include ../../test/TestCommon.gmk
--- a/hotspot/test/gc/g1/TestGCLogMessages.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/test/gc/g1/TestGCLogMessages.java	Sat Sep 09 14:36:45 2017 +0200
@@ -110,7 +110,6 @@
         new LogMessageWithLevel("Universe Roots", Level.TRACE),
         new LogMessageWithLevel("JNI Handles Roots", Level.TRACE),
         new LogMessageWithLevel("ObjectSynchronizer Roots", Level.TRACE),
-        new LogMessageWithLevel("FlatProfiler Roots", Level.TRACE),
         new LogMessageWithLevel("Management Roots", Level.TRACE),
         new LogMessageWithLevel("SystemDictionary Roots", Level.TRACE),
         new LogMessageWithLevel("CLDG Roots", Level.TRACE),
--- a/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java	Sat Sep 09 14:36:45 2017 +0200
@@ -36,10 +36,10 @@
 public class FlagWithInvalidValue {
   public static void main(String[] args) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:MaxRAMFraction=v", "-version");
+        "-XX:MaxRAMPercentage=v", "-version");
 
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("Improperly specified VM option 'MaxRAMFraction=v'");
+    output.shouldContain("Improperly specified VM option 'MaxRAMPercentage=v'");
     output.shouldHaveExitValue(1);
   }
 }
--- a/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java	Sat Sep 09 14:36:45 2017 +0200
@@ -36,17 +36,17 @@
 public class NonBooleanFlagWithInvalidBooleanPrefix {
   public static void main(String[] args) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:-MaxRAMFraction=16", "-version");
+        "-XX:-MaxRAMPercentage=1", "-version");
 
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMFraction=16'");
+    output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMPercentage=1'");
     output.shouldHaveExitValue(1);
 
     pb = ProcessTools.createJavaProcessBuilder(
-        "-XX:+MaxRAMFraction=16", "-version");
+        "-XX:+MaxRAMPercentage=1", "-version");
 
     output = new OutputAnalyzer(pb.start());
-    output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMFraction=16'");
+    output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMPercentage=1'");
     output.shouldHaveExitValue(1);
 
   }
--- a/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java	Sat Sep 09 14:36:45 2017 +0200
@@ -42,7 +42,6 @@
             "-green",
             "-native",
             "-Xrs",
-            "-Xprof",
             "-Xconcurrentio",
             "-Xinternalversion",
             "-Xprintflags",
--- a/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java	Sat Sep 09 14:36:45 2017 +0200
@@ -43,6 +43,9 @@
         {"MaxGCMinorPauseMillis",     "1032"},
         {"MustCallLoadClassInternal", "false"},
         {"UnsyncloadClass",           "false"},
+        {"MaxRAMFraction",            "8"},
+        {"MinRAMFraction",            "2"},
+        {"InitialRAMFraction",        "64"},
 
         // deprecated alias flags (see also aliased_jvm_flags):
         {"DefaultMaxRAMFraction", "4"},
--- a/hotspot/test/runtime/MinimalVM/Xprof.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @requires vm.flavor == "minimal"
- * @modules java.base/jdk.internal.misc
- * @library /test/lib
- * @run driver Xprof
- */
-
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-
-public class Xprof {
-
-    public static void main(String args[]) throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xprof", "-version");
-        new OutputAnalyzer(pb.start())
-                .shouldContain("Flat profiling is not supported in this VM.")
-                .shouldHaveExitValue(1);
-
-    }
-}
--- a/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java	Sat Sep 09 14:36:45 2017 +0200
@@ -205,7 +205,11 @@
             OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
             CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context");
             if (!CDSTestUtils.isUnableToMap(out)) {
-                out.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
+                if (mode.equals("off")) {
+                    out.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
+                } else {
+                    CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context source: shared objects file");
+                }
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/SharedArchiveFile/NonBootLoaderClasses.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,65 @@
+/*
+ * 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 NonBootLoaderClasses
+ * @summary Test to ensure platform and app classes are not being archived
+ * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true)
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @run main NonBootLoaderClasses
+ */
+
+import jdk.test.lib.cds.CDSOptions;
+import jdk.test.lib.cds.CDSTestUtils;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import java.io.File;
+
+public class NonBootLoaderClasses {
+    public static void main(String[] args) throws Exception {
+        final String PLATFORM_CLASS = "jdk/dynalink/DynamicLinker";
+        final String APP_CLASS = "com/sun/tools/javac/Main";
+        String[] classes = {PLATFORM_CLASS, APP_CLASS};
+        String classList =
+            CDSTestUtils.makeClassList(classes).getPath();
+        String archiveName = "NonBootLoaderClasses.jsa";
+        CDSOptions opts = (new CDSOptions())
+            .addPrefix("-XX:ExtraSharedClassListFile=" + classList)
+            .setArchiveName(archiveName);
+        CDSTestUtils.createArchiveAndCheck(opts);
+
+        // Print the shared dictionary and inspect the output
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName,
+                "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary");
+        OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "print-shared-archive");
+        if (!CDSTestUtils.isUnableToMap(out)) {
+            out.shouldContain("archive is valid")
+               .shouldHaveExitValue(0)               // Should report success in error code.
+               .shouldNotContain(PLATFORM_CLASS)
+               .shouldNotContain(APP_CLASS);
+        }
+   }
+}
--- a/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java	Sat Sep 09 14:36:45 2017 +0200
@@ -69,7 +69,7 @@
             "-XX:+UnlockDiagnosticVMOptions",
             "-XX:SharedArchiveFile=" + filename,
             "-Xshare:dump",
-            "--patch-module=java.base=" + System.getProperty("test.classes"),
+            "--patch-module=java.naming=" + System.getProperty("test.classes"),
             "-Xlog:class+path=info",
             "-version");
         new OutputAnalyzer(pb.start())
--- a/jaxp/.hgtags	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxp/.hgtags	Sat Sep 09 14:36:45 2017 +0200
@@ -446,3 +446,4 @@
 ea18d767c9ec50ea7f40bbe6cf7379d3538110f1 jdk-9+181
 f7d596aa57aece4e5f473b1ac97e26cd0aebc647 jdk-10+20
 dcd49f380d7504a49769c26d7bd756623cb9b828 jdk-10+21
+47872600e78b509a15490fe009986d4969794f56 jdk-10+22
--- a/jaxws/.hgtags	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/.hgtags	Sat Sep 09 14:36:45 2017 +0200
@@ -449,3 +449,4 @@
 4f852cc3a1c998e78a989ba4667ffa9b867d9d01 jdk-9+181
 1658a5e7d171e9c3cc2462fac2789ec63294ecca jdk-10+20
 30ed8fb6a1d17e4065d07bc031cf2368aeca8d1e jdk-10+21
+c162c9e4c9c0976c8de44d2377a16a452bb99126 jdk-10+22
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBPermission.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBPermission.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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,15 +41,19 @@
  * and for each provides a description of what the permission allows
  * and a discussion of the risks of granting code the permission.
  *
- * <table border=1 cellpadding=5 summary="Permission target name, what the permission allows, and associated risks">
+ * <table class="striped">
+ * <caption style="display:none">Permission target name, what the permission allows, and associated risks"</caption>
+ * <thead>
  * <tr>
- * <th>Permission Target Name</th>
- * <th>What the Permission Allows</th>
- * <th>Risks of Allowing this Permission</th>
+ * <th scope="col">Permission Target Name</th>
+ * <th scope="col">What the Permission Allows</th>
+ * <th scope="col">Risks of Allowing this Permission</th>
  * </tr>
+ * </thead>
  *
+ * <tbody style="text-align:left">
  * <tr>
- *   <td>setDatatypeConverter</td>
+ *   <th scope="row">setDatatypeConverter</th>
  *   <td>
  *     Allows the code to set VM-wide {@link DatatypeConverterInterface}
  *     via {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) the setDatatypeConverter method}
@@ -63,6 +67,7 @@
  *     another application running in the same JVM.
  *   </td>
  * </tr>
+ * </tbody>
  * </table>
  *
  * @see java.security.BasicPermission
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Marshaller.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Marshaller.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -373,7 +373,7 @@
      *      If the {@link ValidationEventHandler ValidationEventHandler}
      *      returns false from its {@code handleEvent} method or the
      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
-     *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
+     *      object reachable from {@code jaxbElement}).  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#elementMarshalling">
      *      Marshalling a JAXB element</a>.
      * @throws IllegalArgumentException
      *      If any of the method parameters are null
@@ -395,7 +395,7 @@
      *      If the {@link ValidationEventHandler ValidationEventHandler}
      *      returns false from its {@code handleEvent} method or the
      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
-     *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
+     *      object reachable from {@code jaxbElement}).  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#elementMarshalling">
      *      Marshalling a JAXB element</a>.
      * @throws IllegalArgumentException
      *      If any of the method parameters are null
@@ -417,7 +417,7 @@
      *      If the {@link ValidationEventHandler ValidationEventHandler}
      *      returns false from its {@code handleEvent} method or the
      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
-     *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
+     *      object reachable from {@code jaxbElement}).  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#elementMarshalling">
      *      Marshalling a JAXB element</a>.
      * @throws IllegalArgumentException
      *      If any of the method parameters are null
@@ -440,7 +440,7 @@
      *      If the {@link ValidationEventHandler ValidationEventHandler}
      *      returns false from its {@code handleEvent} method or the
      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
-     *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
+     *      object reachable from {@code jaxbElement}).  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#elementMarshalling">
      *      Marshalling a JAXB element</a>.
      * @throws IllegalArgumentException
      *      If any of the method parameters are null
@@ -462,7 +462,7 @@
      *      If the {@link ValidationEventHandler ValidationEventHandler}
      *      returns false from its {@code handleEvent} method or the
      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
-     *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
+     *      object reachable from {@code jaxbElement}).  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#elementMarshalling">
      *      Marshalling a JAXB element</a>.
      * @throws IllegalArgumentException
      *      If any of the method parameters are null
@@ -488,7 +488,7 @@
      *      If the {@link ValidationEventHandler ValidationEventHandler}
      *      returns false from its {@code handleEvent} method or the
      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
-     *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
+     *      object reachable from {@code jaxbElement}).  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#elementMarshalling">
      *      Marshalling a JAXB element</a>.
      * @throws IllegalArgumentException
      *      If any of the method parameters are null
@@ -511,7 +511,7 @@
      *      If the {@link ValidationEventHandler ValidationEventHandler}
      *      returns false from its {@code handleEvent} method or the
      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
-     *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
+     *      object reachable from {@code jaxbElement}).  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#elementMarshalling">
      *      Marshalling a JAXB element</a>.
      * @throws IllegalArgumentException
      *      If any of the method parameters are null
@@ -535,7 +535,7 @@
      *      If the {@link ValidationEventHandler ValidationEventHandler}
      *      returns false from its {@code handleEvent} method or the
      *      {@code Marshaller} is unable to marshal {@code jaxbElement} (or any
-     *      object reachable from {@code jaxbElement}).  See <a href="#elementMarshalling">
+     *      object reachable from {@code jaxbElement}).  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#elementMarshalling">
      *      Marshalling a JAXB element</a>.
      * @throws IllegalArgumentException
      *      If any of the method parameters are null
@@ -575,7 +575,7 @@
      * {@code Marshaller}.  This method can only be used to set one of
      * the standard JAXB defined properties above or a provider specific
      * property.  Attempting to set an undefined property will result in
-     * a PropertyException being thrown.  See <a href="#supportedProps">
+     * a PropertyException being thrown.  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#supportedProps">
      * Supported Properties</a>.
      *
      * @param name the name of the property to be set. This value can either
@@ -596,7 +596,7 @@
      * {@code Marshaller}.  This method can only be used to get one of
      * the standard JAXB defined properties above or a provider specific
      * property.  Attempting to get an undefined property will result in
-     * a PropertyException being thrown.  See <a href="#supportedProps">
+     * a PropertyException being thrown.  See <a href="{@docRoot}/javax/xml/bind/Marshaller.html#supportedProps">
      * Supported Properties</a>.
      *
      * @param name the name of the property to retrieve
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java	Sat Sep 09 14:36:45 2017 +0200
@@ -186,13 +186,13 @@
  * Unmarshalling can deserialize XML data that represents either an entire XML document
  * or a subtree of an XML document. Typically, it is sufficient to use the
  * unmarshalling methods described by
- * <a href="#unmarshalGlobal">Unmarshal root element that is declared globally</a>.
+ * <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal root element that is declared globally</a>.
  * These unmarshal methods utilize {@link JAXBContext}'s mapping of global XML element
  * declarations and type definitions to JAXB mapped classes to initiate the
  * unmarshalling of the root element of  XML data.  When the {@link JAXBContext}'s
  * mappings are not sufficient to unmarshal the root element of XML data,
  * the application can assist the unmarshalling process by using the
- * <a href="#unmarshalByDeclaredType">unmarshal by declaredType methods</a>.
+ * <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalByDeclaredType">unmarshal by declaredType methods</a>.
  * These methods are useful for unmarshalling XML data where
  * the root element corresponds to a local element declaration in the schema.
  * </blockquote>
@@ -245,32 +245,29 @@
  * instance are set.
  *
  * <a name="unmarshalDeclaredTypeReturn"></a>
- *   <table summary="" border="2" rules="all" cellpadding="4">
+ *   <table class="striped">
+ *   <caption>Unmarshal By Declared Type returned JAXBElement</caption>
  *   <thead>
  *     <tr>
- *       <th align="center" colspan="2">
- *       Unmarshal By Declared Type returned JAXBElement
- *       </tr>
- *     <tr>
- *       <th>JAXBElement Property</th>
- *       <th>Value</th>
+ *       <th scope="col">JAXBElement Property</th>
+ *       <th scope="col">Value</th>
  *     </tr>
  *     <tr>
- *       <td>name</td>
- *       <td>{@code xml element name}</td>
+ *       <th scope="col">name</th>
+ *       <th scope="col">{@code xml element name}</th>
  *     </tr>
  *   </thead>
  *   <tbody>
  *     <tr>
- *       <td>value</td>
+ *       <th scope="row">value</th>
  *       <td>{@code instanceof declaredType}</td>
  *     </tr>
  *     <tr>
- *       <td>declaredType</td>
+ *       <th scope="row">declaredType</th>
  *       <td>unmarshal method {@code declaredType} parameter</td>
  *     </tr>
  *     <tr>
- *       <td>scope</td>
+ *       <th scope="row">scope</th>
  *       <td>{@code null} <i>(actual scope is unknown)</i></td>
  *     </tr>
  *   </tbody>
@@ -279,7 +276,7 @@
  *
  * <p>
  * The following is an example of
- * <a href="#unmarshalByDeclaredType">unmarshal by declaredType method</a>.
+ * <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalByDeclaredType">unmarshal by declaredType method</a>.
  * <p>
  * Unmarshal by declaredType from a {@code org.w3c.dom.Node}:
  * <blockquote>
@@ -414,7 +411,7 @@
      * content tree.
      *
      * <p>
-     * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal Global Root Element</a>.
      *
      * @param f the file to unmarshal XML data from
      * @return the newly created root object of the java content tree
@@ -425,7 +422,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If the file parameter is null
      */
@@ -437,7 +434,7 @@
      * be incomplete when using this form of the unmarshal API.
      *
      * <p>
-     * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal Global Root Element</a>.
      *
      * @param is the InputStream to unmarshal XML data from
      * @return the newly created root object of the java content tree
@@ -448,7 +445,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If the InputStream parameter is null
      */
@@ -461,7 +458,7 @@
      * because a Reader does not provide the system ID.
      *
      * <p>
-     * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal Global Root Element</a>.
      *
      * @param reader the Reader to unmarshal XML data from
      * @return the newly created root object of the java content tree
@@ -472,7 +469,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If the InputStream parameter is null
      * @since 1.6, JAXB 2.0
@@ -484,7 +481,7 @@
      * content tree.
      *
      * <p>
-     * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal Global Root Element</a>.
      *
      * @param url the url to unmarshal XML data from
      * @return the newly created root object of the java content tree
@@ -495,7 +492,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If the URL parameter is null
      */
@@ -506,7 +503,7 @@
      * resulting content tree.
      *
      * <p>
-     * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal Global Root Element</a>.
      *
      * @param source the input source to unmarshal XML data from
      * @return the newly created root object of the java content tree
@@ -517,7 +514,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If the InputSource parameter is null
      */
@@ -528,7 +525,7 @@
      * content tree.
      *
      * <p>
-     * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal Global Root Element</a>.
      *
      * @param node
      *      the document/element to unmarshal XML data from.
@@ -541,7 +538,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If the Node parameter is null
      * @see #unmarshal(org.w3c.dom.Node, Class)
@@ -553,7 +550,7 @@
      * and return the resulting content tree.
      *
      * <p>
-     * Implements <a href="#unmarshalByDeclaredType">Unmarshal by Declared Type</a>
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalByDeclaredType">Unmarshal by Declared Type</a>
      *
      * @param node
      *      the document/element to unmarshal XML data from.
@@ -561,7 +558,7 @@
      * @param declaredType
      *      appropriate JAXB mapped class to hold {@code node}'s XML data.
      *
-     * @return <a href="#unmarshalDeclaredTypeReturn">JAXB Element</a> representation of {@code node}
+     * @return <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalDeclaredTypeReturn">JAXB Element</a> representation of {@code node}
      *
      * @throws JAXBException
      *     If any unexpected errors occur while unmarshalling
@@ -569,7 +566,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If any parameter is null
      * @since 1.6, JAXB 2.0
@@ -581,7 +578,7 @@
      * resulting content tree.
      *
      * <p>
-     * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal Global Root Element</a>.
      *
      * <p>
      * <a name="saxParserPlugable"></a>
@@ -627,7 +624,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If the Source parameter is null
      * @see #unmarshal(javax.xml.transform.Source, Class)
@@ -641,16 +638,16 @@
      * resulting content tree.
      *
      * <p>
-     * Implements <a href="#unmarshalByDeclaredType">Unmarshal by Declared Type</a>
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalByDeclaredType">Unmarshal by Declared Type</a>
      *
      * <p>
-     * See <a href="#saxParserPlugable">SAX 2.0 Parser Pluggability</a>
+     * See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#saxParserPlugable">SAX 2.0 Parser Pluggability</a>
      *
      * @param source the XML Source to unmarshal XML data from (providers are
      *        only required to support SAXSource, DOMSource, and StreamSource)
      * @param declaredType
      *      appropriate JAXB mapped class to hold {@code source}'s xml root element
-     * @return Java content rooted by <a href="#unmarshalDeclaredTypeReturn">JAXB Element</a>
+     * @return Java content rooted by <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalDeclaredTypeReturn">JAXB Element</a>
      *
      * @throws JAXBException
      *     If any unexpected errors occur while unmarshalling
@@ -658,7 +655,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If any parameter is null
      * @since 1.6, JAXB 2.0
@@ -671,7 +668,7 @@
      * resulting content tree.
      *
      * <p>
-     * Implements <a href="#unmarshalGlobal">Unmarshal Global Root Element</a>.
+     * Implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal Global Root Element</a>.
      *
      * <p>
      * This method assumes that the parser is on a START_DOCUMENT or
@@ -691,7 +688,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If the {@code reader} parameter is null
      * @throws IllegalStateException
@@ -708,7 +705,7 @@
      * and return the resulting content tree.
      *
      * <p>
-     * This method implements <a href="#unmarshalByDeclaredType">unmarshal by declaredType</a>.
+     * This method implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalByDeclaredType">unmarshal by declaredType</a>.
      * <p>
      * This method assumes that the parser is on a START_DOCUMENT or
      * START_ELEMENT event. Unmarshalling will be done from this
@@ -721,7 +718,7 @@
      * @param declaredType
      *      appropriate JAXB mapped class to hold {@code reader}'s START_ELEMENT XML data.
      *
-     * @return   content tree rooted by <a href="#unmarshalDeclaredTypeReturn">JAXB Element representation</a>
+     * @return   content tree rooted by <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalDeclaredTypeReturn">JAXB Element representation</a>
      *
      * @throws JAXBException
      *     If any unexpected errors occur while unmarshalling
@@ -729,7 +726,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If any parameter is null
      * @since 1.6, JAXB 2.0
@@ -741,7 +738,7 @@
      * resulting content tree.
      *
      * <p>
-     * This method is an <a href="#unmarshalGlobal">Unmarshal Global Root method</a>.
+     * This method is an <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalGlobal">Unmarshal Global Root method</a>.
      *
      * <p>
      * This method assumes that the parser is on a START_DOCUMENT or
@@ -761,7 +758,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If the {@code reader} parameter is null
      * @throws IllegalStateException
@@ -778,7 +775,7 @@
      * and return the resulting content tree.
      *
      * <p>
-     * This method implements <a href="#unmarshalByDeclaredType">unmarshal by declaredType</a>.
+     * This method implements <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalByDeclaredType">unmarshal by declaredType</a>.
      *
      * <p>
      * This method assumes that the parser is on a START_DOCUMENT or
@@ -792,7 +789,7 @@
      * @param declaredType
      *      appropriate JAXB mapped class to hold {@code reader}'s START_ELEMENT XML data.
      *
-     * @return   content tree rooted by <a href="#unmarshalDeclaredTypeReturn">JAXB Element representation</a>
+     * @return   content tree rooted by <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalDeclaredTypeReturn">JAXB Element representation</a>
      *
      * @throws JAXBException
      *     If any unexpected errors occur while unmarshalling
@@ -800,7 +797,7 @@
      *     If the {@link ValidationEventHandler ValidationEventHandler}
      *     returns false from its {@code handleEvent} method or the
      *     {@code Unmarshaller} is unable to perform the XML to Java
-     *     binding.  See <a href="#unmarshalEx">Unmarshalling XML Data</a>
+     *     binding.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#unmarshalEx">Unmarshalling XML Data</a>
      * @throws IllegalArgumentException
      *      If any parameter is null
      * @since 1.6, JAXB 2.0
@@ -913,7 +910,7 @@
      * {@code Unmarshaller}.  This method can only be used to set one of
      * the standard JAXB defined properties above or a provider specific
      * property.  Attempting to set an undefined property will result in
-     * a PropertyException being thrown.  See <a href="#supportedProps">
+     * a PropertyException being thrown.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#supportedProps">
      * Supported Properties</a>.
      *
      * @param name the name of the property to be set. This value can either
@@ -934,7 +931,7 @@
      * {@code Unmarshaller}.  This method can only be used to get one of
      * the standard JAXB defined properties above or a provider specific
      * property.  Attempting to get an undefined property will result in
-     * a PropertyException being thrown.  See <a href="#supportedProps">
+     * a PropertyException being thrown.  See <a href="{@docRoot}/javax/xml/bind/Unmarshaller.html#supportedProps">
      * Supported Properties</a>.
      *
      * @param name the name of the property to retrieve
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlNsForm.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlNsForm.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,23 +36,26 @@
  * The namespace qualification values are used in the annotations
  * defined in this packge. The enumeration values are mapped as follows:
  *
- * <table summary="" border="1" cellpadding="4" cellspacing="3">
+ * <table class="striped">
+ *   <caption style="display:none">Mapping of enumeration values</caption>
+ *   <thead>
+ *     <tr>
+ *       <th scope="col">Enum Value</th>
+ *       <th scope="col">XML Schema Value</th>
+ *     </tr>
+ *   </thead>
+ *
  *   <tbody>
  *     <tr>
- *       <td><b>Enum Value</b></td>
- *       <td><b>XML Schema Value</b></td>
- *     </tr>
- *
- *     <tr valign="top">
- *       <td>UNQUALIFIED</td>
+ *       <th scope="row">UNQUALIFIED</th>
  *       <td>unqualified</td>
  *     </tr>
- *     <tr valign="top">
- *       <td>QUALIFIED</td>
+ *     <tr>
+ *       <th scope="row">QUALIFIED</th>
  *       <td>qualified</td>
  *     </tr>
- *     <tr valign="top">
- *       <td>UNSET</td>
+ *     <tr>
+ *       <th scope="row">UNSET</th>
  *       <td>namespace qualification attribute is absent from the
  *           XML Schema fragment</td>
  *     </tr>
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,58 +113,60 @@
  * complex type or simple type. The notational symbols used in the table are:
  * <ul>
  *   <li> {@literal ->}    : represents a mapping </li>
- *   <li> [x]+  : one or more occurances of x </li>
+ *   <li> [x]+  : one or more occurrences of x </li>
  *   <li> [ {@code @XmlValue} property ]: JavaBean property annotated with
  *         {@code @XmlValue}</li>
  *   <li> X     : don't care
  * </ul>
  * <blockquote>
- *   <table summary="" border="1" cellpadding="4" cellspacing="3">
+ *   <table class="striped">
+ *     <thead>
+ *       <tr>
+ *         <th scope="col">Target</th>
+ *         <th scope="col">propOrder</th>
+ *         <th scope="col">ClassBody</th>
+ *         <th scope="col">ComplexType</th>
+ *         <th scope="col">SimpleType</th>
+ *       </tr>
+ *     </thead>
+ *
  *     <tbody>
  *       <tr>
- *         <td><b>Target</b></td>
- *         <td><b>propOrder</b></td>
- *         <td><b>ClassBody</b></td>
- *         <td><b>ComplexType</b></td>
- *         <td><b>SimpleType</b></td>
- *       </tr>
- *
- *       <tr valign="top">
  *         <td>Class</td>
  *         <td>{}</td>
- *         <td>[property]+ {@literal ->} elements</td>
+ *         <th scope="row">[property]+ {@literal ->} elements</th>
  *         <td>complexcontent<br>xs:all</td>
  *         <td> </td>
  *       </tr>
  *
- *       <tr valign="top">
+ *       <tr>
  *         <td>Class</td>
  *         <td>non empty</td>
- *         <td>[property]+ {@literal ->} elements</td>
+ *         <th scope="row">[property]+ {@literal ->} elements</th>
  *         <td>complexcontent<br>xs:sequence</td>
  *         <td> </td>
  *       </tr>
  *
- *       <tr valign="top">
+ *       <tr>
  *         <td>Class</td>
  *         <td>X</td>
- *         <td>no property {@literal ->} element</td>
+ *         <th scope="row">no property {@literal ->} element</th>
  *         <td>complexcontent<br>empty sequence</td>
  *         <td> </td>
  *       </tr>
  *
- *       <tr valign="top">
+ *       <tr>
  *         <td>Class</td>
  *         <td>X</td>
- *         <td>1 [{@code @XmlValue} property] {@literal &&} <br> [property]+ {@literal ->} attributes</td>
+ *         <th scope="row">1 [{@code @XmlValue} property] {@literal &&} <br> [property]+ {@literal ->} attributes</th>
  *         <td>simplecontent</td>
  *         <td> </td>
  *       </tr>
  *
- *       <tr valign="top">
+ *       <tr>
  *         <td>Class</td>
  *         <td>X</td>
- *         <td>1 [{@code @XmlValue} property] {@literal &&} <br> no properties {@literal ->} attribute</td>
+ *         <th scope="row">1 [{@code @XmlValue} property] {@literal &&} <br> no properties {@literal ->} attribute</th>
  *         <td> </td>
  *         <td>simpletype</td>
  *       </tr>
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -26,13 +26,13 @@
 /**
  * {@link javax.xml.bind.annotation.adapters.XmlAdapter} and its spec-defined
  * sub-classes to allow arbitrary Java classes to be used with JAXB.
- * <p>
+ *
  * <h2>Package Specification</h2>
- * <p>
+ *
  * <ul>
  * <li><a href="http://jcp.org/en/jsr/detail?id=222">JAXB Specification</a>
  * </ul>
- * <p>
+ *
  * <h2>Related Documentation</h2>
  * <p>
  * For overviews, tutorials, examples, guides, and tool documentation,
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package.html	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!--
- Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
- 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.
--->
-
-<html>
-    <head>
-
-
-    </head>
-
-    <body>
-        <p>
-        {@link javax.xml.bind.annotation.adapters.XmlAdapter} and its spec-defined
-        sub-classes to allow arbitrary Java classes to be used with JAXB.
-
-        <h2>Package Specification</h2>
-
-        <ul>
-            <li><a href="http://jcp.org/en/jsr/detail?id=222">JAXB Specification</a>
-        </ul>
-
-        <h2>Related Documentation</h2>
-
-        For overviews, tutorials, examples, guides, and tool documentation,
-        please see:
-        <ul>
-            <li>The <a href="http://jaxb.java.net">JAXB Website</a>
-        </ul>
-
-        <!-- Put @see and @since tags down here. -->
-
-    </body>
-</html>
-
-
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/package.html	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/package.html	Sat Sep 09 14:36:45 2017 +0200
@@ -1,6 +1,6 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!DOCTYPE HTML>
 <!--
- Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
 
     </head>
 
-    <body bgcolor="white">
+    <body>
 
         <p>
         Defines annotations for customizing Java program elements to XML Schema mapping.
@@ -39,172 +39,92 @@
         <p>The following table shows the JAXB mapping annotations
            that can be associated with each program element. </p>
 
-        <table border="1" cellpadding="4" cellspacing="3"> 
-          <tbody>
+        <table class="striped"> 
+          <thead>
             <tr>
-              <td><b>Program Element</b></td>
-              <td><b>JAXB annotation</b></td>
+              <th scope="col">Program Element</th>
+              <th scope="col">JAXB annotation</th>
             </tr>
-            <tr valign="top">
-              <td><b>Package</b></td>
+          </thead>
+          <tbody style="text-align:left">
+            <tr>
+              <th scope="row" style="vertical-align:top">Package</th>
               <td>
-                <table>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlAccessorOrder.html">XmlAccessorOrder</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlAccessorType.html">XmlAccessorType</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlSchema.html">XmlSchema</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlSchemaType.html">XmlSchemaType</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlSchemaTypes.html">XmlSchemaTypes</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.html">XmlJavaTypeAdapters</a></b></td>
-                  </tr>
-                </table>
+		<ul style="list-style-type:none; padding-left:0; margin:0">
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlAccessorOrder.html">XmlAccessorOrder</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlAccessorType.html">XmlAccessorType</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlSchema.html">XmlSchema</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlSchemaType.html">XmlSchemaType</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlSchemaTypes.html">XmlSchemaTypes</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.html">XmlJavaTypeAdapters</a></li>
+                </ul>
               </td>
             </tr>
 
-            <tr valign="top">
-              <td><b>Class</b></td>
+            <tr>
+              <th scope="row" style="vertical-align:top">Class</th>
               <td>
-                <table> 
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlAccessorOrder.html">XmlAccessorOrder</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlAccessorType.html">XmlAccessorType</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlInlineBinaryData.html">XmlInlineBinaryData</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlRootElement.html">XmlRootElement</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlType.html">XmlType</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></b></td>
-                  </tr>
-                </table>
+		<ul style="list-style-type:none; padding-left:0; margin:0">
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlAccessorOrder.html">XmlAccessorOrder</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlAccessorType.html">XmlAccessorType</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlInlineBinaryData.html">XmlInlineBinaryData</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlRootElement.html">XmlRootElement</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlType.html">XmlType</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></li>
+		</ul>
               </td>
             </tr>
 
-            <tr valign="top">
-              <td><b>Enum type</b></td>
+            <tr>
+              <th scope="row" style="vertical-align:top">Enum type</th>
               <td>
-                <table> 
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlEnum.html">XmlEnum</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlEnumValue.html">XmlEnumValue (enum constant only)</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlRootElement.html">XmlRootElement</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlType.html">XmlType</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></b></td>
-                  </tr>
-                </table>
+		<ul style="list-style-type:none; padding-left:0; margin:0">
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlEnum.html">XmlEnum</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlEnumValue.html">XmlEnumValue (enum constant only)</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlRootElement.html">XmlRootElement</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlType.html">XmlType</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></li>
+		</ul>
               </td>
             </tr>
 
-            <tr valign="top">
-              <td><b>JavaBean Property/field</b></td>
+            <tr>
+              <th scope="row" style="vertical-align:top">JavaBean Property/field</th>
               <td>
-                <table> 
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlElement.html">XmlElement</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlElements.html">XmlElements</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlElementRef.html">XmlElementRef</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlElementRefs.html">XmlElementRefs</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlElementWrapper.html">XmlElementWrapper</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlAnyElement.html">XmlAnyElement</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlAttribute.html">XmlAttribute</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlAnyAttribute.html">XmlAnyAttribute</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlTransient.html">XmlTransient</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlValue.html">XmlValue</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlID.html">XmlID</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlIDREF.html">XmlIDREF</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlList.html">XmlList</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlMixed.html">XmlMixed</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlMimeType.html">XmlMimeType</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlAttachmentRef.html">XmlAttachmentRef</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlInlineBinaryData.html">XmlInlineBinaryData</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlElementDecl.html">XmlElementDecl (only on method)</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></b></td>
-                  </tr>
-                </table>
+		<ul style="list-style-type:none; padding-left:0; margin:0">
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlElement.html">XmlElement</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlElements.html">XmlElements</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlElementRef.html">XmlElementRef</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlElementRefs.html">XmlElementRefs</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlElementWrapper.html">XmlElementWrapper</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlAnyElement.html">XmlAnyElement</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlAttribute.html">XmlAttribute</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlAnyAttribute.html">XmlAnyAttribute</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlTransient.html">XmlTransient</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlValue.html">XmlValue</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlID.html">XmlID</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlIDREF.html">XmlIDREF</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlList.html">XmlList</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlMixed.html">XmlMixed</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlMimeType.html">XmlMimeType</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlAttachmentRef.html">XmlAttachmentRef</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlInlineBinaryData.html">XmlInlineBinaryData</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlElementDecl.html">XmlElementDecl (only on method)</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></li>
+		</ul>
               </td>
             </tr>
 
-            <tr valign="top">
-              <td><b>Parameter</b></td>
+            <tr>
+              <th scope="row" style="vertical-align:top">Parameter</th>
               <td>
-                <table> 
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlList.html">XmlList</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlAttachmentRef.html">XmlAttachmentRef</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/XmlMimeType.html">XmlMimeType</a></b></td>
-                  </tr>
-                  <tr valign="top">
-                    <td><b><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></b></td>
-                  </tr>
-                </table>
+		<ul style="list-style-type:none; padding-left:0; margin:0">
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlList.html">XmlList</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlAttachmentRef.html">XmlAttachmentRef</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/XmlMimeType.html">XmlMimeType</a></li>
+                    <li><a HREF="../../../../javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html">XmlJavaTypeAdapter</a></li>
+		</ul>
               </td>
             </tr>
 
@@ -252,26 +172,28 @@
          <p>The following namespace prefixes are used in the XML Schema
            fragments in this package.
 
-        <table border="1" cellpadding="4" cellspacing="3">
-          <tbody>
+        <table class="striped">
+          <thead>
             <tr>
-              <td><b>Prefix</b></td>
-              <td><b>Namespace</b></td>
-              <td><b>Notes</b></td>
+              <th scope="col">Prefix</th>
+              <th scope="col">Namespace</th>
+              <th scope="col">Notes</th>
            </tr>
+          </thead>
  
-           <tr valign="top">
-             <td>xs</td>
+          <tbody>
+           <tr>
+             <th scope="row">xs</th>
              <td>http://www.w3.org/2001/XMLSchema</td>
              <td>Namespace of XML Schema namespace</td>
            </tr>
-           <tr valign="top">
-             <td>ref</td>
+           <tr>
+             <th scope="row">ref</th>
              <td>http://ws-i.org/profiles/basic/1.1/xsd</td>
              <td>Namespace for swaref schema component</td>
            </tr>
-           <tr valign="top">
-             <td>xsi</td>
+           <tr>
+             <th scope="row">xsi</th>
              <td>http://www.w3.org/2001/XMLSchema-instance</td>
              <td>XML Schema namespace for instances</td>
            </tr>
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/attachment/AttachmentUnmarshaller.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/attachment/AttachmentUnmarshaller.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,32 +72,29 @@
     *
     * <p>The returned {@code DataHandler} instance must be configured
     * to meet the following required mapping constaint.
-    * <table summary="" border="2" rules="all" cellpadding="4">
+    * <table class="striped">
+    *   <caption>Required Mappings between MIME and Java Types</caption>
     *   <thead>
     *     <tr>
-    *       <th align="center" colspan="2">
-    *       Required Mappings between MIME and Java Types
-    *       </tr>
-    *     <tr>
-    *       <th>MIME Type</th>
-    *       <th>Java Type</th>
+    *       <th scope="col">MIME Type</th>
+    *       <th scope="col">Java Type</th>
     *     </tr>
     *     <tr>
-    *       <th>{@code DataHandler.getContentType()}</th>
-    *       <th>{@code instanceof DataHandler.getContent()}</th>
+    *       <th scope="col">{@code DataHandler.getContentType()}</th>
+    *       <th scope="col">{@code instanceof DataHandler.getContent()}</th>
     *     </tr>
     *   </thead>
-    *   <tbody>
+    *   <tbody style="text-align:left">
     *     <tr>
-    *       <td>image/gif</td>
+    *       <th scope="row">image/gif</th>
     *       <td>java.awt.Image</td>
     *     </tr>
     *     <tr>
-    *       <td>image/jpeg</td>
+    *       <th scope="row">image/jpeg</th>
     *       <td>java.awt.Image</td>
     *     </tr>
     *     <tr>
-    *       <td>text/xml  or application/xml</td>
+    *       <th scope="row">text/xml  or application/xml</th>
     *       <td>javax.xml.transform.Source</td>
     *     </tr>
     *   </tbody>
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/helpers/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/helpers/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -26,17 +26,17 @@
 /**
  * <B>JAXB Provider Use Only:</b> Provides partial default implementations for
  * some of the <code>javax.xml.bind</code> interfaces.
- * <p>
+ *
  * <p>
  * JAXB Providers can extend these classes and implement the abstract
  * methods.
- * <p>
+ *
  * <h2>Package Specification</h2>
- * <p>
+ *
  * <ul>
  * <li><a href="https://jaxb.java.net/">JAXB Specification</a>
  * </ul>
- * <p>
+ *
  * <h2>Related Documentation</h2>
  * <p>
  * For overviews, tutorials, examples, guides, and tool documentation,
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/helpers/package.html	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!--
- Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- 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.
--->
-
-<html>
-    <head>
-
-
-    </head>
-
-    <body bgcolor="white">
-
-        <p>
-        <B>JAXB Provider Use Only:</b> Provides partial default implementations for 
-        some of the <code>javax.xml.bind</code> interfaces.
-
-        <p>
-        JAXB Providers can extend these classes and implement the abstract 
-        methods.
- 
-        <h2>Package Specification</h2>
-
-        <ul>
-            <li><a href="https://jaxb.java.net/">JAXB
-                Specification</a>
-        </ul>
-
-        <h2>Related Documentation</h2>
-
-        For overviews, tutorials, examples, guides, and tool documentation, 
-        please see:
-        <ul>
-            <li>The <a href="https://jaxb.java.net/">JAXB
-            Website</a>
-        </ul>
-
-        <!-- Put @see and @since tags down here. -->
-
-    </body>
-</html>
-
-
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -25,13 +25,13 @@
 
 /**
  * Useful client utility classes.
- * <p>
+ *
  * <h2>Package Specification</h2>
- * <p>
+ *
  * <ul>
  * <li><a href="https://jaxb.java.net/">JAXB Specification</a>
  * </ul>
- * <p>
+ *
  * <h2>Related Documentation</h2>
  * <p>
  * For overviews, tutorials, examples, guides, and tool documentation,
--- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package.html	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!--
- Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- 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.
--->
-
-<html>
-    <head>
-
-
-    </head>
-
-    <body bgcolor="white">
-
-        <p>
-        Useful client utility classes.
-
-        <h2>Package Specification</h2>
-
-        <ul>
-            <li><a href="https://jaxb.java.net/">JAXB
-                Specification</a>
-        </ul>
-
-        <h2>Related Documentation</h2>
-
-        For overviews, tutorials, examples, guides, and tool documentation, 
-        please see:
-        <ul>
-            <li>The <a href="https://jaxb.java.net/">JAXB
-            Website</a>
-        </ul>
-
-        <!-- Put @see and @since tags down here. -->
-
-    </body>
-</html>
-
-
--- a/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,7 +145,7 @@
      * Sets the {@code endpointName} as
      * {@code wsam:ServiceName/@EndpointName} in the
      * {@code wsa:Metadata} element. This method can only be called
-     * after the {@link #serviceName} method has been called.
+     * after the {@link #serviceName(QName)} method has been called.
      * <p>
      * See <a href="http://www.w3.org/TR/2007/REC-ws-addr-metadata-20070904/#refmetadatfromepr">
      * 2.1 Referencing WSDL Metadata from an EPR</a> for more details.
--- a/jdk/.hgtags	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/.hgtags	Sat Sep 09 14:36:45 2017 +0200
@@ -446,3 +446,4 @@
 bd66ea2fdde3d60a73b5272263a7b8b0ca926a33 jdk-9+181
 6256e94781f55e6f9e04eb284298d00eb9c5e106 jdk-10+20
 4e08a69241eab6e7a67a819a7b4fe29e7398855d jdk-10+21
+83720375178f919700dfbbd90650f8c8e0cf34f2 jdk-10+22
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/charsetmapping/ISO_8859_16.map	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,258 @@
+# Confirmed with the mapping at
+# http://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-16.TXT
+0x00    U+0000
+0x01    U+0001
+0x02    U+0002
+0x03    U+0003
+0x04    U+0004
+0x05    U+0005
+0x06    U+0006
+0x07    U+0007
+0x08    U+0008
+0x09    U+0009
+0x0A    U+000A
+0x0B    U+000B
+0x0C    U+000C
+0x0D    U+000D
+0x0E    U+000E
+0x0F    U+000F
+0x10    U+0010
+0x11    U+0011
+0x12    U+0012
+0x13    U+0013
+0x14    U+0014
+0x15    U+0015
+0x16    U+0016
+0x17    U+0017
+0x18    U+0018
+0x19    U+0019
+0x1A    U+001A
+0x1B    U+001B
+0x1C    U+001C
+0x1D    U+001D
+0x1E    U+001E
+0x1F    U+001F
+0x20    U+0020
+0x21    U+0021
+0x22    U+0022
+0x23    U+0023
+0x24    U+0024
+0x25    U+0025
+0x26    U+0026
+0x27    U+0027
+0x28    U+0028
+0x29    U+0029
+0x2A    U+002A
+0x2B    U+002B
+0x2C    U+002C
+0x2D    U+002D
+0x2E    U+002E
+0x2F    U+002F
+0x30    U+0030
+0x31    U+0031
+0x32    U+0032
+0x33    U+0033
+0x34    U+0034
+0x35    U+0035
+0x36    U+0036
+0x37    U+0037
+0x38    U+0038
+0x39    U+0039
+0x3A    U+003A
+0x3B    U+003B
+0x3C    U+003C
+0x3D    U+003D
+0x3E    U+003E
+0x3F    U+003F
+0x40    U+0040
+0x41    U+0041
+0x42    U+0042
+0x43    U+0043
+0x44    U+0044
+0x45    U+0045
+0x46    U+0046
+0x47    U+0047
+0x48    U+0048
+0x49    U+0049
+0x4A    U+004A
+0x4B    U+004B
+0x4C    U+004C
+0x4D    U+004D
+0x4E    U+004E
+0x4F    U+004F
+0x50    U+0050
+0x51    U+0051
+0x52    U+0052
+0x53    U+0053
+0x54    U+0054
+0x55    U+0055
+0x56    U+0056
+0x57    U+0057
+0x58    U+0058
+0x59    U+0059
+0x5A    U+005A
+0x5B    U+005B
+0x5C    U+005C
+0x5D    U+005D
+0x5E    U+005E
+0x5F    U+005F
+0x60    U+0060
+0x61    U+0061
+0x62    U+0062
+0x63    U+0063
+0x64    U+0064
+0x65    U+0065
+0x66    U+0066
+0x67    U+0067
+0x68    U+0068
+0x69    U+0069
+0x6A    U+006A
+0x6B    U+006B
+0x6C    U+006C
+0x6D    U+006D
+0x6E    U+006E
+0x6F    U+006F
+0x70    U+0070
+0x71    U+0071
+0x72    U+0072
+0x73    U+0073
+0x74    U+0074
+0x75    U+0075
+0x76    U+0076
+0x77    U+0077
+0x78    U+0078
+0x79    U+0079
+0x7A    U+007A
+0x7B    U+007B
+0x7C    U+007C
+0x7D    U+007D
+0x7E    U+007E
+0x7F    U+007F
+0x80    U+0080
+0x81    U+0081
+0x82    U+0082
+0x83    U+0083
+0x84    U+0084
+0x85    U+0085
+0x86    U+0086
+0x87    U+0087
+0x88    U+0088
+0x89    U+0089
+0x8A    U+008A
+0x8B    U+008B
+0x8C    U+008C
+0x8D    U+008D
+0x8E    U+008E
+0x8F    U+008F
+0x90    U+0090
+0x91    U+0091
+0x92    U+0092
+0x93    U+0093
+0x94    U+0094
+0x95    U+0095
+0x96    U+0096
+0x97    U+0097
+0x98    U+0098
+0x99    U+0099
+0x9A    U+009A
+0x9B    U+009B
+0x9C    U+009C
+0x9D    U+009D
+0x9E    U+009E
+0x9F    U+009F
+0xA0    U+00A0
+0xA1    U+0104
+0xA2    U+0105
+0xA3    U+0141
+0xA4    U+20AC
+0xA5    U+201E
+0xA6    U+0160
+0xA7    U+00A7
+0xA8    U+0161
+0xA9    U+00A9
+0xAA    U+0218
+0xAB    U+00AB
+0xAC    U+0179
+0xAD    U+00AD
+0xAE    U+017A
+0xAF    U+017B
+0xB0    U+00B0
+0xB1    U+00B1
+0xB2    U+010C
+0xB3    U+0142
+0xB4    U+017D
+0xB5    U+201D
+0xB6    U+00B6
+0xB7    U+00B7
+0xB8    U+017E
+0xB9    U+010D
+0xBA    U+0219
+0xBB    U+00BB
+0xBC    U+0152
+0xBD    U+0153
+0xBE    U+0178
+0xBF    U+017C
+0xC0    U+00C0
+0xC1    U+00C1
+0xC2    U+00C2
+0xC3    U+0102
+0xC4    U+00C4
+0xC5    U+0106
+0xC6    U+00C6
+0xC7    U+00C7
+0xC8    U+00C8
+0xC9    U+00C9
+0xCA    U+00CA
+0xCB    U+00CB
+0xCC    U+00CC
+0xCD    U+00CD
+0xCE    U+00CE
+0xCF    U+00CF
+0xD0    U+0110
+0xD1    U+0143
+0xD2    U+00D2
+0xD3    U+00D3
+0xD4    U+00D4
+0xD5    U+0150
+0xD6    U+00D6
+0xD7    U+015A
+0xD8    U+0170
+0xD9    U+00D9
+0xDA    U+00DA
+0xDB    U+00DB
+0xDC    U+00DC
+0xDD    U+0118
+0xDE    U+021A
+0xDF    U+00DF
+0xE0    U+00E0
+0xE1    U+00E1
+0xE2    U+00E2
+0xE3    U+0103
+0xE4    U+00E4
+0xE5    U+0107
+0xE6    U+00E6
+0xE7    U+00E7
+0xE8    U+00E8
+0xE9    U+00E9
+0xEA    U+00EA
+0xEB    U+00EB
+0xEC    U+00EC
+0xED    U+00ED
+0xEE    U+00EE
+0xEF    U+00EF
+0xF0    U+0111
+0xF1    U+0144
+0xF2    U+00F2
+0xF3    U+00F3
+0xF4    U+00F4
+0xF5    U+0151
+0xF6    U+00F6
+0xF7    U+015B
+0xF8    U+0171
+0xF9    U+00F9
+0xFA    U+00FA
+0xFB    U+00FB
+0xFC    U+00FC
+0xFD    U+0119
+0xFE    U+021B
+0xFF    U+00FF
--- a/jdk/make/data/charsetmapping/charsets	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/make/data/charsetmapping/charsets	Sat Sep 09 14:36:45 2017 +0200
@@ -257,6 +257,8 @@
     hisname ISO8859_15
     ascii   true
     alias   ISO_8859-15                # IANA alias
+    alias   Latin-9
+    alias   csISO885915
     alias   8859_15                    # Other aliases
     alias   ISO-8859-15
     alias   ISO8859_15
@@ -272,6 +274,18 @@
     alias   csISOlatin9
     alias   ISO8859_15_FDIS
 
+charset ISO-8859-16 ISO_8859_16
+    package sun.nio.cs
+    type    sbcs
+    hisname ISO8859_16
+    ascii   true
+    alias   iso-ir-226
+    alias   ISO_8859-16:2001
+    alias   ISO_8859-16
+    alias   latin10
+    alias   l10
+    alias   csISO885916
+
 charset KOI8-R KOI8_R
     package sun.nio.cs
     type    sbcs
--- a/jdk/make/lib/Awt2dLibraries.gmk	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Sat Sep 09 14:36:45 2017 +0200
@@ -311,7 +311,6 @@
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga \
         -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
         $(LIBJAVA_HEADER_FLAGS)
         #
@@ -536,7 +535,6 @@
       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
-      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
       $(LIBJAVA_HEADER_FLAGS) \
       #
 
--- a/jdk/make/lib/SoundLibraries.gmk	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/make/lib/SoundLibraries.gmk	Sat Sep 09 14:36:45 2017 +0200
@@ -61,6 +61,7 @@
       -DUSE_PLATFORM_MIDI_IN=TRUE \
       -DUSE_PORTS=TRUE
   LIBJSOUND_SRC_FILES += \
+      PLATFORM_API_WinOS_Charset_Util.cpp \
       PLATFORM_API_WinOS_MidiIn.cpp \
       PLATFORM_API_WinOS_MidiOut.c \
       PLATFORM_API_WinOS_Util.c \
@@ -190,6 +191,7 @@
       OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
       SRC := $(LIBJSOUND_SRC_DIRS), \
       INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \
+          PLATFORM_API_WinOS_Charset_Util.cpp \
           PLATFORM_API_WinOS_DirectSound.cpp, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
--- a/jdk/make/mapfiles/libawt/mapfile-mawt-vers	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/make/mapfiles/libawt/mapfile-mawt-vers	Sat Sep 09 14:36:45 2017 +0200
@@ -132,7 +132,6 @@
         Java_sun_java2d_x11_X11SurfaceData_initIDs;
         Java_sun_java2d_x11_X11SurfaceData_initOps;
         Java_sun_java2d_x11_X11SurfaceData_initSurface;
-        Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable;
         Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable;
         Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode;
         Java_sun_java2d_x11_X11SurfaceData_XSetXorMode;
--- a/jdk/make/mapfiles/libawt/mapfile-vers-linux	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/make/mapfiles/libawt/mapfile-vers-linux	Sat Sep 09 14:36:45 2017 +0200
@@ -252,7 +252,6 @@
         Java_sun_awt_X11SurfaceData_initIDs;
         Java_sun_awt_X11SurfaceData_initOps;
         Java_sun_awt_X11SurfaceData_initSurface;
-        Java_sun_awt_X11SurfaceData_isDgaAvailable;
         Java_sun_awt_X11SurfaceData_setInvalid;
         Java_sun_awt_X11SurfaceData_flushNativeSurface;
         awt_display;
--- a/jdk/make/mapfiles/libawt_xawt/mapfile-vers	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/make/mapfiles/libawt_xawt/mapfile-vers	Sat Sep 09 14:36:45 2017 +0200
@@ -364,7 +364,6 @@
         Java_sun_java2d_x11_X11Renderer_XFillRoundRect;
         Java_sun_java2d_x11_X11Renderer_devCopyArea;
         Java_sun_java2d_x11_X11SurfaceData_initIDs;
-        Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable;
         Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable;
         Java_sun_java2d_x11_X11SurfaceData_initSurface;
         Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode;
--- a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java	Sat Sep 09 14:36:45 2017 +0200
@@ -91,7 +91,7 @@
      * If the file exists but is a directory rather than a regular file, does
      * not exist but cannot be created, or cannot be opened for any other
      * reason then a <code>FileNotFoundException</code> is thrown.
-     * <p>
+     *
      * @implSpec Invoking this constructor with the parameter {@code name} is
      * equivalent to invoking {@link #FileOutputStream(String,boolean)
      * new FileOutputStream(name, false)}.
--- a/jdk/src/java.base/share/classes/module-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.base/share/classes/module-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -35,7 +35,7 @@
  *      The jrt file system can be created by calling
  *      {@link java.nio.file.FileSystems#newFileSystem
  *      FileSystems.newFileSystem(URI.create("jrt:/"))}.
- *      <p></dd>
+ *      </dd>
  * <dt class="simpleTagLabel" style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif">Tool Guides:</dt>
  * <dd style="font-family:'DejaVu Sans', Arial, Helvetica, sans serif"> {@extLink java_tool_reference java launcher},
  *      {@extLink keytool_tool_reference keytool}</dd>
--- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Sat Sep 09 14:36:45 2017 +0200
@@ -137,7 +137,6 @@
 \    -Xms<size>        set initial Java heap size\n\
 \    -Xmx<size>        set maximum Java heap size\n\
 \    -Xnoclassgc       disable class garbage collection\n\
-\    -Xprof            output cpu profiling data (deprecated)\n\
 \    -Xrs              reduce use of OS signals by Java/VM (see documentation)\n\
 \    -Xshare:auto      use shared class data if possible (default)\n\
 \    -Xshare:off       do not attempt to use shared class data\n\
--- a/jdk/src/java.base/share/classes/sun/nio/cs/Unicode.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/Unicode.java	Sat Sep 09 14:36:45 2017 +0200
@@ -38,6 +38,7 @@
         return ((cs instanceof US_ASCII)
                 || (cs instanceof ISO_8859_1)
                 || (cs instanceof ISO_8859_15)
+                || (cs instanceof ISO_8859_16)
                 || (cs instanceof MS1252)
                 || (cs instanceof UTF_8)
                 || (cs instanceof UTF_16)
--- a/jdk/src/java.desktop/macosx/classes/apple/laf/AquaLookAndFeel.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2011, 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.  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 apple.laf;
-
-/*
- * This class is essentially a placeholder since
- * "apple.laf.AquaLookAndFeel" is so widely used, documented,
- * and hard coded that it is impractical to remove it.
- */
-@SuppressWarnings("serial") // JDK implementation class
-public class AquaLookAndFeel extends com.apple.laf.AquaLookAndFeel { }
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 com.apple.eawt;
-
-import java.awt.desktop.AboutHandler;
-import java.awt.desktop.AppForegroundListener;
-import java.awt.desktop.AppHiddenListener;
-import java.awt.desktop.AppReopenedListener;
-import java.awt.desktop.OpenFilesHandler;
-import java.awt.desktop.OpenURIHandler;
-import java.awt.desktop.PreferencesHandler;
-import java.awt.desktop.PrintFilesHandler;
-import java.awt.desktop.QuitHandler;
-import java.awt.desktop.ScreenSleepListener;
-import java.awt.desktop.SystemEventListener;
-import java.awt.desktop.SystemSleepListener;
-import java.awt.desktop.UserSessionListener;
-
-/**
- * An abstract adapter class for receiving {@code ApplicationEvents}.
- *
- * ApplicationEvents are deprecated. Use individual app event listeners or handlers instead.
- *
- * @see Application#addAppEventListener(SystemEventListener)
- *
- * @see AboutHandler
- * @see PreferencesHandler
- * @see OpenURIHandler
- * @see OpenFilesHandler
- * @see PrintFilesHandler
- * @see QuitHandler
- *
- * @see AppReopenedListener
- * @see AppForegroundListener
- * @see AppHiddenListener
- * @see UserSessionListener
- * @see ScreenSleepListener
- * @see SystemSleepListener
- *
- * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}.
- * @since 1.4
- */
-@SuppressWarnings("deprecation")
-@Deprecated
-public class ApplicationAdapter implements ApplicationListener {
-    @Deprecated
-    public void handleAbout(final ApplicationEvent event) { }
-
-    @Deprecated
-    public void handleOpenApplication(final ApplicationEvent event) { }
-
-    @Deprecated
-    public void handleOpenFile(final ApplicationEvent event) { }
-
-    @Deprecated
-    public void handlePreferences(final ApplicationEvent event) { }
-
-    @Deprecated
-    public void handlePrintFile(final ApplicationEvent event) { }
-
-    @Deprecated
-    public void handleQuit(final ApplicationEvent event) { }
-
-    @Deprecated
-    public void handleReOpenApplication(final ApplicationEvent event) { }
-}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 com.apple.eawt;
-
-import java.awt.desktop.AboutHandler;
-import java.awt.desktop.AppReopenedListener;
-import java.awt.desktop.OpenFilesHandler;
-import java.awt.desktop.PreferencesHandler;
-import java.awt.desktop.PrintFilesHandler;
-import java.awt.desktop.QuitHandler;
-import java.util.EventObject;
-
-/**
- * The class of events sent to the deprecated ApplicationListener callbacks.
- *
- * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
- * @since 1.4
- */
-@Deprecated
-@SuppressWarnings("serial") // JDK implementation class
-public class ApplicationEvent extends EventObject {
-    private String fFilename = null;
-    private boolean fHandled = false;
-
-    ApplicationEvent(final Object source) {
-        super(source);
-    }
-
-    ApplicationEvent(final Object source, final String filename) {
-        super(source);
-        fFilename = filename;
-    }
-
-    /**
-     * Determines whether an ApplicationListener has acted on a particular event.
-     * An event is marked as having been handled with {@code setHandled(true)}.
-     *
-     * @return {@code true} if the event has been handled, otherwise {@code false}
-     *
-     * @since 1.4
-     * @deprecated
-     */
-    @Deprecated
-    public boolean isHandled() {
-        return fHandled;
-    }
-
-    /**
-     * Marks the event as handled.
-     * After this method handles an ApplicationEvent, it may be useful to specify that it has been handled.
-     * This is usually used in conjunction with {@code getHandled()}.
-     * Set to {@code true} to designate that this event has been handled. By default it is {@code false}.
-     *
-     * @param state {@code true} if the event has been handled, otherwise {@code false}.
-     *
-     * @since 1.4
-     * @deprecated
-     */
-    @Deprecated
-    public void setHandled(final boolean state) {
-        fHandled = state;
-    }
-
-    /**
-     * Provides the filename associated with a particular AppleEvent.
-     * When the ApplicationEvent corresponds to an AppleEvent that needs to act on a particular file, the ApplicationEvent carries the name of the specific file with it.
-     * For example, the Print and Open events refer to specific files.
-     * For these cases, this returns the appropriate file name.
-     *
-     * @return the full path to the file associated with the event, if applicable, otherwise {@code null}
-     *
-     * @since 1.4
-     * @deprecated use {@link OpenFilesHandler} or {@link PrintFilesHandler} instead
-     */
-    @Deprecated
-    public String getFilename() {
-        return fFilename;
-    }
-}
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 com.apple.eawt;
-
-import java.awt.desktop.AboutHandler;
-import java.awt.desktop.AppForegroundListener;
-import java.awt.desktop.AppHiddenListener;
-import java.awt.desktop.AppReopenedListener;
-import java.awt.desktop.OpenFilesHandler;
-import java.awt.desktop.OpenURIHandler;
-import java.awt.desktop.PreferencesHandler;
-import java.awt.desktop.PrintFilesHandler;
-import java.awt.desktop.QuitHandler;
-import java.awt.desktop.ScreenSleepListener;
-import java.awt.desktop.SystemEventListener;
-import java.awt.desktop.SystemSleepListener;
-import java.awt.desktop.UserSessionListener;
-import java.util.EventListener;
-
-/**
- * ApplicationEvents are deprecated. Use individual AppEvent listeners or handlers instead.
- *
- * @see Application#addAppEventListener(SystemEventListener)
- *
- * @see AboutHandler
- * @see PreferencesHandler
- * @see OpenURIHandler
- * @see OpenFilesHandler
- * @see PrintFilesHandler
- * @see QuitHandler
- *
- * @see AppReopenedListener
- * @see AppForegroundListener
- * @see AppHiddenListener
- * @see UserSessionListener
- * @see ScreenSleepListener
- * @see SystemSleepListener
- *
- * @since 1.4
- * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}
- */
-@SuppressWarnings("deprecation")
-@Deprecated
-public interface ApplicationListener extends EventListener {
-    /**
-     * Called when the user selects the About item in the application menu. If {@code event} is not handled by
-     * setting {@code isHandled(true)}, a default About window consisting of the application's name and icon is
-     * displayed. To display a custom About window, designate the {@code event} as being handled and display the
-     * appropriate About window.
-     *
-     * @param event an ApplicationEvent initiated by the user choosing About in the application menu
-     * @deprecated use {@link AboutHandler}
-     */
-    @Deprecated
-    public void handleAbout(ApplicationEvent event);
-
-    /**
-     * Called when the application receives an Open Application event from the Finder or another application. Usually
-     * this will come from the Finder when a user double-clicks your application icon. If there is any special code
-     * that you want to run when you user launches your application from the Finder or by sending an Open Application
-     * event from another application, include that code as part of this handler. The Open Application event is sent
-     * after AWT has been loaded.
-     *
-     * @param event the Open Application event
-     * @deprecated no replacement
-     */
-    @Deprecated
-    public void handleOpenApplication(ApplicationEvent event);
-
-    /**
-     * Called when the application receives an Open Document event from the Finder or another application. This event
-     * is generated when a user double-clicks a document in the Finder. If the document is registered as belonging
-     * to your application, this event is sent to your application. Documents are bound to a particular application based
-     * primarily on their suffix. In the Finder, a user selects a document and then from the File Menu chooses Get Info.
-     * The Info window allows users to bind a document to a particular application.
-     *
-     * These events are sent only if the bound application has file types listed in the Info.plist entries Document Types
-     * or CFBundleDocumentTypes.
-     *
-     * The ApplicationEvent sent to this handler holds a reference to the file being opened.
-     *
-     * @param event an Open Document event with reference to the file to be opened
-     * @deprecated use {@link OpenFilesHandler}
-     */
-    @Deprecated
-    public void handleOpenFile(ApplicationEvent event);
-
-    /**
-     * Called when the Preference item in the application menu is selected. Native Mac OS X applications make their
-     * Preferences window available through the application menu. Java applications are automatically given an application
-     * menu in Mac OS X. By default, the Preferences item is disabled in that menu. If you are deploying an application
-     * on Mac OS X, you should enable the preferences item with {@code setEnabledPreferencesMenu(true)} in the
-     * Application object and then display your Preferences window in this handler.
-     *
-     * @param event triggered when the user selects Preferences from the application menu
-     * @deprecated use {@link PreferencesHandler}
-     */
-    @Deprecated
-    public void handlePreferences(ApplicationEvent event);
-
-    /**
-     * Called when the application is sent a request to print a particular file or files. You can allow other applications to
-     * print files with your application by implementing this handler. If another application sends a Print Event along
-     * with the name of a file that your application knows how to process, you can use this handler to determine what to
-     * do with that request. You might open your entire application, or just invoke your printing classes.
-     *
-     * These events are sent only if the bound application has file types listed in the Info.plist entries Document Types
-     * or CFBundleDocumentTypes.
-     *
-     * The ApplicationEvent sent to this handler holds a reference to the file being opened.
-     *
-     * @param event a Print Document event with a reference to the file(s) to be printed
-     * @deprecated use {@link PrintFilesHandler}
-     */
-    @Deprecated
-    public void handlePrintFile(ApplicationEvent event);
-
-    /**
-     * Called when the application is sent the Quit event. This event is generated when the user selects Quit from the
-     * application menu, when the user types Command-Q, or when the user control clicks on your application icon in the
-     * Dock and chooses Quit. You can either accept or reject the request to quit. You might want to reject the request
-     * to quit if the user has unsaved work. Reject the request, move into your code to save changes, then quit your
-     * application. To accept the request to quit, and terminate the application, set {@code isHandled(true)} for the
-     * {@code event}. To reject the quit, set {@code isHandled(false)}.
-     *
-     * @param event a Quit Application event
-     * @deprecated use {@link QuitHandler} and {@link MacQuitResponse}
-     */
-    @Deprecated
-    public void handleQuit(ApplicationEvent event);
-
-    /**
-     * Called when the application receives a Reopen Application event from the Finder or another application. Usually
-     * this will come when a user clicks on your application icon in the Dock. If there is any special code
-     * that needs to run when your user clicks on your application icon in the Dock or when a Reopen Application
-     * event is sent from another application, include that code as part of this handler.
-     *
-     * @param event the Reopen Application event
-     * @deprecated use {@link AppReopenedListener}
-     */
-    @Deprecated
-    public void handleReOpenApplication(ApplicationEvent event);
-}
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CCharToGlyphMapper.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CCharToGlyphMapper.java	Sat Sep 09 14:36:45 2017 +0200
@@ -282,7 +282,7 @@
                 if (code >= HI_SURROGATE_START &&
                     code <= HI_SURROGATE_END && m < missed - 1)
                 {
-                    char low = indicies[m + 1];
+                    char low = unmappedChars[m + 1];
                     if (low >= LO_SURROGATE_START && low <= LO_SURROGATE_END) {
                         code = (code - HI_SURROGATE_START) * 0x400 +
                             low - LO_SURROGATE_START + 0x10000;
--- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -51,20 +51,6 @@
         super();
     }
 
-    // We block, waiting for an empty event to get posted (CToolkit.invokeAndWait)
-    // This is so we finish dispatching DropTarget events before we dispatch the dragDropFinished event (which is a higher priority).
-    private void flushEvents(Component c) {
-        try {
-            LWCToolkit.invokeAndWait(new Runnable() {
-                public synchronized void run() {
-                }
-            }, c);
-        }
-        catch(Exception e) {
-            e.printStackTrace();
-        }
-    }
-
     protected Object getNativeData(long format) {
         long nativeDropTarget = this.getNativeDragContext();
 
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -281,7 +281,7 @@
     // Allow TSM to look at the event and potentially send back NSTextInputClient messages.
     [self interpretKeyEvents:[NSArray arrayWithObject:event]];
     
-    if (fEnablePressAndHold && [event willBeHandledByComplexInputMethod]) {
+    if (fEnablePressAndHold && [event willBeHandledByComplexInputMethod] && fInputMethodLOCKABLE) {
         fProcessingKeystroke = NO;
         if (!fInPressAndHold) {
             fInPressAndHold = YES;
@@ -770,11 +770,9 @@
     CDragSource *dragSource = self._dragSource;
     NSDragOperation dragOp = NSDragOperationNone;
     
-    if (dragSource != nil)
+    if (dragSource != nil) {
         dragOp = [dragSource draggingSourceOperationMaskForLocal:flag];
-    else if ([super respondsToSelector:@selector(draggingSourceOperationMaskForLocal:)])
-        dragOp = [super draggingSourceOperationMaskForLocal:flag];
-    
+    }
     return dragOp;
 }
 
@@ -784,11 +782,9 @@
     CDragSource *dragSource = self._dragSource;
     NSArray* array = nil;
     
-    if (dragSource != nil)
+    if (dragSource != nil) {
         array = [dragSource namesOfPromisedFilesDroppedAtDestination:dropDestination];
-    else if ([super respondsToSelector:@selector(namesOfPromisedFilesDroppedAtDestination:)])
-        array = [super namesOfPromisedFilesDroppedAtDestination:dropDestination];
-    
+    }
     return array;
 }
 
@@ -797,10 +793,9 @@
     // If draggingSource is nil route the message to the superclass (if responding to the selector):
     CDragSource *dragSource = self._dragSource;
     
-    if (dragSource != nil)
+    if (dragSource != nil) {
         [dragSource draggedImage:image beganAt:screenPoint];
-    else if ([super respondsToSelector:@selector(draggedImage::)])
-        [super draggedImage:image beganAt:screenPoint];
+    }
 }
 
 - (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation
@@ -808,10 +803,9 @@
     // If draggingSource is nil route the message to the superclass (if responding to the selector):
     CDragSource *dragSource = self._dragSource;
     
-    if (dragSource != nil)
+    if (dragSource != nil) {
         [dragSource draggedImage:image endedAt:screenPoint operation:operation];
-    else if ([super respondsToSelector:@selector(draggedImage:::)])
-        [super draggedImage:image endedAt:screenPoint operation:operation];
+    }
 }
 
 - (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint
@@ -819,10 +813,9 @@
     // If draggingSource is nil route the message to the superclass (if responding to the selector):
     CDragSource *dragSource = self._dragSource;
     
-    if (dragSource != nil)
+    if (dragSource != nil) {
         [dragSource draggedImage:image movedTo:screenPoint];
-    else if ([super respondsToSelector:@selector(draggedImage::)])
-        [super draggedImage:image movedTo:screenPoint];
+    }
 }
 
 - (BOOL)ignoreModifierKeysWhileDragging
@@ -831,11 +824,9 @@
     CDragSource *dragSource = self._dragSource;
     BOOL result = FALSE;
     
-    if (dragSource != nil)
+    if (dragSource != nil) {
         result = [dragSource ignoreModifierKeysWhileDragging];
-    else if ([super respondsToSelector:@selector(ignoreModifierKeysWhileDragging)])
-        result = [super ignoreModifierKeysWhileDragging];
-    
+    }
     return result;
 }
 
@@ -849,11 +840,9 @@
     CDropTarget *dropTarget = self._dropTarget;
     NSDragOperation dragOp = NSDragOperationNone;
     
-    if (dropTarget != nil)
+    if (dropTarget != nil) {
         dragOp = [dropTarget draggingEntered:sender];
-    else if ([super respondsToSelector:@selector(draggingEntered:)])
-        dragOp = [super draggingEntered:sender];
-    
+    }
     return dragOp;
 }
 
@@ -863,11 +852,9 @@
     CDropTarget *dropTarget = self._dropTarget;
     NSDragOperation dragOp = NSDragOperationNone;
     
-    if (dropTarget != nil)
+    if (dropTarget != nil) {
         dragOp = [dropTarget draggingUpdated:sender];
-    else if ([super respondsToSelector:@selector(draggingUpdated:)])
-        dragOp = [super draggingUpdated:sender];
-    
+    }
     return dragOp;
 }
 
@@ -876,10 +863,9 @@
     // If draggingDestination is nil route the message to the superclass:
     CDropTarget *dropTarget = self._dropTarget;
     
-    if (dropTarget != nil)
+    if (dropTarget != nil) {
         [dropTarget draggingExited:sender];
-    else if ([super respondsToSelector:@selector(draggingExited:)])
-        [super draggingExited:sender];
+    }
 }
 
 - (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
@@ -888,11 +874,9 @@
     CDropTarget *dropTarget = self._dropTarget;
     BOOL result = FALSE;
     
-    if (dropTarget != nil)
+    if (dropTarget != nil) {
         result = [dropTarget prepareForDragOperation:sender];
-    else if ([super respondsToSelector:@selector(prepareForDragOperation:)])
-        result = [super prepareForDragOperation:sender];
-    
+    }
     return result;
 }
 
@@ -902,11 +886,9 @@
     CDropTarget *dropTarget = self._dropTarget;
     BOOL result = FALSE;
     
-    if (dropTarget != nil)
+    if (dropTarget != nil) {
         result = [dropTarget performDragOperation:sender];
-    else if ([super respondsToSelector:@selector(performDragOperation:)])
-        result = [super performDragOperation:sender];
-    
+    }
     return result;
 }
 
@@ -915,10 +897,9 @@
     // If draggingDestination is nil route the message to the superclass:
     CDropTarget *dropTarget = self._dropTarget;
     
-    if (dropTarget != nil)
+    if (dropTarget != nil) {
         [dropTarget concludeDragOperation:sender];
-    else if ([super respondsToSelector:@selector(concludeDragOperation:)])
-        [super concludeDragOperation:sender];
+    }
 }
 
 - (void)draggingEnded:(id <NSDraggingInfo>)sender
@@ -926,10 +907,9 @@
     // If draggingDestination is nil route the message to the superclass:
     CDropTarget *dropTarget = self._dropTarget;
     
-    if (dropTarget != nil)
+    if (dropTarget != nil) {
         [dropTarget draggingEnded:sender];
-    else if ([super respondsToSelector:@selector(draggingEnded:)])
-        [super draggingEnded:sender];
+    }
 }
 
 /********************************  END NSDraggingDestination Interface  ********************************/
@@ -986,6 +966,13 @@
         // We also don't want to send the character that triggered the insertText, usually a return. [3337563]
         fKeyEventsNeeded = NO;
     }
+    else {
+        // Need to set back the fKeyEventsNeeded flag so that the string following the
+        // marked text is not ignored by keyDown
+        if ([useString length] > 0) {
+            fKeyEventsNeeded = YES;
+        }
+    }
     fPAHNeedsToSelect = NO;
 }
 
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -432,12 +432,11 @@
     NSWindow* window = [fView window];
 
     NSInteger windowNumber = [window windowNumber];
-    NSGraphicsContext* graphicsContext = [NSGraphicsContext graphicsContextWithWindow:window];
 
     // Convert mouse coordinates to NS:
     NSPoint eventLocation = [fView convertPoint:NSMakePoint(fDragPos.x, fDragPos.y) toView:nil];
     eventLocation.y = [[fView window] frame].size.height - eventLocation.y;
-    
+
     // Convert fTriggerEventTimeStamp to NS - AWTEvent.h defines UTC(nsEvent) as ((jlong)[event timestamp] * 1000):
     NSTimeInterval timeStamp = fTriggerEventTimeStamp / 1000;
 
@@ -452,14 +451,16 @@
     }
 
     // Convert fModifiers (extModifiers) to NS:
-    NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE); 
+    NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE);
 
     // Just a dummy value ...
     NSInteger eventNumber = 0;
+    // NSEvent.context is deprecated and unused
+    NSGraphicsContext* unusedPassNil = nil;
 
     // Make a native autoreleased dragging event:
     NSEvent* dragEvent = [NSEvent mouseEventWithType:mouseButtons location:eventLocation
-        modifierFlags:modifiers timestamp:timeStamp windowNumber:windowNumber context:graphicsContext
+        modifierFlags:modifiers timestamp:timeStamp windowNumber:windowNumber context:unusedPassNil
         eventNumber:eventNumber clickCount:fClickCount pressure:pressure];
 
     return dragEvent;
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m	Sat Sep 09 14:36:45 2017 +0200
@@ -663,13 +663,6 @@
         if (sDraggingError == FALSE) {
             JNFCallVoidMethod(env, fDropTargetContextPeer, handleDropMessageMethod, fComponent, (jint) javaLocation.x, (jint) javaLocation.y, dropAction, actions, formats, ptr_to_jlong(self)); // AWT_THREADING Safe (event)
         }
-
-        if (sDraggingError == FALSE) {
-            JNF_MEMBER_CACHE(flushEventsMethod, jc_CDropTargetContextPeer, "flushEvents", "(Ljava/awt/Component;)V");
-            if (sDraggingError == FALSE) {
-                JNFCallVoidMethod(env, fDropTargetContextPeer, flushEventsMethod, fComponent); // AWT_THREADING Safe (AWTRunLoopMode)
-            }
-        }
     } else {
         // 8-19-03 Note: [Radar 3368754]
         // draggingExited: is not called after a drop - we must do that here ... but only in case
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -472,6 +472,14 @@
             text = new String(b, "UTF8");
         }
         metadata.iTXt_text.add(text);
+
+        // Check if the text chunk contains image creation time
+        if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) {
+            // Update Standard/Document/ImageCreationTime from text chunk
+            int index = metadata.iTXt_text.size() - 1;
+            metadata.decodeImageCreationTimeFromTextChunk(
+                    metadata.iTXt_text.listIterator(index));
+        }
     }
 
     private void parse_pHYs_chunk() throws IOException {
@@ -555,6 +563,14 @@
         byte[] b = new byte[chunkLength - keyword.length() - 1];
         stream.readFully(b);
         metadata.tEXt_text.add(new String(b, "ISO-8859-1"));
+
+        // Check if the text chunk contains image creation time
+        if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) {
+            // Update Standard/Document/ImageCreationTime from text chunk
+            int index = metadata.tEXt_text.size() - 1;
+            metadata.decodeImageCreationTimeFromTextChunk(
+                    metadata.tEXt_text.listIterator(index));
+        }
     }
 
     private void parse_tIME_chunk() throws IOException {
@@ -644,6 +660,14 @@
         byte[] b = new byte[chunkLength - keyword.length() - 2];
         stream.readFully(b);
         metadata.zTXt_text.add(new String(inflate(b), "ISO-8859-1"));
+
+        // Check if the text chunk contains image creation time
+        if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) {
+            // Update Standard/Document/ImageCreationTime from text chunk
+            int index = metadata.zTXt_text.size() - 1;
+            metadata.decodeImageCreationTimeFromTextChunk(
+                    metadata.zTXt_text.listIterator(index));
+        }
     }
 
     private void readMetadata() throws IIOException {
@@ -713,8 +737,32 @@
                 switch (chunkType) {
                 case IDAT_TYPE:
                     // If chunk type is 'IDAT', we've reached the image data.
-                    stream.skipBytes(-8);
-                    imageStartPosition = stream.getStreamPosition();
+                    if (imageStartPosition == -1L) {
+                        /*
+                         * PNGs may contain multiple IDAT chunks containing
+                         * a portion of image data. We store the position of
+                         * the first IDAT chunk and continue with iteration
+                         * of other chunks that follow image data.
+                         */
+                        imageStartPosition = stream.getStreamPosition() - 8;
+                    }
+                    // Move to the CRC byte location.
+                    stream.skipBytes(chunkLength);
+                    break;
+                case IEND_TYPE:
+                    /*
+                     * If the chunk type is 'IEND', we've reached end of image.
+                     * Seek to the first IDAT chunk for subsequent decoding.
+                     */
+                    stream.seek(imageStartPosition);
+
+                    /*
+                     * flushBefore discards the portion of the stream before
+                     * the indicated position. Hence this should be used after
+                     * we complete iteration over available chunks including
+                     * those that appear after the IDAT.
+                     */
+                    stream.flushBefore(stream.getStreamPosition());
                     break loop;
                 case PLTE_TYPE:
                     parse_PLTE_chunk(chunkLength);
@@ -796,7 +844,6 @@
                     throw new IIOException("Failed to read a chunk of type " +
                             chunkType);
                 }
-                stream.flushBefore(stream.getStreamPosition());
             }
         } catch (IOException e) {
             throw new IIOException("Error reading PNG metadata", e);
--- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -30,6 +30,14 @@
 import java.awt.image.SampleModel;
 import java.util.ArrayList;
 import java.util.StringTokenizer;
+import java.util.ListIterator;
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+import java.time.temporal.TemporalAccessor;
 import javax.imageio.ImageTypeSpecifier;
 import javax.imageio.metadata.IIOInvalidTreeException;
 import javax.imageio.metadata.IIOMetadata;
@@ -212,7 +220,7 @@
     public ArrayList<String> tEXt_keyword = new ArrayList<String>(); // 1-79 characters
     public ArrayList<String> tEXt_text = new ArrayList<String>();
 
-    // tIME chunk
+    // tIME chunk. Gives the image modification time.
     public boolean tIME_present;
     public int tIME_year;
     public int tIME_month;
@@ -221,6 +229,41 @@
     public int tIME_minute;
     public int tIME_second;
 
+    // Specifies whether metadata contains Standard/Document/ImageCreationTime
+    public boolean creation_time_present;
+
+    // Values that make up Standard/Document/ImageCreationTime
+    public int creation_time_year;
+    public int creation_time_month;
+    public int creation_time_day;
+    public int creation_time_hour;
+    public int creation_time_minute;
+    public int creation_time_second;
+    public ZoneOffset creation_time_offset;
+
+    /*
+     * tEXt_creation_time_present- Specifies whether any text chunk (tEXt, iTXt,
+     * zTXt) exists with image creation time. The data structure corresponding
+     * to the last decoded text chunk with creation time is indicated by the
+     * iterator- tEXt_creation_time_iter.
+     *
+     * Any update to the text chunks with creation time is reflected on
+     * Standard/Document/ImageCreationTime after retrieving time from the text
+     * chunk. If there are multiple text chunks with creation time, the time
+     * retrieved from the last decoded text chunk will be used. A point to note
+     * is that, retrieval of time from text chunks is possible only if the
+     * encoded time in the chunk confirms to either the recommended RFC1123
+     * format or ISO format.
+     *
+     * Similarly, any update to Standard/Document/ImageCreationTime is reflected
+     * on the last decoded text chunk's data structure with time encoded in
+     * RFC1123 format. By updating the text chunk's data structure, we also
+     * ensure that PNGImageWriter will write image creation time on the output.
+     */
+    public boolean tEXt_creation_time_present;
+    private ListIterator<String> tEXt_creation_time_iter = null;
+    public static final String tEXt_creationTimeKey = "Creation Time";
+
     // tRNS chunk
     // If external (non-PNG sourced) data has red = green = blue,
     // always store it as gray and promote when writing
@@ -985,21 +1028,41 @@
     }
 
     public IIOMetadataNode getStandardDocumentNode() {
-        if (!tIME_present) {
-            return null;
+        IIOMetadataNode document_node = null;
+
+        // Check if image modification time exists
+        if (tIME_present) {
+            // Create new document node
+            document_node = new IIOMetadataNode("Document");
+
+            // Node to hold image modification time
+            IIOMetadataNode node = new IIOMetadataNode("ImageModificationTime");
+            node.setAttribute("year", Integer.toString(tIME_year));
+            node.setAttribute("month", Integer.toString(tIME_month));
+            node.setAttribute("day", Integer.toString(tIME_day));
+            node.setAttribute("hour", Integer.toString(tIME_hour));
+            node.setAttribute("minute", Integer.toString(tIME_minute));
+            node.setAttribute("second", Integer.toString(tIME_second));
+            document_node.appendChild(node);
         }
 
-        IIOMetadataNode document_node = new IIOMetadataNode("Document");
-        IIOMetadataNode node = null; // scratch node
+        // Check if image creation time exists
+        if (creation_time_present) {
+            if (document_node == null) {
+                // Create new document node
+                document_node = new IIOMetadataNode("Document");
+            }
 
-        node = new IIOMetadataNode("ImageModificationTime");
-        node.setAttribute("year", Integer.toString(tIME_year));
-        node.setAttribute("month", Integer.toString(tIME_month));
-        node.setAttribute("day", Integer.toString(tIME_day));
-        node.setAttribute("hour", Integer.toString(tIME_hour));
-        node.setAttribute("minute", Integer.toString(tIME_minute));
-        node.setAttribute("second", Integer.toString(tIME_second));
-        document_node.appendChild(node);
+            // Node to hold image creation time
+            IIOMetadataNode node = new IIOMetadataNode("ImageCreationTime");
+            node.setAttribute("year", Integer.toString(creation_time_year));
+            node.setAttribute("month", Integer.toString(creation_time_month));
+            node.setAttribute("day", Integer.toString(creation_time_day));
+            node.setAttribute("hour", Integer.toString(creation_time_hour));
+            node.setAttribute("minute", Integer.toString(creation_time_minute));
+            node.setAttribute("second", Integer.toString(creation_time_second));
+            document_node.appendChild(node);
+        }
 
         return document_node;
     }
@@ -1437,6 +1500,13 @@
                         String text = getAttribute(iTXt_node, "text");
                         iTXt_text.add(text);
 
+                        // Check if the text chunk contains image creation time
+                        if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) {
+                            // Update Standard/Document/ImageCreationTime
+                            int index = iTXt_text.size()-1;
+                            decodeImageCreationTimeFromTextChunk(
+                                    iTXt_text.listIterator(index));
+                        }
                     }
                     // silently skip invalid text entry
 
@@ -1564,6 +1634,13 @@
                     String text = getAttribute(tEXt_node, "value");
                     tEXt_text.add(text);
 
+                    // Check if the text chunk contains image creation time
+                    if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) {
+                        // Update Standard/Document/ImageCreationTime
+                        int index = tEXt_text.size()-1;
+                        decodeImageCreationTimeFromTextChunk(
+                                tEXt_text.listIterator(index));
+                    }
                     tEXt_node = tEXt_node.getNextSibling();
                 }
             } else if (name.equals("tIME")) {
@@ -1652,6 +1729,13 @@
                     String text = getAttribute(zTXt_node, "text");
                     zTXt_text.add(text);
 
+                    // Check if the text chunk contains image creation time
+                    if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) {
+                        // Update Standard/Document/ImageCreationTime
+                        int index = zTXt_text.size()-1;
+                        decodeImageCreationTimeFromTextChunk(
+                                zTXt_text.listIterator(index));
+                    }
                     zTXt_node = zTXt_node.getNextSibling();
                 }
             } else if (name.equals("UnknownChunks")) {
@@ -1952,7 +2036,22 @@
                         tIME_second =
                             getIntAttribute(child, "second", 0, false);
 //                  } else if (childName.equals("SubimageInterpretation")) {
-//                  } else if (childName.equals("ImageCreationTime")) {
+                    } else if (childName.equals("ImageCreationTime")) {
+                        // Extract the creation time values
+                        int year  = getIntAttribute(child, "year");
+                        int month = getIntAttribute(child, "month");
+                        int day   = getIntAttribute(child, "day");
+                        int hour  = getIntAttribute(child, "hour", 0, false);
+                        int mins  = getIntAttribute(child, "minute", 0, false);
+                        int sec   = getIntAttribute(child, "second", 0, false);
+
+                        /*
+                         * Update Standard/Document/ImageCreationTime and encode
+                         * the same in the last decoded text chunk with creation
+                         * time
+                         */
+                        initImageCreationTime(year, month, day, hour, mins, sec);
+                        encodeImageCreationTimeToTextChunk();
                     }
                     child = child.getNextSibling();
                 }
@@ -2014,6 +2113,152 @@
         }
     }
 
+    void initImageCreationTime(OffsetDateTime offsetDateTime) {
+        // Check for incoming arguments
+        if (offsetDateTime != null) {
+            // set values that make up Standard/Document/ImageCreationTime
+            creation_time_present = true;
+            creation_time_year    = offsetDateTime.getYear();
+            creation_time_month   = offsetDateTime.getMonthValue();
+            creation_time_day     = offsetDateTime.getDayOfMonth();
+            creation_time_hour    = offsetDateTime.getHour();
+            creation_time_minute  = offsetDateTime.getMinute();
+            creation_time_second  = offsetDateTime.getSecond();
+            creation_time_offset  = offsetDateTime.getOffset();
+        }
+    }
+
+    void initImageCreationTime(int year, int month, int day,
+            int hour, int min,int second) {
+        /*
+         * Though LocalDateTime suffices the need to store Standard/Document/
+         * ImageCreationTime, we require the zone offset to encode the same
+         * in the text chunk based on RFC1123 format.
+         */
+        LocalDateTime locDT = LocalDateTime.of(year, month, day, hour, min, second);
+        ZoneOffset offset = ZoneId.systemDefault()
+                                  .getRules()
+                                  .getOffset(locDT);
+        OffsetDateTime offDateTime = OffsetDateTime.of(locDT,offset);
+        initImageCreationTime(offDateTime);
+    }
+
+    void decodeImageCreationTimeFromTextChunk(ListIterator<String> iterChunk) {
+        // Check for incoming arguments
+        if (iterChunk != null && iterChunk.hasNext()) {
+            /*
+             * Save the iterator to mark the last decoded text chunk with
+             * creation time. The contents of this chunk will be updated when
+             * user provides creation time by merging a standard tree with
+             * Standard/Document/ImageCreationTime.
+             */
+            setCreationTimeChunk(iterChunk);
+
+            // Parse encoded time and set Standard/Document/ImageCreationTime.
+            String encodedTime = getEncodedTime();
+            initImageCreationTime(parseEncodedTime(encodedTime));
+        }
+    }
+
+    void encodeImageCreationTimeToTextChunk() {
+        // Check if Standard/Document/ImageCreationTime exists.
+        if (creation_time_present) {
+            // Check if a text chunk with creation time exists.
+            if (tEXt_creation_time_present == false) {
+                // No text chunk exists with image creation time. Add an entry.
+                this.tEXt_keyword.add(tEXt_creationTimeKey);
+                this.tEXt_text.add("Creation Time Place Holder");
+
+                // Update the iterator
+                int index = tEXt_text.size() - 1;
+                setCreationTimeChunk(tEXt_text.listIterator(index));
+            }
+
+            // Encode image creation time with RFC1123 formatter
+            OffsetDateTime offDateTime = OffsetDateTime.of(creation_time_year,
+                    creation_time_month, creation_time_day,
+                    creation_time_hour, creation_time_minute,
+                    creation_time_second, 0, creation_time_offset);
+            DateTimeFormatter formatter = DateTimeFormatter.RFC_1123_DATE_TIME;
+            String encodedTime = offDateTime.format(formatter);
+            setEncodedTime(encodedTime);
+        }
+    }
+
+    private void setCreationTimeChunk(ListIterator<String> iter) {
+        // Check for iterator's valid state
+        if (iter != null && iter.hasNext()) {
+            tEXt_creation_time_iter = iter;
+            tEXt_creation_time_present = true;
+        }
+    }
+
+    private void setEncodedTime(String encodedTime) {
+        if (tEXt_creation_time_iter != null
+                && tEXt_creation_time_iter.hasNext()
+                && encodedTime != null) {
+            // Set the value at the iterator and reset its state
+            tEXt_creation_time_iter.next();
+            tEXt_creation_time_iter.set(encodedTime);
+            tEXt_creation_time_iter.previous();
+        }
+    }
+
+    private String getEncodedTime() {
+        String encodedTime = null;
+        if (tEXt_creation_time_iter != null
+                && tEXt_creation_time_iter.hasNext()) {
+            // Get the value at iterator and reset its state
+            encodedTime = tEXt_creation_time_iter.next();
+            tEXt_creation_time_iter.previous();
+        }
+        return encodedTime;
+    }
+
+    private OffsetDateTime parseEncodedTime(String encodedTime) {
+        OffsetDateTime retVal = null;
+        boolean timeDecoded = false;
+
+        /*
+         * PNG specification recommends that image encoders use RFC1123 format
+         * to represent time in String but doesn't mandate. Encoders could
+         * use any convenient format. Hence, we extract time provided the
+         * encoded time complies with either RFC1123 or ISO standards.
+         */
+        try {
+            // Check if the encoded time complies with RFC1123
+            retVal = OffsetDateTime.parse(encodedTime,
+                                          DateTimeFormatter.RFC_1123_DATE_TIME);
+            timeDecoded = true;
+        } catch (DateTimeParseException exception) {
+            // No Op. Encoded time did not comply with RFC1123 standard.
+        }
+
+        if (timeDecoded == false) {
+            try {
+                // Check if the encoded time complies with ISO standard.
+                DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME;
+                TemporalAccessor dt = formatter.parseBest(encodedTime,
+                        OffsetDateTime::from, LocalDateTime::from);
+
+                if (dt instanceof OffsetDateTime) {
+                    // Encoded time contains date time and zone offset
+                    retVal = (OffsetDateTime) dt;
+                } else if (dt instanceof LocalDateTime) {
+                    /*
+                     * Encoded time contains only date and time. Since zone
+                     * offset information isn't available, we set to the default
+                     */
+                    LocalDateTime locDT = (LocalDateTime) dt;
+                    retVal = OffsetDateTime.of(locDT, ZoneOffset.UTC);
+                }
+            }  catch (DateTimeParseException exception) {
+                // No Op. Encoded time did not comply with ISO standard.
+            }
+        }
+        return retVal;
+    }
+
     // Reset all instance variables to their initial state
     public void reset() {
         IHDR_present = false;
@@ -2035,7 +2280,12 @@
         sRGB_present = false;
         tEXt_keyword = new ArrayList<String>();
         tEXt_text = new ArrayList<String>();
+        // tIME chunk with Image modification time
         tIME_present = false;
+        // Text chunk with Image creation time
+        tEXt_creation_time_present = false;
+        tEXt_creation_time_iter = null;
+        creation_time_present = false;
         tRNS_present = false;
         zTXt_keyword = new ArrayList<String>();
         zTXt_compressionMethod = new ArrayList<Integer>();
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/Painter.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * 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 com.sun.java.swing;
-
-/**
- * This class is preserved for backward compatibility with JDK 6.
- *
- * @deprecated Use {@link javax.swing.Painter} instead.
- */
-@Deprecated
-public interface Painter<T> extends javax.swing.Painter<T> {
-}
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1246,6 +1246,7 @@
                    "RIGHT", "selectChild",
                 "KP_RIGHT", "selectChild",
                    "ENTER", "return",
+                   "ctrl ENTER", "return",
                    "SPACE", "return"
             },
 
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/nimbus/AbstractRegionPainter.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * 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 com.sun.java.swing.plaf.nimbus;
-
-/**
- * This class is preserved for backward compatibility with JDK 6.
- *
- * @deprecated Use {@link javax.swing.plaf.nimbus.AbstractRegionPainter} instead.
- */
-@Deprecated
-public abstract class AbstractRegionPainter extends javax.swing.plaf.nimbus.AbstractRegionPainter {
-}
--- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2005, 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.  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 com.sun.java.swing.plaf.nimbus;
-
-/**
- * This class is preserved for backward compatibility with JDK 6.
- *
- * @deprecated Use {@link javax.swing.plaf.nimbus.NimbusLookAndFeel} instead.
- */
-@Deprecated
-@SuppressWarnings("serial") // Superclass not serializable
-public class NimbusLookAndFeel extends javax.swing.plaf.nimbus.NimbusLookAndFeel {
-}
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1351,18 +1351,14 @@
                 // pre-empted while another thread changes doIO and notifies,
                 // before we wait (so we sleep in wait forever).
                 synchronized(lock) {
-                    if (!doIO) {
+                    while (!doIO && thread == curThread) {
                         try {
                             lock.wait();
-                        } catch(InterruptedException ie) {
-                        } finally {
-                            if (thread != curThread) {
-                                break;
-                            }
+                        } catch (InterruptedException ignored) {
                         }
                     }
                 }
-                while (doIO) {
+                while (doIO && thread == curThread) {
                     if (newFramePosition >= 0) {
                         clipBytePosition = newFramePosition * frameSize;
                         newFramePosition = -1;
--- a/jdk/src/java.desktop/share/classes/java/awt/Desktop.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/Desktop.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1002,6 +1002,15 @@
     public void setDefaultMenuBar(final JMenuBar menuBar) {
         checkEventsProcessingPermission();
         checkActionSupport(Action.APP_MENU_BAR);
+
+        if (menuBar != null) {
+            Container parent = menuBar.getParent();
+            if (parent != null) {
+                parent.remove(menuBar);
+                menuBar.updateUI();
+            }
+        }
+
         peer.setDefaultMenuBar(menuBar);
     }
 
--- a/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java	Sat Sep 09 14:36:45 2017 +0200
@@ -161,6 +161,23 @@
         }
     }
 
+    boolean filterAndCheckEvent(AWTEvent event) {
+        boolean eventOK = true;
+        synchronized (eventFilters) {
+            for (int i = eventFilters.size() - 1; i >= 0; i--) {
+                EventFilter f = eventFilters.get(i);
+                EventFilter.FilterAction accept = f.acceptEvent(event);
+                if (accept == EventFilter.FilterAction.REJECT) {
+                    eventOK = false;
+                    break;
+                } else if (accept == EventFilter.FilterAction.ACCEPT_IMMEDIATELY) {
+                    break;
+                }
+            }
+        }
+        return eventOK && SunDragSourceContextPeer.checkEvent(event);
+    }
+
     void pumpOneEventForFilters(int id) {
         AWTEvent event = null;
         boolean eventOK = false;
@@ -172,20 +189,7 @@
 
                 event = (id == ANY_EVENT) ? eq.getNextEvent() : eq.getNextEvent(id);
 
-                eventOK = true;
-                synchronized (eventFilters) {
-                    for (int i = eventFilters.size() - 1; i >= 0; i--) {
-                        EventFilter f = eventFilters.get(i);
-                        EventFilter.FilterAction accept = f.acceptEvent(event);
-                        if (accept == EventFilter.FilterAction.REJECT) {
-                            eventOK = false;
-                            break;
-                        } else if (accept == EventFilter.FilterAction.ACCEPT_IMMEDIATELY) {
-                            break;
-                        }
-                    }
-                }
-                eventOK = eventOK && SunDragSourceContextPeer.checkEvent(event);
+                eventOK = filterAndCheckEvent(event);
                 if (!eventOK) {
                     event.consume();
                 }
--- a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java	Sat Sep 09 14:36:45 2017 +0200
@@ -719,7 +719,9 @@
                     fwDispatcher.scheduleDispatch(new Runnable() {
                         @Override
                         public void run() {
-                            dispatchEventImpl(event, src);
+                            if (dispatchThread.filterAndCheckEvent(event)) {
+                                dispatchEventImpl(event, src);
+                            }
                         }
                     });
                 }
@@ -1008,6 +1010,32 @@
         return createSecondaryLoop(null, null, 0);
     }
 
+    private class FwSecondaryLoopWrapper implements SecondaryLoop {
+        final private SecondaryLoop loop;
+        final private EventFilter filter;
+
+        public FwSecondaryLoopWrapper(SecondaryLoop loop, EventFilter filter) {
+            this.loop = loop;
+            this.filter = filter;
+        }
+
+        @Override
+        public boolean enter() {
+            if (filter != null) {
+                dispatchThread.addEventFilter(filter);
+            }
+            return loop.enter();
+        }
+
+        @Override
+        public boolean exit() {
+            if (filter != null) {
+                dispatchThread.removeEventFilter(filter);
+            }
+            return loop.exit();
+        }
+    }
+
     SecondaryLoop createSecondaryLoop(Conditional cond, EventFilter filter, long interval) {
         pushPopLock.lock();
         try {
@@ -1016,7 +1044,7 @@
                 return nextQueue.createSecondaryLoop(cond, filter, interval);
             }
             if (fwDispatcher != null) {
-                return fwDispatcher.createSecondaryLoop();
+                return new FwSecondaryLoopWrapper(fwDispatcher.createSecondaryLoop(), filter);
             }
             if (dispatchThread == null) {
                 initDispatchThread();
@@ -1183,6 +1211,9 @@
                             AWTAccessor.getInvocationEventAccessor()
                                     .dispose((InvocationEvent)entry.event);
                         }
+                        if (entry.event instanceof SunDropTargetEvent) {
+                            ((SunDropTargetEvent)entry.event).dispose();
+                        }
                         if (prev == null) {
                             queues[i].head = entry.next;
                         } else {
--- a/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -54,7 +54,6 @@
  */
 
 public abstract class GraphicsEnvironment {
-    private static GraphicsEnvironment localEnv;
 
     /**
      * The headless state of the Toolkit and GraphicsEnvironment
@@ -74,53 +73,60 @@
     }
 
     /**
-     * Returns the local {@code GraphicsEnvironment}.
-     * @return the local {@code GraphicsEnvironment}
+     * Lazy initialization of local graphics environment using holder idiom.
      */
-    public static synchronized GraphicsEnvironment getLocalGraphicsEnvironment() {
-        if (localEnv == null) {
-            localEnv = createGE();
+    private static final class LocalGE {
+
+        /**
+         * The instance of the local {@code GraphicsEnvironment}.
+         */
+        static final GraphicsEnvironment INSTANCE = createGE();
+
+        /**
+         * Creates and returns the GraphicsEnvironment, according to the
+         * system property 'java.awt.graphicsenv'.
+         *
+         * @return the graphics environment
+         */
+        private static GraphicsEnvironment createGE() {
+            GraphicsEnvironment ge;
+            String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
+            try {
+//              long t0 = System.currentTimeMillis();
+                Class<?> geCls;
+                try {
+                    // First we try if the bootstrap class loader finds the
+                    // requested class. This way we can avoid to run in a privileged
+                    // block.
+                    geCls = Class.forName(nm);
+                } catch (ClassNotFoundException ex) {
+                    // If the bootstrap class loader fails, we try again with the
+                    // application class loader.
+                    ClassLoader cl = ClassLoader.getSystemClassLoader();
+                    geCls = Class.forName(nm, true, cl);
+                }
+                ge = (GraphicsEnvironment)geCls.getConstructor().newInstance();
+//              long t1 = System.currentTimeMillis();
+//              System.out.println("GE creation took " + (t1-t0)+ "ms.");
+                if (isHeadless()) {
+                    ge = new HeadlessGraphicsEnvironment(ge);
+                }
+            } catch (ClassNotFoundException e) {
+                throw new Error("Could not find class: "+nm);
+            } catch (ReflectiveOperationException | IllegalArgumentException e) {
+                throw new Error("Could not instantiate Graphics Environment: "
+                        + nm);
+            }
+            return ge;
         }
-
-        return localEnv;
     }
 
     /**
-     * Creates and returns the GraphicsEnvironment, according to the
-     * system property 'java.awt.graphicsenv'.
-     *
-     * @return the graphics environment
+     * Returns the local {@code GraphicsEnvironment}.
+     * @return the local {@code GraphicsEnvironment}
      */
-    private static GraphicsEnvironment createGE() {
-        GraphicsEnvironment ge;
-        String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
-        try {
-//          long t0 = System.currentTimeMillis();
-            Class<?> geCls;
-            try {
-                // First we try if the bootstrap class loader finds the
-                // requested class. This way we can avoid to run in a privileged
-                // block.
-                geCls = Class.forName(nm);
-            } catch (ClassNotFoundException ex) {
-                // If the bootstrap class loader fails, we try again with the
-                // application class loader.
-                ClassLoader cl = ClassLoader.getSystemClassLoader();
-                geCls = Class.forName(nm, true, cl);
-            }
-            ge = (GraphicsEnvironment)geCls.getConstructor().newInstance();
-//          long t1 = System.currentTimeMillis();
-//          System.out.println("GE creation took " + (t1-t0)+ "ms.");
-            if (isHeadless()) {
-                ge = new HeadlessGraphicsEnvironment(ge);
-            }
-        } catch (ClassNotFoundException e) {
-            throw new Error("Could not find class: "+nm);
-        } catch (ReflectiveOperationException | IllegalArgumentException e) {
-            throw new Error("Could not instantiate Graphics Environment: "
-                            + nm);
-        }
-        return ge;
+    public static GraphicsEnvironment getLocalGraphicsEnvironment() {
+        return LocalGE.INSTANCE;
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java	Sat Sep 09 14:36:45 2017 +0200
@@ -276,6 +276,17 @@
         }
 
         @Override
+        public final void trimToSize() {
+            // trim arrays:
+            if (numTypes < pointTypes.length) {
+                this.pointTypes = Arrays.copyOf(pointTypes, numTypes);
+            }
+            if (numCoords < floatCoords.length) {
+                this.floatCoords = Arrays.copyOf(floatCoords, numCoords);
+            }
+        }
+
+        @Override
         float[] cloneCoordsFloat(AffineTransform at) {
             // trim arrays:
             float ret[];
@@ -1151,6 +1162,17 @@
         }
 
         @Override
+        public final void trimToSize() {
+            // trim arrays:
+            if (numTypes < pointTypes.length) {
+                this.pointTypes = Arrays.copyOf(pointTypes, numTypes);
+            }
+            if (numCoords < doubleCoords.length) {
+                this.doubleCoords = Arrays.copyOf(doubleCoords, numCoords);
+            }
+        }
+
+        @Override
         float[] cloneCoordsFloat(AffineTransform at) {
             // trim arrays:
             float ret[] = new float[numCoords];
@@ -2481,6 +2503,15 @@
         // compatibility so we cannot restrict it further.
         // REMIND: Can we do both somehow?
 
+    /**
+     * Trims the capacity of this Path2D instance to its current
+     * size. An application can use this operation to minimize the
+     * storage of a path.
+     *
+     * @since 10
+     */
+    public abstract void trimToSize();
+
     /*
      * Support fields and methods for serializing the subclasses.
      */
--- a/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -1012,7 +1012,7 @@
      * @see #getRGB(int, int)
      * @see #getRGB(int, int, int, int, int[], int, int)
      */
-    public synchronized void setRGB(int x, int y, int rgb) {
+    public void setRGB(int x, int y, int rgb) {
         raster.setDataElements(x, y, colorModel.getDataElements(rgb, null));
     }
 
--- a/jdk/src/java.desktop/share/classes/javax/print/AttributeException.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/AttributeException.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 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,27 +28,22 @@
 import javax.print.attribute.Attribute;
 
 /**
- * Interface AttributeException is a mixin interface which a subclass of
- * {@link
- * PrintException PrintException} can implement to report an error condition
- * involving one or more printing attributes that a particular Print
+ * Interface {@code AttributeException} is a mixin interface which a subclass of
+ * {@link PrintException PrintException} can implement to report an error
+ * condition involving one or more printing attributes that a particular Print
  * Service instance does not support. Either the attribute is not supported at
  * all, or the attribute is supported but the particular specified value is not
- * supported. The Print Service API does not define any print exception
- * classes that implement interface AttributeException, that being left to the
+ * supported. The Print Service API does not define any print exception classes
+ * that implement interface {@code AttributeException}, that being left to the
  * Print Service implementor's discretion.
- *
  */
-
 public interface AttributeException {
 
-
     /**
      * Returns the array of printing attribute classes for which the Print
-     * Service instance does not support the attribute at all, or null if
-     * there are no such attributes. The objects in the returned array are
-     * classes that extend the base interface
-     * {@link javax.print.attribute.Attribute Attribute}.
+     * Service instance does not support the attribute at all, or {@code null}
+     * if there are no such attributes. The objects in the returned array are
+     * classes that extend the base interface {@link Attribute Attribute}.
      *
      * @return unsupported attribute classes
      */
@@ -57,10 +52,10 @@
     /**
      * Returns the array of printing attributes for which the Print Service
      * instance supports the attribute but does not support that particular
-     * value of the attribute, or null if there are no such attribute values.
+     * value of the attribute, or {@code null} if there are no such attribute
+     * values.
      *
      * @return unsupported attribute values
      */
     public Attribute[] getUnsupportedValues();
-
-    }
+}
--- a/jdk/src/java.desktop/share/classes/javax/print/CancelablePrintJob.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/CancelablePrintJob.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, 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
@@ -26,52 +26,47 @@
 package javax.print;
 
 /**
- * This interface is used by a printing application to cancel a
- * print job.  This interface extends {@link DocPrintJob}.  A
- * {@code DocPrintJob} implementation returned from a print
- * service implements this interface if the print job can be
- * cancelled.  Before trying to cancel
- * a print job, the client needs to test if the
- * {@code DocPrintJob} object returned from the print service
- * actually implements this interface.  Clients should never assume
- * that a {@code DocPrintJob} implements this interface.  A
- * print service might support cancellation only for certain types
- * of print data and representation class names.  This means that
- * only some of the {@code DocPrintJob} objects returned from
- * a service will implement this interface.
+ * This interface is used by a printing application to cancel a print job. This
+ * interface extends {@link DocPrintJob}. A {@code DocPrintJob} implementation
+ * returned from a print service implements this interface if the print job can
+ * be cancelled. Before trying to cancel a print job, the client needs to test
+ * if the {@code DocPrintJob} object returned from the print service actually
+ * implements this interface. Clients should never assume that a
+ * {@code DocPrintJob} implements this interface. A print service might support
+ * cancellation only for certain types of print data and representation class
+ * names. This means that only some of the {@code DocPrintJob} objects returned
+ * from a service will implement this interface.
  * <p>
- * Service implementors are encouraged to implement this optional interface
- * and to deliver a javax.print.event.PrintJobEvent.JOB_CANCELLED event
- * to any listeners if a job is successfully cancelled with an
- * implementation of this interface. Services should also note that an
- * implementation of this method may be made from a separate client thread
- * than that which made the print request.  Thus the implementation of
- * this interface must be made thread safe.
+ * Service implementors are encouraged to implement this optional interface and
+ * to deliver a {@link javax.print.event.PrintJobEvent#JOB_CANCELED} event to
+ * any listeners if a job is successfully cancelled with an implementation of
+ * this interface. Services should also note that an implementation of this
+ * method may be made from a separate client thread than that which made the
+ * print request. Thus the implementation of this interface must be made thread
+ * safe.
  */
-
 public interface CancelablePrintJob extends DocPrintJob {
 
     /**
      * Stops further processing of a print job.
      * <p>
-     * If a service supports this method it cannot be concluded that
-     * job cancellation will always succeed. A job may not be able to be
-     * cancelled once it has reached and passed some point in its processing.
-     * A successful cancellation means only that the entire job was not
-     * printed, some portion may already have printed when cancel returns.
+     * If a service supports this method it cannot be concluded that job
+     * cancellation will always succeed. A job may not be able to be cancelled
+     * once it has reached and passed some point in its processing. A successful
+     * cancellation means only that the entire job was not printed, some portion
+     * may already have printed when cancel returns.
      * <p>
-     * The service will throw a PrintException if the cancellation did not
-     * succeed. A job which has not yet been submitted for printing should
-     * throw this exception.
-     * Cancelling an already successfully cancelled Print Job is not
-     * considered an error and will always succeed.
+     * The service will throw a {@code PrintException} if the cancellation did
+     * not succeed. A job which has not yet been submitted for printing should
+     * throw this exception. Cancelling an already successfully cancelled Print
+     * Job is not considered an error and will always succeed.
      * <p>
      * Cancellation in some services may be a lengthy process, involving
-     * requests to a server and processing of its print queue. Clients
-     * may wish to execute cancel in a thread which does not affect
-     * application execution.
-     * @throws PrintException if the job could not be successfully cancelled.
+     * requests to a server and processing of its print queue. Clients may wish
+     * to execute cancel in a thread which does not affect application
+     * execution.
+     *
+     * @throws PrintException if the job could not be successfully cancelled
      */
     public void cancel() throws PrintException;
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/Doc.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/Doc.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -25,181 +25,165 @@
 
 package javax.print;
 
+import java.io.IOException;
 import java.io.InputStream;
-import java.io.IOException;
 import java.io.Reader;
 
 import javax.print.attribute.DocAttributeSet;
 
-
 /**
- * Interface Doc specifies the interface for an object that supplies one piece
- * of print data for a Print Job. "Doc" is a short, easy-to-pronounce term
+ * Interface {@code Doc} specifies the interface for an object that supplies one
+ * piece of print data for a Print Job. "Doc" is a short, easy-to-pronounce term
  * that means "a piece of print data." The client passes to the Print Job an
- * object that implements interface Doc, and the Print Job calls methods on
- * that object to obtain the print data. The Doc interface lets a Print Job:
- * <UL>
- * <LI>
- * Determine the format, or "doc flavor" (class {@link DocFlavor DocFlavor}),
- * in which the print data is available. A doc flavor designates the print
- * data format (a MIME type) and the representation class of the object
- * from which the print data comes.
- *
- * <LI>
- * Obtain the print data representation object, which is an instance of the
- * doc flavor's representation class. The Print Job can then obtain the actual
- * print data from the representation object.
- *
- * <LI>
- * Obtain the printing attributes that specify additional characteristics of
- * the doc or that specify processing instructions to be applied to the doc.
- * Printing attributes are defined in package {@link javax.print.attribute
- * javax.print.attribute}. The doc returns its printing attributes stored in
- * an {@link javax.print.attribute.DocAttributeSet javax.print.attribute.DocAttributeSet}.
- * </UL>
- * <P>
- * Each method in an implementation of interface Doc is permitted always to
- * return the same object each time the method is called.
- * This has implications
- * for a Print Job or other caller of a doc object whose print data
+ * object that implements interface {@code Doc}, and the Print Job calls methods
+ * on that object to obtain the print data. The {@code Doc} interface lets a
+ * Print Job:
+ * <ul>
+ *   <li>Determine the format, or "doc flavor" (class
+ *   {@link DocFlavor DocFlavor}), in which the print data is available. A doc
+ *   flavor designates the print data format (a MIME type) and the
+ *   representation class of the object from which the print data comes.
+ *   <li>Obtain the print data representation object, which is an instance of
+ *   the doc flavor's representation class. The Print Job can then obtain the
+ *   actual print data from the representation object.
+ *   <li>Obtain the printing attributes that specify additional characteristics
+ *   of the doc or that specify processing instructions to be applied to the
+ *   doc. Printing attributes are defined in package
+ *   {@link javax.print.attribute}. The doc returns its printing attributes
+ *   stored in an {@link DocAttributeSet javax.print.attribute.DocAttributeSet}.
+ * </ul>
+ * Each method in an implementation of interface {@code Doc} is permitted always
+ * to return the same object each time the method is called. This has
+ * implications for a Print Job or other caller of a doc object whose print data
  * representation object "consumes" the print data as the caller obtains the
  * print data, such as a print data representation object which is a stream.
- * Once the Print Job has called {@link #getPrintData()
- * getPrintData()} and obtained the stream, any further calls to
- * {@link #getPrintData() getPrintData()} will return the same
- * stream object upon which reading may already be in progress, <I>not</I> a new
- * stream object that will re-read the print data from the beginning. Specifying
- * a doc object to behave this way simplifies the implementation of doc objects,
- * and is justified on the grounds that a particular doc is intended to convey
- * print data only to one Print Job, not to several different Print Jobs. (To
- * convey the same print data to several different Print Jobs, you have to
- * create several different doc objects on top of the same print data source.)
- * <P>
- * Interface Doc affords considerable implementation flexibility. The print data
- * might already be in existence when the doc object is constructed. In this
- * case the objects returned by the doc's methods can be supplied to the doc's
- * constructor, be stored in the doc ahead of time, and simply be returned when
- * called for. Alternatively, the print data might not exist yet when the doc
- * object is constructed. In this case the doc object might provide a "lazy"
+ * Once the Print Job has called {@link #getPrintData() getPrintData()} and
+ * obtained the stream, any further calls to {@link #getPrintData()
+ * getPrintData()} will return the same stream object upon which reading may
+ * already be in progress, <i>not</i> a new stream object that will re-read the
+ * print data from the beginning. Specifying a doc object to behave this way
+ * simplifies the implementation of doc objects, and is justified on the grounds
+ * that a particular doc is intended to convey print data only to one Print Job,
+ * not to several different Print Jobs. (To convey the same print data to
+ * several different Print Jobs, you have to create several different doc
+ * objects on top of the same print data source.)
+ * <p>
+ * Interface {@code Doc} affords considerable implementation flexibility. The
+ * print data might already be in existence when the doc object is constructed.
+ * In this case the objects returned by the doc's methods can be supplied to the
+ * doc's constructor, be stored in the doc ahead of time, and simply be returned
+ * when called for. Alternatively, the print data might not exist yet when the
+ * doc object is constructed. In this case the doc object might provide a "lazy"
  * implementation that generates the print data representation object (and/or
  * the print data) only when the Print Job calls for it (when the Print Job
  * calls the {@link #getPrintData() getPrintData()} method).
- * <P>
+ * <p>
  * There is no restriction on the number of client threads that may be
  * simultaneously accessing the same doc. Therefore, all implementations of
- * interface Doc must be designed to be multiple thread safe.
+ * interface {@code Doc} must be designed to be multiple thread safe.
  * <p>
  * However there can only be one consumer of the print data obtained from a
- * Doc.
+ * {@code Doc}.
  * <p>
- * If print data is obtained from the client as a stream, by calling Doc's
- * {@code getReaderForText()} or {@code getStreamForBytes()}
- * methods, or because the print data source is already an InputStream or
- * Reader, then the print service should always close these streams for the
- * client on all job completion conditions. With the following caveat.
- * If the print data is itself a stream, the service will always close it.
- * If the print data is otherwise something that can be requested as a stream,
- * the service will only close the stream if it has obtained the stream before
- * terminating. That is, just because a print service might request data as
- * a stream does not mean that it will, with the implications that Doc
+ * If print data is obtained from the client as a stream, by calling
+ * {@code Doc}'s {@code getReaderForText()} or {@code getStreamForBytes()}
+ * methods, or because the print data source is already an {@code InputStream}
+ * or {@code Reader}, then the print service should always close these streams
+ * for the client on all job completion conditions. With the following caveat.
+ * If the print data is itself a stream, the service will always close it. If
+ * the print data is otherwise something that can be requested as a stream, the
+ * service will only close the stream if it has obtained the stream before
+ * terminating. That is, just because a print service might request data as a
+ * stream does not mean that it will, with the implications that {@code Doc}
  * implementors which rely on the service to close them should create such
  * streams only in response to a request from the service.
- * <HR>
  */
 public interface Doc {
 
     /**
-     * Determines the doc flavor in which this doc object will supply its
-     * piece of print data.
+     * Determines the doc flavor in which this doc object will supply its piece
+     * of print data.
      *
-     * @return  Doc flavor.
+     * @return doc flavor
      */
     public DocFlavor getDocFlavor();
 
     /**
      * Obtains the print data representation object that contains this doc
-     * object's piece of print data in the format corresponding to the
-     * supported doc flavor.
-     * The {@code getPrintData()} method returns an instance of
-     * the representation class whose name is given by {@link
-     * #getDocFlavor() getDocFlavor()}.{@link
-     * DocFlavor#getRepresentationClassName()
-     * getRepresentationClassName()}, and the return value can be cast
-     * from class Object to that representation class.
+     * object's piece of print data in the format corresponding to the supported
+     * doc flavor. The {@code getPrintData()} method returns an instance of the
+     * representation class whose name is given by{@link #getDocFlavor()
+     * getDocFlavor()}.{@link DocFlavor#getRepresentationClassName()
+     * getRepresentationClassName()}, and the return value can be cast from
+     * class {@code Object} to that representation class.
      *
-     * @return  Print data representation object.
-     *
-     * @exception  IOException
-     *     Thrown if the representation class is a stream and there was an I/O
-     *     error while constructing the stream.
+     * @return print data representation object
+     * @throws IOException if the representation class is a stream and there was
+     *         an I/O error while constructing the stream
      */
     public Object getPrintData() throws IOException;
 
     /**
      * Obtains the set of printing attributes for this doc object. If the
      * returned attribute set includes an instance of a particular attribute
-     * <I>X,</I> the printer must use that attribute value for this doc,
-     * overriding any value of attribute <I>X</I> in the job's attribute set.
-     * If the returned attribute set does not include an instance
-     * of a particular attribute <I>X</I> or if null is returned, the printer
-     * must consult the job's attribute set to obtain the value for
-     * attribute <I>X,</I> and if not found there, the printer must use an
+     * <i>X,</i> the printer must use that attribute value for this doc,
+     * overriding any value of attribute <i>X</i> in the job's attribute set. If
+     * the returned attribute set does not include an instance of a particular
+     * attribute <i>X</i> or if {@code null} is returned, the printer must
+     * consult the job's attribute set to obtain the value for attribute
+     * <i>X,</i> and if not found there, the printer must use an
      * implementation-dependent default value. The returned attribute set is
      * unmodifiable.
      *
-     * @return  Unmodifiable set of printing attributes for this doc, or null
-     *          to obtain all attribute values from the job's attribute
-     *          set.
+     * @return unmodifiable set of printing attributes for this doc, or
+     *         {@code null} to obtain all attribute values from the job's
+     *         attribute set
      */
     public DocAttributeSet getAttributes();
 
     /**
-     * Obtains a reader for extracting character print data from this doc.
-     * The Doc implementation is required to support this method if the
-     * DocFlavor has one of the following print data representation classes,
-     * and return null otherwise:
-     * <UL>
-     * <LI> char[]
-     * <LI> java.lang.String
-     * <LI> java.io.Reader
-     * </UL>
+     * Obtains a reader for extracting character print data from this doc. The
+     * {@code Doc} implementation is required to support this method if the
+     * {@code DocFlavor} has one of the following print data representation
+     * classes, and return {@code null} otherwise:
+     * <ul>
+     *   <li>char[]
+     *   <li>java.lang.String
+     *   <li>java.io.Reader
+     * </ul>
      * The doc's print data representation object is used to construct and
-     * return a Reader for reading the print data as a stream of characters
-     * from the print data representation object.
-     * However, if the print data representation object is itself a Reader,
-     * then the print data representation object is simply returned.
+     * return a {@code Reader} for reading the print data as a stream of
+     * characters from the print data representation object. However, if the
+     * print data representation object is itself a {@code Reader}, then the
+     * print data representation object is simply returned.
      *
-     * @return  Reader for reading the print data characters from this doc.
-     *          If a reader cannot be provided because this doc does not meet
-     *          the criteria stated above, null is returned.
-     *
-     * @exception  IOException
-     *     Thrown if there was an I/O error while creating the reader.
+     * @return reader for reading the print data characters from this doc. If a
+     *         reader cannot be provided because this doc does not meet the
+     *         criteria stated above, {@code null} is returned.
+     * @throws IOException if there was an I/O error while creating the reader
      */
     public Reader getReaderForText() throws IOException;
 
     /**
-     * Obtains an input stream for extracting byte print data from this
-     * doc.  The Doc implementation is required to support this method if
-     * the DocFlavor has one of the following print data representation
-     * classes, and return null otherwise:
-     * <UL>
-     * <LI> byte[]
-     * <LI> java.io.InputStream
-     * </UL>
+     * Obtains an input stream for extracting byte print data from this doc. The
+     * {@code Doc} implementation is required to support this method if the
+     * {@code DocFlavor} has one of the following print data representation
+     * classes, and return {@code null} otherwise:
+     * <ul>
+     *   <li>byte[]
+     *   <li>java.io.InputStream
+     * </ul>
      * This doc's print data representation object is obtained, then an input
      * stream for reading the print data from the print data representation
      * object as a stream of bytes is created and returned. However, if the
      * print data representation object is itself an input stream, then the
      * print data representation object is simply returned.
      *
-     * @return  Input stream for reading the print data bytes from this doc. If
-     *          an input stream cannot be provided because this doc does not
-     *          meet the criteria stated above, null is returned.
-     *
-     * @exception  IOException
-     *     Thrown if there was an I/O error while creating the input stream.
+     * @return input stream for reading the print data bytes from this doc. If
+     *         an input stream cannot be provided because this doc does not meet
+     *         the criteria stated above, {@code null} is returned.
+     * @throws IOException if there was an I/O error while creating the input
+     *         stream
      */
     public InputStream getStreamForBytes() throws IOException;
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java	Sat Sep 09 14:36:45 2017 +0200
@@ -30,447 +30,376 @@
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 
-
 /**
- * Class {@code DocFlavor} encapsulates an object that specifies the
- * format in which print data is supplied to a {@link DocPrintJob}.
- * "Doc" is a short, easy-to-pronounce term that means "a piece of print data."
- * The print data format, or "doc flavor", consists of two things:
- * <UL>
- * <LI>
- * <B>MIME type.</B> This is a Multipurpose Internet Mail Extensions (MIME)
- * media type (as defined in <A HREF="http://www.ietf.org/rfc/rfc2045.txt">RFC
- * 2045</A> and <A HREF="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</A>)
- * that specifies how the print data is to be interpreted.
- * The charset of text data should be the IANA MIME-preferred name, or its
- * canonical name if no preferred name is specified. Additionally a few
- * historical names supported by earlier versions of the Java platform may
- * be recognized.
- * See <a href="../../java/lang/package-summary.html#charenc">
- * character encodings</a> for more information on the character encodings
- * supported on the Java platform.
+ * Class {@code DocFlavor} encapsulates an object that specifies the format in
+ * which print data is supplied to a {@link DocPrintJob}. "Doc" is a short,
+ * easy-to-pronounce term that means "a piece of print data." The print data
+ * format, or "doc flavor", consists of two things:
+ * <ul>
+ *   <li><b>MIME type.</b> This is a Multipurpose Internet Mail Extensions
+ *   (MIME) media type (as defined in
+ *   <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a> and
+ *   <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a>) that specifies
+ *   how the print data is to be interpreted. The charset of text data should be
+ *   the IANA MIME-preferred name, or its canonical name if no preferred name is
+ *   specified. Additionally a few historical names supported by earlier
+ *   versions of the Java platform may be recognized. See
+ *   <a href="../../java/lang/package-summary.html#charenc">character encodings
+ *   </a> for more information on the character encodings supported on the Java
+ *   platform.
+ *   <li><b>Representation class name.</b> This specifies the fully-qualified
+ *   name of the class of the object from which the actual print data comes, as
+ *   returned by the {@link Class#getName() Class.getName()} method. (Thus the
+ *   class name for {@code byte[]} is {@code "[B"}, for {@code char[]} it is
+ *   {@code "[C"}.)
+ * </ul>
+ * A {@code DocPrintJob} obtains its print data by means of interface
+ * {@link Doc Doc}. A {@code Doc} object lets the {@code DocPrintJob} determine
+ * the doc flavor the client can supply. A {@code Doc} object also lets the
+ * {@code DocPrintJob} obtain an instance of the doc flavor's representation
+ * class, from which the {@code DocPrintJob} then obtains the actual print data.
  *
- * <LI>
- * <B>Representation class name.</B> This specifies the fully-qualified name of
- * the class of the object from which the actual print data comes, as returned
- * by the {@link java.lang.Class#getName() Class.getName()} method.
- * (Thus the class name for {@code byte[]} is {@code "[B"}, for
- * {@code char[]} it is {@code "[C"}.)
- * </UL>
- * <P>
- * A {@code DocPrintJob} obtains its print data by means of interface
- * {@link Doc Doc}. A {@code Doc} object lets the {@code DocPrintJob}
- * determine the doc flavor the client can supply.  A {@code Doc} object
- * also lets the {@code DocPrintJob} obtain an instance of the doc flavor's
- * representation class, from which the {@code DocPrintJob} then obtains
- * the actual print data.
- *
- * <HR>
- * <H3>Client Formatted Print Data</H3>
- * There are two broad categories of print data, client formatted print data
- * and service formatted print data.
- * <P>
- * For <B>client formatted print data</B>, the client determines or knows the
- * print data format.
- * For example the client may have a JPEG encoded image, a URL for
- * HTML code, or a disk file containing plain text in some encoding,
- * possibly obtained from an external source, and
- * requires a way to describe the data format to the print service.
+ * <hr>
+ * <h3>Client Formatted Print Data</h3>
+ * There are two broad categories of print data, client formatted print data and
+ * service formatted print data.
+ * <p>
+ * For <b>client formatted print data</b>, the client determines or knows the
+ * print data format. For example the client may have a JPEG encoded image, a
+ * {@code URL} for HTML code, or a disk file containing plain text in some
+ * encoding, possibly obtained from an external source, and requires a way to
+ * describe the data format to the print service.
  * <p>
  * The doc flavor's representation class is a conduit for the JPS
- * {@code DocPrintJob} to obtain a sequence of characters or
- * bytes from the client. The
- * doc flavor's MIME type is one of the standard media types telling how to
- * interpret the sequence of characters or bytes. For a list of standard media
- * types, see the Internet Assigned Numbers Authority's (IANA's) <A
- * HREF="http://www.iana.org/assignments/media-types/">Media Types
- * Directory</A>. Interface {@link Doc Doc} provides two utility operations,
+ * {@code DocPrintJob} to obtain a sequence of characters or bytes from the
+ * client. The doc flavor's MIME type is one of the standard media types telling
+ * how to interpret the sequence of characters or bytes. For a list of standard
+ * media types, see the Internet Assigned Numbers Authority's (IANA's)
+ * <a href="http://www.iana.org/assignments/media-types/">Media Types Directory
+ * </a>. Interface {@link Doc Doc} provides two utility operations,
  * {@link Doc#getReaderForText() getReaderForText} and
- * {@link Doc#getStreamForBytes() getStreamForBytes()}, to help a
- * {@code Doc} object's client extract client formatted print data.
- * <P>
+ * {@link Doc#getStreamForBytes() getStreamForBytes()}, to help a {@code Doc}
+ * object's client extract client formatted print data.
+ * <p>
  * For client formatted print data, the print data representation class is
  * typically one of the following (although other representation classes are
  * permitted):
- * <UL>
- * <LI>
- * Character array ({@code char[]}) -- The print data consists of the
- * Unicode characters in the array.
- *
- * <LI>
- * {@code String}  --
- * The print data consists of the Unicode characters in the string.
- *
- * <LI>
- * Character stream ({@link java.io.Reader java.io.Reader})
- * -- The print data consists of the Unicode characters read from the stream
- * up to the end-of-stream.
- *
- * <LI>
- * Byte array ({@code byte[]}) -- The print data consists of the bytes in
- * the array. The bytes are encoded in the character set specified by the doc
- * flavor's MIME type. If the MIME type does not specify a character set, the
- * default character set is US-ASCII.
+ * <ul>
+ *   <li>Character array ({@code char[]}) -- The print data consists of the
+ *   Unicode characters in the array.
+ *   <li>{@code String} -- The print data consists of the Unicode characters in
+ *   the string.
+ *   <li>Character stream ({@link java.io.Reader java.io.Reader}) -- The print
+ *   data consists of the Unicode characters read from the stream up to the
+ *   end-of-stream.
+ *   <li>Byte array ({@code byte[]}) -- The print data consists of the bytes in
+ *   the array. The bytes are encoded in the character set specified by the doc
+ *   flavor's MIME type. If the MIME type does not specify a character set, the
+ *   default character set is US-ASCII.
+ *   <li>Byte stream ({@link java.io.InputStream java.io.InputStream}) -- The
+ *   print data consists of the bytes read from the stream up to the
+ *   end-of-stream. The bytes are encoded in the character set specified by the
+ *   doc flavor's MIME type. If the MIME type does not specify a character set,
+ *   the default character set is US-ASCII.
+ *   <li>Uniform Resource Locator ({@link java.net.URL URL}) -- The print data
+ *   consists of the bytes read from the URL location. The bytes are encoded in
+ *   the character set specified by the doc flavor's MIME type. If the MIME type
+ *   does not specify a character set, the default character set is US-ASCII.
+ *   When the representation class is a {@code URL}, the print service itself
+ *   accesses and downloads the document directly from its {@code URL} address,
+ *   without involving the client. The service may be some form of network print
+ *   service which is executing in a different environment. This means you
+ *   should not use a {@code URL} print data flavor to print a document at a
+ *   restricted {@code URL} that the client can see but the printer cannot see.
+ *   This also means you should not use a {@code URL} print data flavor to print
+ *   a document stored in a local file that is not available at a {@code URL}
+ *   accessible independently of the client. For example, a file that is not
+ *   served up by an HTTP server or FTP server. To print such documents, let the
+ *   client open an input stream on the {@code URL} or file and use an input
+ *   stream data flavor.
+ * </ul>
  *
- * <LI>
- * Byte stream ({@link java.io.InputStream java.io.InputStream}) --
- * The print data consists of the bytes read from the stream up to the
- * end-of-stream. The bytes are encoded in the character set specified by the
- * doc flavor's MIME type. If the MIME type does not specify a character set,
- * the default character set is US-ASCII.
-
- * <LI>
- * Uniform Resource Locator ({@link java.net.URL URL})
- * -- The print data consists of the bytes read from the URL location.
- * The bytes are encoded in the character set specified by the doc flavor's
- * MIME type. If the MIME type does not specify a character set, the default
- * character set is US-ASCII.
- * <P>
- * When the representation class is a URL, the print service itself accesses
- * and downloads the document directly from its URL address, without involving
- * the client. The service may be some form of network print service which
- * is executing in a different environment.
- * This means you should not use a URL print data flavor to print a
- * document at a restricted URL that the client can see but the printer cannot
- * see. This also means you should not use a URL print data flavor to print a
- * document stored in a local file that is not available at a URL
- * accessible independently of the client.
- * For example, a file that is not served up by an HTTP server or FTP server.
- * To print such documents, let the client open an input stream on the URL
- * or file and use an input stream data flavor.
- * </UL>
- *
- * <HR>
+ * <hr>
  * <h3>Default and Platform Encodings</h3>
- * <P>
  * For byte print data where the doc flavor's MIME type does not include a
  * {@code charset} parameter, the Java Print Service instance assumes the
  * US-ASCII character set by default. This is in accordance with
- * <A HREF="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</A>, which says the
- * default character set is US-ASCII. Note that US-ASCII is a subset of
- * UTF-8, so in the future this may be widened if a future RFC endorses
- * UTF-8 as the default in a compatible manner.
+ * <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a>, which says the
+ * default character set is US-ASCII. Note that US-ASCII is a subset of UTF-8,
+ * so in the future this may be widened if a future RFC endorses UTF-8 as the
+ * default in a compatible manner.
  * <p>
- * Also note that this is different than the behaviour of the Java runtime
- * when interpreting a stream of bytes as text data. That assumes the
- * default encoding for the user's locale. Thus, when spooling a file in local
- * encoding to a Java Print Service it is important to correctly specify
- * the encoding. Developers working in the English locales should
- * be particularly conscious of this, as their platform encoding corresponds
- * to the default mime charset. By this coincidence that particular
- * case may work without specifying the encoding of platform data.
+ * Also note that this is different than the behaviour of the Java runtime when
+ * interpreting a stream of bytes as text data. That assumes the default
+ * encoding for the user's locale. Thus, when spooling a file in local encoding
+ * to a Java Print Service it is important to correctly specify the encoding.
+ * Developers working in the English locales should be particularly conscious of
+ * this, as their platform encoding corresponds to the default mime charset. By
+ * this coincidence that particular case may work without specifying the
+ * encoding of platform data.
  * <p>
  * Every instance of the Java virtual machine has a default character encoding
  * determined during virtual-machine startup and typically depends upon the
- * locale and charset being used by the underlying operating system.
- * In a distributed environment there is no guarantee that two VM share
- * the same default encoding. Thus clients which want to stream platform
- * encoded text data from the host platform to a Java Print Service instance
- * must explicitly declare the charset and not rely on defaults.
+ * locale and charset being used by the underlying operating system. In a
+ * distributed environment there is no guarantee that two VM share the same
+ * default encoding. Thus clients which want to stream platform encoded text
+ * data from the host platform to a Java Print Service instance must explicitly
+ * declare the charset and not rely on defaults.
  * <p>
  * The preferred form is the official IANA primary name for an encoding.
- * Applications which stream text data should always specify the charset
- * in the mime type, which necessitates obtaining the encoding of the host
- * platform for data (eg files) stored in that platform's encoding.
- * A CharSet which corresponds to this and is suitable for use in a
- * mime-type for a DocFlavor can be obtained
- * from {@link DocFlavor#hostEncoding DocFlavor.hostEncoding}
- * This may not always be the primary IANA name but is guaranteed to be
- * understood by this VM.
- * For common flavors, the pre-defined *HOST DocFlavors may be used.
+ * Applications which stream text data should always specify the charset in the
+ * mime type, which necessitates obtaining the encoding of the host platform for
+ * data (eg files) stored in that platform's encoding. A {@code CharSet} which
+ * corresponds to this and is suitable for use in a mime-type for a
+ * {@code DocFlavor} can be obtained from
+ * {@link DocFlavor#hostEncoding DocFlavor.hostEncoding} This may not always be
+ * the primary IANA name but is guaranteed to be understood by this VM. For
+ * common flavors, the pre-defined *HOST {@code DocFlavors} may be used.
  * <p>
- * See <a href="../../java/lang/package-summary.html#charenc">
- * character encodings</a> for more information on the character encodings
- * supported on the Java platform.
- * <HR>
- * <h3>Recommended DocFlavors</h3>
- * <P>
- * The Java Print Service API does not define any mandatorily supported
- * DocFlavors.
- * However, here are some examples of MIME types that a Java Print Service
- * instance might support for client formatted print data.
- * Nested classes inside class DocFlavor declare predefined static
- * constant DocFlavor objects for these example doc flavors; class DocFlavor's
- * constructor can be used to create an arbitrary doc flavor.
- * <UL>
- * <LI>Preformatted text
- * <table class="striped">
- * <caption>MIME-Types and their descriptions</caption>
- * <thead>
- * <TR>
- *  <TH>MIME-Type</TH><TH>Description</TH>
- * </TR>
- * </thead>
- * <tbody>
- * <TR>
- * <TD>{@code "text/plain"}</TD>
- * <TD>Plain text in the default character set (US-ASCII)</TD>
- * </TR>
- * <TR>
- * <TD><code>"text/plain; charset=<I>xxx</I>"</code></TD>
- * <TD>Plain text in character set <I>xxx</I></TD>
- * </TR>
- * <TR>
- * <TD>{@code "text/html"}</TD>
- * <TD>HyperText Markup Language in the default character set (US-ASCII)</TD>
- * </TR>
- * <TR>
- * <TD><code>"text/html; charset=<I>xxx</I>"</code></TD>
- * <TD>HyperText Markup Language in character set <I>xxx</I></TD>
- * </TR>
- * </tbody>
- * </TABLE>
- * <P>
- * In general, preformatted text print data is provided either in a character
- * oriented representation class (character array, String, Reader) or in a
- * byte oriented representation class (byte array, InputStream, URL).
- *
- *  <LI>Preformatted page description language (PDL) documents
+ * See <a href="../../java/lang/package-summary.html#charenc">character
+ * encodings</a> for more information on the character encodings supported on
+ * the Java platform.
  *
- * <table class="striped">
- * <caption>MIME-Types and their descriptions</caption>
- * <thead>
- * <TR>
- *  <TH>MIME-Type</TH><TH>Description</TH>
- * </TR>
- * </thead>
- * <tbody>
- * <TR>
- * <TD>{@code "application/pdf"}</TD>
- * <TD>Portable Document Format document</TD>
- * </TR>
- * <TR>
- * <TD>{@code "application/postscript"}</TD>
- * <TD>PostScript document</TD>
- * </TR>
- * <TR>
- * <TD>{@code "application/vnd.hp-PCL"}</TD>
- * <TD>Printer Control Language document</TD>
- * </TR>
- * </tbody>
- * </TABLE>
- * <P>
- * In general, preformatted PDL print data is provided in a byte oriented
- * representation class (byte array, InputStream, URL).
- *
- *  <LI>Preformatted images
+ * <hr>
+ * <h3>Recommended DocFlavors</h3>
+ * The Java Print Service API does not define any mandatorily supported
+ * {@code DocFlavors}. However, here are some examples of MIME types that a Java
+ * Print Service instance might support for client formatted print data. Nested
+ * classes inside class {@code DocFlavor} declare predefined static constant
+ * {@code DocFlavor} objects for these example doc flavors; class
+ * {@code DocFlavor}'s constructor can be used to create an arbitrary doc
+ * flavor.
+ * <ul>
+ *   <li>Preformatted text
+ *   <table class="striped">
+ *   <caption>MIME-Types and their descriptions</caption>
+ *   <thead>
+ *     <tr>
+ *       <th>MIME-Type
+ *       <th>Description
+ *   </thead>
+ *   <tbody>
+ *     <tr>
+ *       <td>{@code "text/plain"}
+ *       <td>Plain text in the default character set (US-ASCII)
+ *     <tr>
+ *       <td><code> "text/plain; charset=<i>xxx</i>"</code>
+ *       <td>Plain text in character set <i>xxx</i>
+ *     <tr>
+ *       <td>{@code "text/html"}
+ *       <td>HyperText Markup Language in the default character set (US-ASCII)
+ *     <tr>
+ *       <td><code> "text/html; charset=<i>xxx</i>"</code>
+ *       <td>HyperText Markup Language in character set <i>xxx</i>
+ *   </tbody>
+ *   </table>
+ *   In general, preformatted text print data is provided either in a character
+ *   oriented representation class (character array, String, Reader) or in a
+ *   byte oriented representation class (byte array, InputStream, URL).
+ *   <li>Preformatted page description language (PDL) documents
+ *   <table class="striped">
+ *   <caption>MIME-Types and their descriptions</caption>
+ *   <thead>
+ *     <tr>
+ *       <th>MIME-Type
+ *       <th>Description
+ *   </thead>
+ *   <tbody>
+ *     <tr>
+ *       <td>{@code "application/pdf"}
+ *       <td>Portable Document Format document
+ *     <tr>
+ *       <td>{@code "application/postscript"}
+ *       <td>PostScript document
+ *     <tr>
+ *       <td>{@code "application/vnd.hp-PCL"}
+ *       <td>Printer Control Language document
+ *   </tbody>
+ *   </table>
+ *   In general, preformatted PDL print data is provided in a byte oriented
+ *   representation class (byte array, {@code InputStream}, {@code URL}).
+ *   <li>Preformatted images
+ *   <table class="striped">
+ *   <caption>MIME-Types and their descriptions</caption>
+ *   <thead>
+ *     <tr>
+ *       <th>MIME-Type
+ *       <th>Description
+ *   </thead>
+ *   <tbody>
+ *     <tr>
+ *       <td>{@code "image/gif"}
+ *       <td>Graphics Interchange Format image
+ *     <tr>
+ *       <td>{@code "image/jpeg"}
+ *       <td>Joint Photographic Experts Group image
+ *     <tr>
+ *       <td>{@code "image/png"}
+ *       <td>Portable Network Graphics image
+ *   </tbody>
+ *   </table>
+ *   In general, preformatted image print data is provided in a byte oriented
+ *   representation class (byte array, {@code InputStream}, {@code URL}).
+ *   <li>Preformatted autosense print data
+ *   <table class="striped">
+ *   <caption>MIME-Types and their descriptions</caption>
+ *   <thead>
+ *     <tr>
+ *       <th>MIME-Type
+ *       <th>Description
+ *   </thead>
+ *   <tbody>
+ *     <tr>
+ *       <td>{@code "application/octet-stream"}
+ *       <td>The print data format is unspecified (just an octet stream)
+ *   </tbody>
+ *   </table>
+ *   The printer decides how to interpret the print data; the way this
+ *   "autosensing" works is implementation dependent. In general, preformatted
+ *   autosense print data is provided in a byte oriented representation class
+ *   (byte array, {@code InputStream}, {@code URL}).
+ * </ul>
  *
- * <table class="striped">
- * <caption>MIME-Types and their descriptions</caption>
- * <thead>
- * <TR>
- *  <TH>MIME-Type</TH><TH>Description</TH>
- * </TR>
- * </thead>
- * <tbody>
- * <TR>
- * <TD>{@code "image/gif"}</TD>
- * <TD>Graphics Interchange Format image</TD>
- * </TR>
- * <TR>
- * <TD>{@code "image/jpeg"}</TD>
- * <TD>Joint Photographic Experts Group image</TD>
- * </TR>
- * <TR>
- * <TD>{@code "image/png"}</TD>
- * <TD>Portable Network Graphics image</TD>
- * </TR>
- * </tbody>
- * </TABLE>
- * <P>
- * In general, preformatted image print data is provided in a byte oriented
- * representation class (byte array, InputStream, URL).
- *
- *  <LI>Preformatted autosense print data
- *
- * <table class="striped">
- * <caption>MIME-Types and their descriptions</caption>
- * <thead>
- * <TR>
- *  <TH>MIME-Type</TH><TH>Description</TH>
- * </TR>
- * </thead>
- * <tbody>
- * <TR>
- * <TD>{@code "application/octet-stream"}</TD>
- * <TD>The print data format is unspecified (just an octet stream)</TD>
- * </TR>
- * </tbody>
- * </TABLE>
- * <P>
- * The printer decides how to interpret the print data; the way this
- * "autosensing" works is implementation dependent. In general, preformatted
- * autosense print data is provided in a byte oriented representation class
- * (byte array, InputStream, URL).
- * </UL>
- *
- * <HR>
- * <H3>Service Formatted Print Data</H3>
- * <P>
- * For <B>service formatted print data</B>, the Java Print Service instance
+ * <hr>
+ * <h3>Service Formatted Print Data</h3>
+ * For <b>service formatted print data</b>, the Java Print Service instance
  * determines the print data format. The doc flavor's representation class
  * denotes an interface whose methods the {@code DocPrintJob} invokes to
- * determine the content to be printed -- such as a renderable image
- * interface or a Java printable interface.
- * The doc flavor's MIME type is the special value
- * {@code "application/x-java-jvm-local-objectref"} indicating the client
- * will supply a reference to a Java object that implements the interface
- * named as the representation class.
- * This MIME type is just a placeholder; what's
+ * determine the content to be printed -- such as a renderable image interface
+ * or a Java printable interface. The doc flavor's MIME type is the special
+ * value {@code "application/x-java-jvm-local-objectref"} indicating the client
+ * will supply a reference to a Java object that implements the interface named
+ * as the representation class. This MIME type is just a placeholder; what's
  * important is the print data representation class.
- * <P>
+ * <p>
  * For service formatted print data, the print data representation class is
  * typically one of the following (although other representation classes are
- * permitted). Nested classes inside class DocFlavor declare predefined static
- * constant DocFlavor objects for these example doc flavors; class DocFlavor's
- * constructor can be used to create an arbitrary doc flavor.
- * <UL>
- * <LI>
- * Renderable image object -- The client supplies an object that implements
- * interface
- * {@link java.awt.image.renderable.RenderableImage RenderableImage}. The
- * printer calls methods
- * in that interface to obtain the image to be printed.
- *
- * <LI>
- * Printable object -- The client supplies an object that implements interface
- * {@link java.awt.print.Printable Printable}.
- * The printer calls methods in that interface to obtain the pages to be
- * printed, one by one.
- * For each page, the printer supplies a graphics context, and whatever the
- * client draws in that graphics context gets printed.
- *
- * <LI>
- * Pageable object -- The client supplies an object that implements interface
- * {@link java.awt.print.Pageable Pageable}. The printer calls
- * methods in that interface to obtain the pages to be printed, one by one.
- * For each page, the printer supplies a graphics context, and whatever
- * the client draws in that graphics context gets printed.
- * </UL>
- *
- * <HR>
+ * permitted). Nested classes inside class {@code DocFlavor} declare predefined
+ * static constant {@code DocFlavor} objects for these example doc flavors;
+ * class {@code DocFlavor}'s constructor can be used to create an arbitrary doc
+ * flavor.
+ * <ul>
+ *   <li>Renderable image object -- The client supplies an object that
+ *   implements interface
+ *   {@link java.awt.image.renderable.RenderableImage RenderableImage}. The
+ *   printer calls methods in that interface to obtain the image to be printed.
+ *   <li>Printable object -- The client supplies an object that implements
+ *   interface {@link java.awt.print.Printable Printable}. The printer calls
+ *   methods in that interface to obtain the pages to be printed, one by one.
+ *   For each page, the printer supplies a graphics context, and whatever the
+ *   client draws in that graphics context gets printed.
+ *   <li>Pageable object -- The client supplies an object that implements
+ *   interface {@link java.awt.print.Pageable Pageable}. The printer calls
+ *   methods in that interface to obtain the pages to be printed, one by one.
+ *   For each page, the printer supplies a graphics context, and whatever the
+ *   client draws in that graphics context gets printed.
+ * </ul>
  *
- * <HR>
- * <H3>Pre-defined Doc Flavors</H3>
- * A Java Print Service instance is not <B><I>required</I></B> to support the
- * following print data formats and print data representation classes.  In
- * fact, a developer using this class should <b>never</b> assume that a
- * particular print service supports the document types corresponding to
- * these pre-defined doc flavors.  Always query the print service
- * to determine what doc flavors it supports.  However,
- * developers who have print services that support these doc flavors are
- * encouraged to refer to the predefined singleton instances created here.
- * <UL>
- * <LI>
- * Plain text print data provided through a byte stream. Specifically, the
- * following doc flavors are recommended to be supported:
- * <BR>&#183;&nbsp;&nbsp;
- * {@code ("text/plain", "java.io.InputStream")}
- * <BR>&#183;&nbsp;&nbsp;
- * {@code ("text/plain; charset=us-ascii", "java.io.InputStream")}
- * <BR>&#183;&nbsp;&nbsp;
- * {@code ("text/plain; charset=utf-8", "java.io.InputStream")}
- *
- * <LI>
- * Renderable image objects. Specifically, the following doc flavor is
- * recommended to be supported:
- * <BR>&#183;&nbsp;&nbsp;
- * {@code ("application/x-java-jvm-local-objectref", "java.awt.image.renderable.RenderableImage")}
- * </UL>
- * <P>
- * A Java Print Service instance is allowed to support any other doc flavors
- * (or none) in addition to the above mandatory ones, at the implementation's
+ * <hr>
+ * <h3>Pre-defined Doc Flavors</h3>
+ * A Java Print Service instance is not <b><i>required</i></b> to support the
+ * following print data formats and print data representation classes. In fact,
+ * a developer using this class should <b>never</b> assume that a particular
+ * print service supports the document types corresponding to these pre-defined
+ * doc flavors. Always query the print service to determine what doc flavors it
+ * supports. However, developers who have print services that support these doc
+ * flavors are encouraged to refer to the predefined singleton instances created
+ * here.
+ * <ul>
+ *   <li>Plain text print data provided through a byte stream. Specifically, the
+ *   following doc flavors are recommended to be supported:
+ *   <br>&#183;&nbsp;&nbsp;
+ *   {@code ("text/plain", "java.io.InputStream")}
+ *   <br>&#183;&nbsp;&nbsp;
+ *   {@code ("text/plain; charset=us-ascii", "java.io.InputStream")}
+ *   <br>&#183;&nbsp;&nbsp;
+ *   {@code ("text/plain; charset=utf-8", "java.io.InputStream")}
+ *   <li>Renderable image objects. Specifically, the following doc flavor is
+ *   recommended to be supported:
+ *   <br>&#183;&nbsp;&nbsp;
+ *   {@code ("application/x-java-jvm-local-objectref", "java.awt.image.renderable.RenderableImage")}
+ * </ul>
+ * A Java Print Service instance is allowed to support any other doc flavors (or
+ * none) in addition to the above mandatory ones, at the implementation's
  * choice.
- * <P>
+ * <p>
  * Support for the above doc flavors is desirable so a printing client can rely
  * on being able to print on any JPS printer, regardless of which doc flavors
  * the printer supports. If the printer doesn't support the client's preferred
  * doc flavor, the client can at least print plain text, or the client can
  * convert its data to a renderable image and print the image.
- * <P>
+ * <p>
  * Furthermore, every Java Print Service instance must fulfill these
  * requirements for processing plain text print data:
- * <UL>
- * <LI>
- * The character pair carriage return-line feed (CR-LF) means
- * "go to column 1 of the next line."
- * <LI>
- * A carriage return (CR) character standing by itself means
- * "go to column 1 of the next line."
- * <LI>
- * A line feed (LF) character standing by itself means
- * "go to column 1 of the next line."
- * </UL>
- * <P>
+ * <ul>
+ *   <li>The character pair carriage return-line feed (CR-LF) means "go to
+ *   column 1 of the next line."
+ *   <li>A carriage return (CR) character standing by itself means "go to column
+ *   1 of the next line."
+ *   <li>A line feed (LF) character standing by itself means "go to column 1 of
+ *   the next line."
+ * </ul>
  * The client must itself perform all plain text print data formatting not
  * addressed by the above requirements.
  *
- * <H3>Design Rationale</H3>
- * <P>
- * Class DocFlavor in package javax.print.data is similar to class
- * {@link java.awt.datatransfer.DataFlavor DataFlavor}. Class
- * {@code DataFlavor}
- * is not used in the Java Print Service (JPS) API
- * for three reasons which are all rooted in allowing the JPS API to be
- * shared by other print services APIs which may need to run on Java profiles
- * which do not include all of the Java Platform, Standard Edition.
- * <OL TYPE=1>
- * <LI>
- * The JPS API is designed to be used in Java profiles which do not support
- * AWT.
- *
- * <LI>
- * The implementation of class {@code java.awt.datatransfer.DataFlavor}
- * does not guarantee that equivalent data flavors will have the same
- * serialized representation. DocFlavor does, and can be used in services
- * which need this.
+ * <h3>Design Rationale</h3>
+ * Class {@code DocFlavor} in package {@code javax.print} is similar to class
+ * {@link java.awt.datatransfer.DataFlavor}. Class {@code DataFlavor} is not
+ * used in the Java Print Service (JPS) API for three reasons which are all
+ * rooted in allowing the JPS API to be shared by other print services APIs
+ * which may need to run on Java profiles which do not include all of the Java
+ * Platform, Standard Edition.
+ * <ol type=1>
+ *   <li>The JPS API is designed to be used in Java profiles which do not
+ *   support AWT.
+ *   <li>The implementation of class {@code java.awt.datatransfer.DataFlavor}
+ *   does not guarantee that equivalent data flavors will have the same
+ *   serialized representation. {@code DocFlavor} does, and can be used in
+ *   services which need this.
+ *   <li>The implementation of class {@code java.awt.datatransfer.DataFlavor}
+ *   includes a human presentable name as part of the serialized representation.
+ *   This is not appropriate as part of a service matching constraint.
+ * </ol>
+ * Class {@code DocFlavor}'s serialized representation uses the following
+ * canonical form of a MIME type string. Thus, two doc flavors with MIME types
+ * that are not identical but that are equivalent (that have the same canonical
+ * form) may be considered equal.
+ * <ul>
+ *   <li>The media type, media subtype, and parameters are retained, but all
+ *   comments and whitespace characters are discarded.
+ *   <li>The media type, media subtype, and parameter names are converted to
+ *   lowercase.
+ *   <li>The parameter values retain their original case, except a charset
+ *   parameter value for a text media type is converted to lowercase.
+ *   <li>Quote characters surrounding parameter values are removed.
+ *   <li>Quoting backslash characters inside parameter values are removed.
+ *   <li>The parameters are arranged in ascending order of parameter name.
+ * </ul>
+ * Class {@code DocFlavor}'s serialized representation also contains the
+ * fully-qualified class <i>name</i> of the representation class (a
+ * {@code String} object), rather than the representation class itself (a
+ * {@code Class} object). This allows a client to examine the doc flavors a Java
+ * Print Service instance supports without having to load the representation
+ * classes, which may be problematic for limited-resource clients.
  *
- * <LI>
- * The implementation of class {@code java.awt.datatransfer.DataFlavor}
- * includes a human presentable name as part of the serialized representation.
- * This is not appropriate as part of a service matching constraint.
- * </OL>
- * <P>
- * Class DocFlavor's serialized representation uses the following
- * canonical form of a MIME type string. Thus, two doc flavors with MIME types
- * that are not identical but that are equivalent (that have the same
- * canonical form) may be considered equal.
- * <UL>
- * <LI> The media type, media subtype, and parameters are retained, but all
- *      comments and whitespace characters are discarded.
- * <LI> The media type, media subtype, and parameter names are converted to
- *      lowercase.
- * <LI> The parameter values retain their original case, except a charset
- *      parameter value for a text media type is converted to lowercase.
- * <LI> Quote characters surrounding parameter values are removed.
- * <LI> Quoting backslash characters inside parameter values are removed.
- * <LI> The parameters are arranged in ascending order of parameter name.
- * </UL>
- * <P>
- * Class DocFlavor's serialized representation also contains the
- * fully-qualified class <I>name</I> of the representation class
- * (a String object), rather than the representation class itself
- * (a Class object). This allows a client to examine the doc flavors a
- * Java Print Service instance supports without having
- * to load the representation classes, which may be problematic for
- * limited-resource clients.
- *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class DocFlavor implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -4512080796965449721L;
 
     /**
-     * A String representing the host operating system encoding.
-     * This will follow the conventions documented in
+     * A string representing the host operating system encoding. This will
+     * follow the conventions documented in
      * <a href="http://www.ietf.org/rfc/rfc2278.txt">
      * <i>RFC&nbsp;2278:&nbsp;IANA Charset Registration Procedures</i></a>
      * except where historical names are returned for compatibility with
-     * previous versions of the Java platform.
-     * The value returned from method is valid only for the VM which
-     * returns it, for use in a DocFlavor.
-     * This is the charset for all the "HOST" pre-defined DocFlavors in
+     * previous versions of the Java platform. The value returned from method is
+     * valid only for the VM which returns it, for use in a {@code DocFlavor}.
+     * This is the charset for all the "HOST" pre-defined {@code DocFlavors} in
      * the executing VM.
      */
     public static final String hostEncoding;
@@ -488,6 +417,7 @@
 
     /**
      * Representation class name.
+     *
      * @serial
      */
     private String myClassName;
@@ -497,21 +427,17 @@
      */
     private transient String myStringValue = null;
 
-
     /**
      * Constructs a new doc flavor object from the given MIME type and
      * representation class name. The given MIME type is converted into
      * canonical form and stored internally.
      *
-     * @param  mimeType   MIME media type string.
-     * @param  className  Fully-qualified representation class name.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code mimeType} is null or
-     *     {@code className} is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code mimeType} does not
-     *     obey the syntax for a MIME media type string.
+     * @param  mimeType MIME media type string
+     * @param  className fully-qualified representation class name
+     * @throws NullPointerException if {@code mimeType} or {@code className} is
+     *         {@code null}
+     * @throws IllegalArgumentException if {@code mimeType} does not obey the
+     *         syntax for a MIME media type string
      */
     public DocFlavor(String mimeType, String className) {
         if (className == null) {
@@ -522,8 +448,9 @@
     }
 
     /**
-     * Returns this doc flavor object's MIME type string based on the
-     * canonical form. Each parameter value is enclosed in quotes.
+     * Returns this doc flavor object's MIME type string based on the canonical
+     * form. Each parameter value is enclosed in quotes.
+     *
      * @return the mime type
      */
     public String getMimeType() {
@@ -532,6 +459,7 @@
 
     /**
      * Returns this doc flavor object's media type (from the MIME type).
+     *
      * @return the media type
      */
     public String getMediaType() {
@@ -540,6 +468,7 @@
 
     /**
      * Returns this doc flavor object's media subtype (from the MIME type).
+     *
      * @return the media sub-type
      */
     public String getMediaSubtype() {
@@ -547,19 +476,18 @@
     }
 
     /**
-     * Returns a {@code String} representing a MIME
-     * parameter.
-     * Mime types may include parameters which are usually optional.
-     * The charset for text types is a commonly useful example.
-     * This convenience method will return the value of the specified
-     * parameter if one was specified in the mime type for this flavor.
+     * Returns a {@code String} representing a MIME parameter. Mime types may
+     * include parameters which are usually optional. The charset for text types
+     * is a commonly useful example. This convenience method will return the
+     * value of the specified parameter if one was specified in the mime type
+     * for this flavor.
      *
-     * @param paramName the name of the paramater. This name is internally
-     * converted to the canonical lower case format before performing
-     * the match.
-     * @return String representing a mime parameter, or
-     * null if that parameter is not in the mime type string.
-     * @exception NullPointerException if paramName is null.
+     * @param  paramName the name of the parameter. This name is internally
+     *         converted to the canonical lower case format before performing
+     *         the match.
+     * @return a string representing a mime parameter, or {@code null} if that
+     *         parameter is not in the mime type string
+     * @throws NullPointerException if paramName is {@code null}
      */
     public String getParameter(String paramName) {
         return myMimeType.getParameterMap().get(paramName.toLowerCase());
@@ -567,7 +495,8 @@
 
     /**
      * Returns the name of this doc flavor object's representation class.
-     * @return the name of the representation class.
+     *
+     * @return the name of the representation class
      */
     public String getRepresentationClassName() {
         return myClassName;
@@ -576,10 +505,9 @@
     /**
      * Converts this {@code DocFlavor} to a string.
      *
-     * @return  MIME type string based on the canonical form. Each parameter
-     *          value is enclosed in quotes.
-     *          A "class=" parameter is appended to the
-     *          MIME type string to indicate the representation class name.
+     * @return MIME type string based on the canonical form. Each parameter
+     *         value is enclosed in quotes. A "class=" parameter is appended to
+     *         the MIME type string to indicate the representation class name.
      */
     public String toString() {
         return getStringValue();
@@ -593,22 +521,21 @@
     }
 
     /**
-     * Determines if this doc flavor object is equal to the given object.
-     * The two are equal if the given object is not null, is an instance
-     * of {@code DocFlavor}, has a MIME type equivalent to this doc
-     * flavor object's MIME type (that is, the MIME types have the same media
-     * type, media subtype, and parameters), and has the same representation
-     * class name as this doc flavor object. Thus, if two doc flavor objects'
-     * MIME types are the same except for comments, they are considered equal.
-     * However, two doc flavor objects with MIME types of "text/plain" and
-     * "text/plain; charset=US-ASCII" are not considered equal, even though
-     * they represent the same media type (because the default character
-     * set for plain text is US-ASCII).
+     * Determines if this doc flavor object is equal to the given object. The
+     * two are equal if the given object is not {@code null}, is an instance of
+     * {@code DocFlavor}, has a MIME type equivalent to this doc flavor object's
+     * MIME type (that is, the MIME types have the same media type, media
+     * subtype, and parameters), and has the same representation class name as
+     * this doc flavor object. Thus, if two doc flavor objects' MIME types are
+     * the same except for comments, they are considered equal. However, two doc
+     * flavor objects with MIME types of "text/plain" and "text/plain;
+     * charset=US-ASCII" are not considered equal, even though they represent
+     * the same media type (because the default character set for plain text is
+     * US-ASCII).
      *
-     * @param  obj  Object to test.
-     *
-     * @return  True if this doc flavor object equals {@code obj}, false
-     *          otherwise.
+     * @param  obj {@code Object} to test
+     * @return {@code true} if this doc flavor object equals {@code obj},
+     *         {@code false} otherwise
      */
     public boolean equals(Object obj) {
         return
@@ -619,6 +546,8 @@
 
     /**
      * Returns this doc flavor object's string value.
+     *
+     * @return the string value
      */
     private String getStringValue() {
         if (myStringValue == null) {
@@ -630,8 +559,9 @@
     /**
      * Write the instance to a stream (ie serialize the object).
      *
+     * @param  s the output stream
      * @throws IOException if I/O errors occur while writing to the underlying
-     * stream
+     *         stream
      */
     private void writeObject(ObjectOutputStream s) throws IOException {
 
@@ -642,14 +572,15 @@
     /**
      * Reconstitute an instance from a stream (that is, deserialize it).
      *
+     * @param  s the input stream
      * @throws ClassNotFoundException if the class of a serialized object could
-     * not be found.
+     *         not be found
      * @throws IOException if I/O errors occur while reading from the underlying
-     * stream
-     * @serialData
-     * The serialised form of a DocFlavor is the String naming the
-     * representation class followed by the String representing the canonical
-     * form of the mime type.
+     *         stream
+     * @serialData The serialised form of a {@code DocFlavor} is the
+     *             {@code String} naming the representation class followed by
+     *             the {@code String} representing the canonical form of the
+     *             mime type
      */
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException {
@@ -659,167 +590,140 @@
     }
 
     /**
-     * Class DocFlavor.BYTE_ARRAY provides predefined static constant
-     * DocFlavor objects for example doc flavors using a byte array
+     * Class {@code DocFlavor.BYTE_ARRAY} provides predefined static constant
+     * {@code DocFlavor} objects for example doc flavors using a byte array
      * ({@code byte[]}) as the print data representation class.
      *
-     * @author  Alan Kaminsky
+     * @author Alan Kaminsky
      */
     public static class BYTE_ARRAY extends DocFlavor {
 
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = -9065578006593857475L;
 
         /**
-         * Constructs a new doc flavor with the given MIME type and a print
-         * data representation class name of {@code "[B"} (byte array).
-         *
-         * @param  mimeType   MIME media type string.
+         * Constructs a new doc flavor with the given MIME type and a print data
+         * representation class name of {@code "[B"} (byte array).
          *
-         * @exception  NullPointerException
-         *     (unchecked exception) Thrown if {@code mimeType} is null.
-         * @exception  IllegalArgumentException
-         *     (unchecked exception) Thrown if {@code mimeType} does not
-         *     obey the syntax for a MIME media type string.
+         * @param  mimeType MIME media type string
+         * @throws NullPointerException if {@code mimeType} is {@code null}
+         * @throws IllegalArgumentException if {@code mimeType} does not obey
+         *         the syntax for a MIME media type string
          */
         public BYTE_ARRAY (String mimeType) {
             super (mimeType, "[B");
         }
 
         /**
-         * Doc flavor with MIME type = {@code "text/plain"},
-         * encoded in the host platform encoding.
-         * See {@link DocFlavor#hostEncoding hostEncoding}
-         * Print data representation class name =
-         * {@code "[B"} (byte array).
+         * Doc flavor with MIME type = {@code "text/plain"}, encoded in the host
+         * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}.
+         * Print data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_PLAIN_HOST =
             new BYTE_ARRAY ("text/plain; charset="+hostEncoding);
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-8"},
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-8"},
+         * print data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_PLAIN_UTF_8 =
             new BYTE_ARRAY ("text/plain; charset=utf-8");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-16"},
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"},
+         * print data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_PLAIN_UTF_16 =
             new BYTE_ARRAY ("text/plain; charset=utf-16");
 
-
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-16be"}
-         * (big-endian byte ordering),
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-16be"}
+         * (big-endian byte ordering), print data representation class name =
+         * {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_PLAIN_UTF_16BE =
             new BYTE_ARRAY ("text/plain; charset=utf-16be");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-16le"}
-         * (little-endian byte ordering),
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-16le"}
+         * (little-endian byte ordering), print data representation class name =
+         * {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_PLAIN_UTF_16LE =
             new BYTE_ARRAY ("text/plain; charset=utf-16le");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=us-ascii"},
-         * print data representation class name =
-         * {@code "[B"} (byte array).
+         * Doc flavor with MIME type = {@code "text/plain; charset=us-ascii"},
+         * print data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_PLAIN_US_ASCII =
             new BYTE_ARRAY ("text/plain; charset=us-ascii");
 
 
         /**
-         * Doc flavor with MIME type = {@code "text/html"},
-         * encoded in the host platform encoding.
-         * See {@link DocFlavor#hostEncoding hostEncoding}
-         * Print data representation class name =
-         * {@code "[B"} (byte array).
+         * Doc flavor with MIME type = {@code "text/html"}, encoded in the host
+         * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}.
+         * Print data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_HTML_HOST =
             new BYTE_ARRAY ("text/html; charset="+hostEncoding);
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-8"},
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-8"}, print
+         * data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_HTML_UTF_8 =
             new BYTE_ARRAY ("text/html; charset=utf-8");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-16"},
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-16"},
+         * print data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_HTML_UTF_16 =
             new BYTE_ARRAY ("text/html; charset=utf-16");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-16be"}
-         * (big-endian byte ordering),
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-16be"}
+         * (big-endian byte ordering), print data representation class name =
+         * {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_HTML_UTF_16BE =
             new BYTE_ARRAY ("text/html; charset=utf-16be");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-16le"}
-         * (little-endian byte ordering),
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-16le"}
+         * (little-endian byte ordering), print data representation class name =
+         * {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_HTML_UTF_16LE =
             new BYTE_ARRAY ("text/html; charset=utf-16le");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=us-ascii"},
-         * print data representation class name =
-         * {@code "[B"} (byte array).
+         * Doc flavor with MIME type = {@code "text/html; charset=us-ascii"},
+         * print data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY TEXT_HTML_US_ASCII =
             new BYTE_ARRAY ("text/html; charset=us-ascii");
 
 
         /**
-         * Doc flavor with MIME type = {@code "application/pdf"}, print
-         * data representation class name = {@code "[B"} (byte array).
+         * Doc flavor with MIME type = {@code "application/pdf"}, print data
+         * representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY PDF = new BYTE_ARRAY ("application/pdf");
 
         /**
-         * Doc flavor with MIME type = {@code "application/postscript"},
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "application/postscript"}, print
+         * data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY POSTSCRIPT =
             new BYTE_ARRAY ("application/postscript");
 
         /**
-         * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"},
-         * print data representation class name = {@code "[B"} (byte
-         * array).
+         * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"}, print
+         * data representation class name = {@code "[B"} (byte array).
          */
         public static final BYTE_ARRAY PCL =
             new BYTE_ARRAY ("application/vnd.hp-PCL");
@@ -843,376 +747,337 @@
         public static final BYTE_ARRAY PNG = new BYTE_ARRAY ("image/png");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "application/octet-stream"},
-         * print data representation class name = {@code "[B"} (byte
-         * array). The client must determine that data described
-         * using this DocFlavor is valid for the printer.
+         * Doc flavor with MIME type = {@code "application/octet-stream"}, print
+         * data representation class name = {@code "[B"} (byte array). The
+         * client must determine that data described using this
+         * {@code DocFlavor} is valid for the printer.
          */
         public static final BYTE_ARRAY AUTOSENSE =
             new BYTE_ARRAY ("application/octet-stream");
-
     }
 
     /**
-     * Class DocFlavor.INPUT_STREAM provides predefined static constant
-     * DocFlavor objects for example doc flavors using a byte stream ({@link
-     * java.io.InputStream java.io.InputStream}) as the print
-     * data representation class.
+     * Class {@code DocFlavor.INPUT_STREAM} provides predefined static constant
+     * {@code DocFlavor} objects for example doc flavors using a byte stream
+     * ({@link java.io.InputStream java.io.InputStream}) as the print data
+     * representation class.
      *
-     * @author  Alan Kaminsky
+     * @author Alan Kaminsky
      */
     public static class INPUT_STREAM extends DocFlavor {
 
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = -7045842700749194127L;
 
         /**
-         * Constructs a new doc flavor with the given MIME type and a print
-         * data representation class name of
-         * {@code "java.io.InputStream"} (byte stream).
-         *
-         * @param  mimeType   MIME media type string.
+         * Constructs a new doc flavor with the given MIME type and a print data
+         * representation class name of {@code "java.io.InputStream"} (byte
+         * stream).
          *
-         * @exception  NullPointerException
-         *     (unchecked exception) Thrown if {@code mimeType} is null.
-         * @exception  IllegalArgumentException
-         *     (unchecked exception) Thrown if {@code mimeType} does not
-         *     obey the syntax for a MIME media type string.
+         * @param  mimeType MIME media type string
+         * @throws NullPointerException if {@code mimeType} is {@code null}
+         * @throws IllegalArgumentException if {@code mimeType} does not obey
+         *         the syntax for a MIME media type string.
          */
         public INPUT_STREAM (String mimeType) {
             super (mimeType, "java.io.InputStream");
         }
 
         /**
-         * Doc flavor with MIME type = {@code "text/plain"},
-         * encoded in the host platform encoding.
-         * See {@link DocFlavor#hostEncoding hostEncoding}
-         * Print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/plain"}, encoded in the host
+         * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}.
+         * Print data representation class name = {@code "java.io.InputStream"}
+         * (byte stream).
          */
         public static final INPUT_STREAM TEXT_PLAIN_HOST =
             new INPUT_STREAM ("text/plain; charset="+hostEncoding);
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-8"},
-         * print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-8"},
+         * print data representation class name = {@code "java.io.InputStream"}
+         * (byte stream).
          */
         public static final INPUT_STREAM TEXT_PLAIN_UTF_8 =
             new INPUT_STREAM ("text/plain; charset=utf-8");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-16"},
-         * print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"},
+         * print data representation class name = {@code "java.io.InputStream"}
+         * (byte stream).
          */
         public static final INPUT_STREAM TEXT_PLAIN_UTF_16 =
             new INPUT_STREAM ("text/plain; charset=utf-16");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-16be"}
-         * (big-endian byte ordering),
-         * print data representation class name =
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-16be"}
+         * (big-endian byte ordering), print data representation class name =
          * {@code "java.io.InputStream"} (byte stream).
          */
         public static final INPUT_STREAM TEXT_PLAIN_UTF_16BE =
             new INPUT_STREAM ("text/plain; charset=utf-16be");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-16le"}
-         * (little-endian byte ordering),
-         * print data representation class name =
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-16le"}
+         * (little-endian byte ordering), print data representation class name =
          * {@code "java.io.InputStream"} (byte stream).
          */
         public static final INPUT_STREAM TEXT_PLAIN_UTF_16LE =
             new INPUT_STREAM ("text/plain; charset=utf-16le");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=us-ascii"},
-         * print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/plain; charset=us-ascii"},
+         * print data representation class name = {@code "java.io.InputStream"}
+         * (byte stream).
          */
         public static final INPUT_STREAM TEXT_PLAIN_US_ASCII =
                 new INPUT_STREAM ("text/plain; charset=us-ascii");
 
         /**
-         * Doc flavor with MIME type = {@code "text/html"},
-         * encoded in the host platform encoding.
-         * See {@link DocFlavor#hostEncoding hostEncoding}
-         * Print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/html"}, encoded in the host
+         * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}.
+         * Print data representation class name = {@code "java.io.InputStream"}
+         * (byte stream).
          */
         public static final INPUT_STREAM TEXT_HTML_HOST =
             new INPUT_STREAM ("text/html; charset="+hostEncoding);
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-8"},
-         * print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-8"}, print
+         * data representation class name = {@code "java.io.InputStream"} (byte
+         * stream).
          */
         public static final INPUT_STREAM TEXT_HTML_UTF_8 =
             new INPUT_STREAM ("text/html; charset=utf-8");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-16"},
-         * print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-16"},
+         * print data representation class name = {@code "java.io.InputStream"}
+         * (byte stream).
          */
         public static final INPUT_STREAM TEXT_HTML_UTF_16 =
             new INPUT_STREAM ("text/html; charset=utf-16");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-16be"}
-         * (big-endian byte ordering),
-         * print data representation class name =
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-16be"}
+         * (big-endian byte ordering), print data representation class name =
          * {@code "java.io.InputStream"} (byte stream).
          */
         public static final INPUT_STREAM TEXT_HTML_UTF_16BE =
             new INPUT_STREAM ("text/html; charset=utf-16be");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-16le"}
-         * (little-endian byte ordering),
-         * print data representation class name =
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-16le"}
+         * (little-endian byte ordering), print data representation class name =
          * {@code "java.io.InputStream"} (byte stream).
          */
         public static final INPUT_STREAM TEXT_HTML_UTF_16LE =
             new INPUT_STREAM ("text/html; charset=utf-16le");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=us-ascii"},
-         * print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/html; charset=us-ascii"},
+         * print data representation class name = {@code "java.io.InputStream"}
+         * (byte stream).
          */
         public static final INPUT_STREAM TEXT_HTML_US_ASCII =
             new INPUT_STREAM ("text/html; charset=us-ascii");
 
-
         /**
-         * Doc flavor with MIME type = {@code "application/pdf"}, print
-         * data representation class name = {@code "java.io.InputStream"}
-         * (byte stream).
+         * Doc flavor with MIME type = {@code "application/pdf"}, print data
+         * representation class name = {@code "java.io.InputStream"} (byte
+         * stream).
          */
         public static final INPUT_STREAM PDF = new INPUT_STREAM ("application/pdf");
 
         /**
-         * Doc flavor with MIME type = {@code "application/postscript"},
-         * print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "application/postscript"}, print
+         * data representation class name = {@code "java.io.InputStream"} (byte
+         * stream).
          */
         public static final INPUT_STREAM POSTSCRIPT =
             new INPUT_STREAM ("application/postscript");
 
         /**
-         * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"},
-         * print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"}, print
+         * data representation class name = {@code "java.io.InputStream"} (byte
+         * stream).
          */
         public static final INPUT_STREAM PCL =
             new INPUT_STREAM ("application/vnd.hp-PCL");
 
         /**
          * Doc flavor with MIME type = {@code "image/gif"}, print data
-         * representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * representation class name = {@code "java.io.InputStream"} (byte
+         * stream).
          */
         public static final INPUT_STREAM GIF = new INPUT_STREAM ("image/gif");
 
         /**
          * Doc flavor with MIME type = {@code "image/jpeg"}, print data
-         * representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * representation class name = {@code "java.io.InputStream"} (byte
+         * stream).
          */
         public static final INPUT_STREAM JPEG = new INPUT_STREAM ("image/jpeg");
 
         /**
          * Doc flavor with MIME type = {@code "image/png"}, print data
-         * representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
+         * representation class name = {@code "java.io.InputStream"} (byte
+         * stream).
          */
         public static final INPUT_STREAM PNG = new INPUT_STREAM ("image/png");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "application/octet-stream"},
-         * print data representation class name =
-         * {@code "java.io.InputStream"} (byte stream).
-         * The client must determine that data described
-         * using this DocFlavor is valid for the printer.
+         * Doc flavor with MIME type = {@code "application/octet-stream"}, print
+         * data representation class name = {@code "java.io.InputStream"} (byte
+         * stream). The client must determine that data described using this
+         * {@code DocFlavor} is valid for the printer.
          */
         public static final INPUT_STREAM AUTOSENSE =
             new INPUT_STREAM ("application/octet-stream");
-
     }
 
     /**
-     * Class DocFlavor.URL provides predefined static constant DocFlavor
-     * objects.
-     * For example doc flavors using a Uniform Resource Locator ({@link
-     * java.net.URL java.net.URL}) as the print data
+     * Class {@code DocFlavor.URL} provides predefined static constant
+     * {@code DocFlavor} objects. For example doc flavors using a Uniform
+     * Resource Locator ({@link java.net.URL java.net.URL}) as the print data
      * representation class.
      *
-     * @author  Alan Kaminsky
+     * @author Alan Kaminsky
      */
     public static class URL extends DocFlavor {
+
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = 2936725788144902062L;
 
         /**
-         * Constructs a new doc flavor with the given MIME type and a print
-         * data representation class name of {@code "java.net.URL"}.
-         *
-         * @param  mimeType   MIME media type string.
+         * Constructs a new doc flavor with the given MIME type and a print data
+         * representation class name of {@code "java.net.URL"}.
          *
-         * @exception  NullPointerException
-         *     (unchecked exception) Thrown if {@code mimeType} is null.
-         * @exception  IllegalArgumentException
-         *     (unchecked exception) Thrown if {@code mimeType} does not
-         *     obey the syntax for a MIME media type string.
+         * @param  mimeType MIME media type string
+         * @throws NullPointerException if {@code mimeType} is {@code null}
+         * @throws IllegalArgumentException if {@code mimeType} does not obey
+         *         the syntax for a MIME media type string
          */
         public URL (String mimeType) {
             super (mimeType, "java.net.URL");
         }
 
         /**
-         * Doc flavor with MIME type = {@code "text/plain"},
-         * encoded in the host platform encoding.
-         * See {@link DocFlavor#hostEncoding hostEncoding}
-         * Print data representation class name =
-         * {@code "java.net.URL"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/plain"}, encoded in the host
+         * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}.
+         * Print data representation class name = {@code "java.net.URL"} (byte
+         * stream).
          */
         public static final URL TEXT_PLAIN_HOST =
             new URL ("text/plain; charset="+hostEncoding);
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-8"},
-         * print data representation class name =
-         * {@code "java.net.URL"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-8"},
+         * print data representation class name = {@code "java.net.URL"} (byte
+         * stream).
          */
         public static final URL TEXT_PLAIN_UTF_8 =
             new URL ("text/plain; charset=utf-8");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-16"},
-         * print data representation class name =
-         * {@code java.net.URL""} (byte stream).
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"},
+         * print data representation class name = {@code java.net.URL""} (byte
+         * stream).
          */
         public static final URL TEXT_PLAIN_UTF_16 =
             new URL ("text/plain; charset=utf-16");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-16be"}
-         * (big-endian byte ordering),
-         * print data representation class name =
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-16be"}
+         * (big-endian byte ordering), print data representation class name =
          * {@code "java.net.URL"} (byte stream).
          */
         public static final URL TEXT_PLAIN_UTF_16BE =
             new URL ("text/plain; charset=utf-16be");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=utf-16le"}
-         * (little-endian byte ordering),
-         * print data representation class name =
+         * Doc flavor with MIME type = {@code "text/plain; charset=utf-16le"}
+         * (little-endian byte ordering), print data representation class name =
          * {@code "java.net.URL"} (byte stream).
          */
         public static final URL TEXT_PLAIN_UTF_16LE =
             new URL ("text/plain; charset=utf-16le");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/plain; charset=us-ascii"},
-         * print data representation class name =
-         * {@code "java.net.URL"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/plain; charset=us-ascii"},
+         * print data representation class name = {@code "java.net.URL"} (byte
+         * stream).
          */
         public static final URL TEXT_PLAIN_US_ASCII =
             new URL ("text/plain; charset=us-ascii");
 
         /**
-         * Doc flavor with MIME type = {@code "text/html"},
-         * encoded in the host platform encoding.
-         * See {@link DocFlavor#hostEncoding hostEncoding}
-         * Print data representation class name =
-         * {@code "java.net.URL"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/html"}, encoded in the host
+         * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}.
+         * Print data representation class name = {@code "java.net.URL"} (byte
+         * stream).
          */
         public static final URL TEXT_HTML_HOST =
             new URL ("text/html; charset="+hostEncoding);
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-8"},
-         * print data representation class name =
-         * {@code "java.net.URL"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-8"}, print
+         * data representation class name = {@code "java.net.URL"} (byte
+         * stream).
          */
         public static final URL TEXT_HTML_UTF_8 =
             new URL ("text/html; charset=utf-8");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-16"},
-         * print data representation class name =
-         * {@code "java.net.URL"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-16"},
+         * print data representation class name = {@code "java.net.URL"} (byte
+         * stream).
          */
         public static final URL TEXT_HTML_UTF_16 =
             new URL ("text/html; charset=utf-16");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-16be"}
-         * (big-endian byte ordering),
-         * print data representation class name =
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-16be"}
+         * (big-endian byte ordering), print data representation class name =
          * {@code "java.net.URL"} (byte stream).
          */
         public static final URL TEXT_HTML_UTF_16BE =
             new URL ("text/html; charset=utf-16be");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=utf-16le"}
-         * (little-endian byte ordering),
-         * print data representation class name =
+         * Doc flavor with MIME type = {@code "text/html; charset=utf-16le"}
+         * (little-endian byte ordering), print data representation class name =
          * {@code "java.net.URL"} (byte stream).
          */
         public static final URL TEXT_HTML_UTF_16LE =
             new URL ("text/html; charset=utf-16le");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "text/html; charset=us-ascii"},
-         * print data representation class name =
-         * {@code "java.net.URL"} (byte stream).
+         * Doc flavor with MIME type = {@code "text/html; charset=us-ascii"},
+         * print data representation class name = {@code "java.net.URL"} (byte
+         * stream).
          */
         public static final URL TEXT_HTML_US_ASCII =
             new URL ("text/html; charset=us-ascii");
 
-
         /**
-         * Doc flavor with MIME type = {@code "application/pdf"}, print
-         * data representation class name = {@code "java.net.URL"}.
+         * Doc flavor with MIME type = {@code "application/pdf"}, print data
+         * representation class name = {@code "java.net.URL"}.
          */
         public static final URL PDF = new URL ("application/pdf");
 
         /**
-         * Doc flavor with MIME type = {@code "application/postscript"},
-         * print data representation class name = {@code "java.net.URL"}.
+         * Doc flavor with MIME type = {@code "application/postscript"}, print
+         * data representation class name = {@code "java.net.URL"}.
          */
         public static final URL POSTSCRIPT = new URL ("application/postscript");
 
         /**
-         * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"},
-         * print data representation class name = {@code "java.net.URL"}.
+         * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"}, print
+         * data representation class name = {@code "java.net.URL"}.
          */
         public static final URL PCL = new URL ("application/vnd.hp-PCL");
 
@@ -1235,42 +1100,39 @@
         public static final URL PNG = new URL ("image/png");
 
         /**
-         * Doc flavor with MIME type =
-         * {@code "application/octet-stream"},
-         * print data representation class name = {@code "java.net.URL"}.
-         *  The client must determine that data described
-         * using this DocFlavor is valid for the printer.
+         * Doc flavor with MIME type = {@code "application/octet-stream"}, print
+         * data representation class name = {@code "java.net.URL"}. The client
+         * must determine that data described using this {@code DocFlavor} is
+         * valid for the printer.
          */
         public static final URL AUTOSENSE = new URL ("application/octet-stream");
-
     }
 
     /**
-     * Class DocFlavor.CHAR_ARRAY provides predefined static constant
-     * DocFlavor objects for example doc flavors using a character array
-     * ({@code char[]}) as the print data representation class. As such,
-     * the character set is Unicode.
+     * Class {@code DocFlavor.CHAR_ARRAY} provides predefined static constant
+     * {@code DocFlavor} objects for example doc flavors using a character array
+     * ({@code char[]}) as the print data representation class. As such, the
+     * character set is Unicode.
      *
-     * @author  Alan Kaminsky
+     * @author Alan Kaminsky
      */
     public static class CHAR_ARRAY extends DocFlavor {
 
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = -8720590903724405128L;
 
         /**
-         * Constructs a new doc flavor with the given MIME type and a print
-         * data representation class name of
-         * {@code "[C"} (character array).
+         * Constructs a new doc flavor with the given MIME type and a print data
+         * representation class name of {@code "[C"} (character array).
          *
-         * @param  mimeType  MIME media type string. If it is a text media
-         *                      type, it is assumed to contain a
-         *                      {@code "charset=utf-16"} parameter.
-         *
-         * @exception  NullPointerException
-         *     (unchecked exception) Thrown if {@code mimeType} is null.
-         * @exception  IllegalArgumentException
-         *     (unchecked exception) Thrown if {@code mimeType} does not
-         *     obey the syntax for a MIME media type string.
+         * @param  mimeType MIME media type string. If it is a text media type,
+         *         it is assumed to contain a {@code "charset=utf-16"}
+         *         parameter.
+         * @throws NullPointerException if {@code mimeType} is {@code null}
+         * @throws IllegalArgumentException if {@code mimeType} does not obey
+         *         the syntax for a MIME media type string
          */
         public CHAR_ARRAY (String mimeType) {
             super (mimeType, "[C");
@@ -1278,47 +1140,46 @@
 
         /**
          * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"},
-         * print data representation class name =
-         * {@code "[C"} (character array).
+         * print data representation class name = {@code "[C"} (character
+         * array).
          */
         public static final CHAR_ARRAY TEXT_PLAIN =
             new CHAR_ARRAY ("text/plain; charset=utf-16");
 
         /**
          * Doc flavor with MIME type = {@code "text/html; charset=utf-16"},
-         * print data representation class name =
-         * {@code "[C"} (character array).
+         * print data representation class name = {@code "[C"} (character
+         * array).
          */
         public static final CHAR_ARRAY TEXT_HTML =
             new CHAR_ARRAY ("text/html; charset=utf-16");
-
     }
 
     /**
-     * Class DocFlavor.STRING provides predefined static constant DocFlavor
-     * objects for example doc flavors using a string ({@link java.lang.String
-     * java.lang.String}) as the print data representation class.
+     * Class {@code DocFlavor.STRING} provides predefined static constant
+     * {@code DocFlavor} objects for example doc flavors using a string
+     * ({@link String java.lang.String}) as the print data representation class.
      * As such, the character set is Unicode.
      *
-     * @author  Alan Kaminsky
+     * @author Alan Kaminsky
      */
     public static class STRING extends DocFlavor {
 
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = 4414407504887034035L;
 
         /**
-         * Constructs a new doc flavor with the given MIME type and a print
-         * data representation class name of {@code "java.lang.String"}.
+         * Constructs a new doc flavor with the given MIME type and a print data
+         * representation class name of {@code "java.lang.String"}.
          *
-         * @param  mimeType  MIME media type string. If it is a text media
-         *                      type, it is assumed to contain a
-         *                      {@code "charset=utf-16"} parameter.
-         *
-         * @exception  NullPointerException
-         *     (unchecked exception) Thrown if {@code mimeType} is null.
-         * @exception  IllegalArgumentException
-         *     (unchecked exception) Thrown if {@code mimeType} does not
-         *     obey the syntax for a MIME media type string.
+         * @param  mimeType MIME media type string. If it is a text media type,
+         *         it is assumed to contain a {@code "charset=utf-16"}
+         *         parameter.
+         * @throws NullPointerException if {@code mimeType} is {@code null}
+         * @throws IllegalArgumentException if {@code mimeType} does not obey
+         *         the syntax for a MIME media type string
          */
         public STRING (String mimeType) {
             super (mimeType, "java.lang.String");
@@ -1326,47 +1187,45 @@
 
         /**
          * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"},
-         * print data representation class name =
-         * {@code "java.lang.String"}.
+         * print data representation class name = {@code "java.lang.String"}.
          */
         public static final STRING TEXT_PLAIN =
             new STRING ("text/plain; charset=utf-16");
 
         /**
          * Doc flavor with MIME type = {@code "text/html; charset=utf-16"},
-         * print data representation class name =
-         * {@code "java.lang.String"}.
+         * print data representation class name = {@code "java.lang.String"}.
          */
         public static final STRING TEXT_HTML =
             new STRING ("text/html; charset=utf-16");
     }
 
     /**
-     * Class DocFlavor.READER provides predefined static constant DocFlavor
-     * objects for example doc flavors using a character stream ({@link
-     * java.io.Reader java.io.Reader}) as the print data
+     * Class {@code DocFlavor.READER} provides predefined static constant
+     * {@code DocFlavor} objects for example doc flavors using a character
+     * stream ({@link java.io.Reader java.io.Reader}) as the print data
      * representation class. As such, the character set is Unicode.
      *
-     * @author  Alan Kaminsky
+     * @author Alan Kaminsky
      */
     public static class READER extends DocFlavor {
 
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = 7100295812579351567L;
 
         /**
-         * Constructs a new doc flavor with the given MIME type and a print
-         * data representation class name of\
-         * {@code "java.io.Reader"} (character stream).
+         * Constructs a new doc flavor with the given MIME type and a print data
+         * representation class name of {@code "java.io.Reader"} (character
+         * stream).
          *
-         * @param  mimeType  MIME media type string. If it is a text media
-         *                      type, it is assumed to contain a
-         *                      {@code "charset=utf-16"} parameter.
-         *
-         * @exception  NullPointerException
-         *     (unchecked exception) Thrown if {@code mimeType} is null.
-         * @exception  IllegalArgumentException
-         *     (unchecked exception) Thrown if {@code mimeType} does not
-         *     obey the syntax for a MIME media type string.
+         * @param  mimeType MIME media type string. If it is a text media type,
+         *         it is assumed to contain a {@code "charset=utf-16"}
+         *         parameter.
+         * @throws NullPointerException if {@code mimeType} is {@code null}
+         * @throws IllegalArgumentException if {@code mimeType} does not obey
+         *         the syntax for a MIME media type string
          */
         public READER (String mimeType) {
             super (mimeType, "java.io.Reader");
@@ -1374,16 +1233,16 @@
 
         /**
          * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"},
-         * print data representation class name =
-         * {@code "java.io.Reader"} (character stream).
+         * print data representation class name = {@code "java.io.Reader"}
+         * (character stream).
          */
         public static final READER TEXT_PLAIN =
             new READER ("text/plain; charset=utf-16");
 
         /**
          * Doc flavor with MIME type = {@code "text/html; charset=utf-16"},
-         * print data representation class name =
-         * {@code "java.io.Reader"} (character stream).
+         * print data representation class name = {@code "java.io.Reader"}
+         * (character stream).
          */
         public static final READER TEXT_HTML =
             new READER ("text/html; charset=utf-16");
@@ -1391,27 +1250,27 @@
     }
 
     /**
-     * Class DocFlavor.SERVICE_FORMATTED provides predefined static constant
-     * DocFlavor objects for example doc flavors for service formatted print
-     * data.
+     * Class {@code DocFlavor.SERVICE_FORMATTED} provides predefined static
+     * constant {@code DocFlavor} objects for example doc flavors for service
+     * formatted print data.
      *
-     * @author  Alan Kaminsky
+     * @author Alan Kaminsky
      */
     public static class SERVICE_FORMATTED extends DocFlavor {
 
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = 6181337766266637256L;
 
         /**
          * Constructs a new doc flavor with a MIME type of
-         * {@code "application/x-java-jvm-local-objectref"} indicating
-         * service formatted print data and the given print data
-         * representation class name.
+         * {@code "application/x-java-jvm-local-objectref"} indicating service
+         * formatted print data and the given print data representation class
+         * name.
          *
-         * @param  className  Fully-qualified representation class name.
-         *
-         * @exception  NullPointerException
-         *     (unchecked exception) Thrown if {@code className} is
-         *     null.
+         * @param  className fully-qualified representation class name
+         * @throws NullPointerException if {@code className} is {@code null}
          */
         public SERVICE_FORMATTED (String className) {
             super ("application/x-java-jvm-local-objectref", className);
@@ -1420,8 +1279,8 @@
         /**
          * Service formatted print data doc flavor with print data
          * representation class name =
-         * {@code "java.awt.image.renderable.RenderableImage"}
-         * (renderable image object).
+         * {@code "java.awt.image.renderable.RenderableImage"} (renderable image
+         * object).
          */
         public static final SERVICE_FORMATTED RENDERABLE_IMAGE =
             new SERVICE_FORMATTED("java.awt.image.renderable.RenderableImage");
@@ -1443,5 +1302,4 @@
             new SERVICE_FORMATTED ("java.awt.print.Pageable");
 
         }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/DocPrintJob.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/DocPrintJob.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -29,146 +29,132 @@
 import javax.print.attribute.PrintRequestAttributeSet;
 import javax.print.event.PrintJobAttributeListener;
 import javax.print.event.PrintJobListener;
-import javax.print.PrintException;
 
 /**
- *
- * This interface represents a print job that can print a specified
- * document with a set of job attributes.  An object implementing
- * this interface is obtained from a print service.
- *
+ * This interface represents a print job that can print a specified document
+ * with a set of job attributes. An object implementing this interface is
+ * obtained from a print service.
  */
-
 public interface DocPrintJob {
 
     /**
-     * Determines the {@link PrintService} object to which this print job
-     * object is bound.
+     * Determines the {@link PrintService} object to which this print job object
+     * is bound.
      *
-     * @return  {@code PrintService} object.
-     *
+     * @return {@code PrintService} object
      */
     public PrintService getPrintService();
 
     /**
-     * Obtains this Print Job's set of printing attributes.
-     * The returned attribute set object is unmodifiable.
-     * The returned attribute set object is a "snapshot" of this Print Job's
-     * attribute set at the time of the {@link #getAttributes()} method
-     * call; that is, the returned attribute set's object's contents will
-     * not be updated if this Print Job's attribute set's contents change
-     * in the future. To detect changes in attribute values, call
-     * {@code getAttributes()} again and compare the new attribute
-     * set to the previous attribute set; alternatively, register a
-     * listener for print job events.
-     * The returned value may be an empty set but should not be null.
+     * Obtains this Print Job's set of printing attributes. The returned
+     * attribute set object is unmodifiable. The returned attribute set object
+     * is a "snapshot" of this Print Job's attribute set at the time of the
+     * {@code getAttributes()} method call; that is, the returned attribute
+     * set's object's contents will not be updated if this Print Job's attribute
+     * set's contents change in the future. To detect changes in attribute
+     * values, call {@code getAttributes()} again and compare the new attribute
+     * set to the previous attribute set; alternatively, register a listener for
+     * print job events. The returned value may be an empty set but should not
+     * be {@code null}.
+     *
      * @return the print job attributes
      */
      public PrintJobAttributeSet getAttributes();
 
     /**
-     * Registers a listener for event occurring during this print job.
-     * If listener is null, no exception is thrown and no action is
-     * performed.
-     * If listener is already registered, it will be registered again.
+     * Registers a listener for event occurring during this print job. If
+     * listener is {@code null}, no exception is thrown and no action is
+     * performed. If listener is already registered, it will be registered
+     * again.
+     *
+     * @param  listener the object implementing the listener interface
      * @see #removePrintJobListener
-     *
-     * @param listener  The object implementing the listener interface
-     *
      */
     public void addPrintJobListener(PrintJobListener listener);
 
     /**
-     * Removes a listener from this print job.
-     * This method performs no function, nor does it throw an exception,
-     * if the listener specified by the argument was not previously added
-     * to this component. If listener is null, no exception is thrown and
-     * no action is performed. If a listener was registered more than once
-     * only one of the registrations will be removed.
+     * Removes a listener from this print job. This method performs no function,
+     * nor does it throw an exception, if the listener specified by the argument
+     * was not previously added to this print job. If listener is {@code null},
+     * no exception is thrown and no action is performed. If a listener was
+     * registered more than once only one of the registrations will be removed.
+     *
+     * @param  listener the object implementing the listener interface
      * @see #addPrintJobListener
-     *
-     * @param listener  The object implementing the listener interface
      */
     public void removePrintJobListener(PrintJobListener listener);
 
     /**
-     * Registers a listener for changes in the specified attributes.
-     * If listener is null, no exception is thrown and no action is
-     * performed.
-     * To determine the attribute updates that may be reported by this job,
-     * a client can call {@code getAttributes()} and identify the
-     * subset that are interesting and likely to be reported to the
-     * listener. Clients expecting to be updated about changes in a
-     * specific job attribute should verify it is in that set, but
-     * updates about an attribute will be made only if it changes and this
-     * is detected by the job. Also updates may be subject to batching
-     * by the job. To minimize overhead in print job processing it is
-     * recommended to listen on only that subset of attributes which
-     * are likely to change.
-     * If the specified set is empty no attribute updates will be reported
-     * to the listener.
-     * If the attribute set is null, then this means to listen on all
-     * dynamic attributes that the job supports. This may result in no
-     * update notifications if a job can not report any attribute updates.
+     * Registers a listener for changes in the specified attributes. If listener
+     * is {@code null}, no exception is thrown and no action is performed. To
+     * determine the attribute updates that may be reported by this job, a
+     * client can call {@code getAttributes()} and identify the subset that are
+     * interesting and likely to be reported to the listener. Clients expecting
+     * to be updated about changes in a specific job attribute should verify it
+     * is in that set, but updates about an attribute will be made only if it
+     * changes and this is detected by the job. Also updates may be subject to
+     * batching by the job. To minimize overhead in print job processing it is
+     * recommended to listen on only that subset of attributes which are likely
+     * to change. If the specified set is empty no attribute updates will be
+     * reported to the listener. If the attribute set is {@code null}, then this
+     * means to listen on all dynamic attributes that the job supports. This may
+     * result in no update notifications if a job can not report any attribute
+     * updates.
+     * <p>
+     * If listener is already registered, it will be registered again.
      *
-     * If listener is already registered, it will be registered again.
+     * @param  listener the object implementing the listener interface
+     * @param  attributes the attributes to listen on, or {@code null} to mean
+     *         all attributes that can change, as determined by the job
      * @see #removePrintJobAttributeListener
-     *
-     * @param listener  The object implementing the listener interface
-     * @param attributes The attributes to listen on, or null to mean
-     * all attributes that can change, as determined by the job.
      */
     public void addPrintJobAttributeListener(
                                   PrintJobAttributeListener listener,
                                   PrintJobAttributeSet attributes);
 
     /**
-     * Removes an attribute listener from this print job.
-     * This method performs no function, nor does it throw an exception,
-     * if the listener specified by the argument was not previously added
-     * to this component. If the listener is null, no exception is thrown
-     * and no action is performed.
-     * If a listener is registered more than once, even for a different
-     * set of attributes, no guarantee is made which listener is removed.
+     * Removes an attribute listener from this print job. This method performs
+     * no function, nor does it throw an exception, if the listener specified by
+     * the argument was not previously added to this print job. If the listener
+     * is {@code null}, no exception is thrown and no action is performed. If a
+     * listener is registered more than once, even for a different set of
+     * attributes, no guarantee is made which listener is removed.
+     *
+     * @param  listener the object implementing the listener interface
      * @see #addPrintJobAttributeListener
-     *
-     * @param listener  The object implementing the listener interface
-     *
      */
     public void removePrintJobAttributeListener(
                                       PrintJobAttributeListener listener);
 
     /**
-     * Prints a document with the specified job attributes.
-     * This method should only be called once for a given print job.
-     * Calling it again will not result in a new job being spooled to
-     * the printer. The service implementation will define policy
-     * for service interruption and recovery.
+     * Prints a document with the specified job attributes. This method should
+     * only be called once for a given print job. Calling it again will not
+     * result in a new job being spooled to the printer. The service
+     * implementation will define policy for service interruption and recovery.
      * When the print method returns, printing may not yet have completed as
      * printing may happen asynchronously, perhaps in a different thread.
-     * Application clients which  want to monitor the success or failure
-     * should register a PrintJobListener.
+     * Application clients which want to monitor the success or failure should
+     * register a {@code PrintJobListener}.
      * <p>
      * Print service implementors should close any print data streams (ie
-     * Reader or InputStream implementations) that they obtain
-     * from the client doc. Robust clients may still wish to verify this.
-     * An exception is always generated if a {@code DocFlavor} cannot
-     * be printed.
-     *
-     * @param doc       The document to be printed. If must be a flavor
-     *                                  supported by this PrintJob.
+     * {@code Reader} or {@code InputStream} implementations) that they obtain
+     * from the client doc. Robust clients may still wish to verify this. An
+     * exception is always generated if a {@code DocFlavor} cannot be printed.
      *
-     * @param attributes The job attributes to be applied to this print job.
-     *        If this parameter is null then the default attributes are used.
-     * @throws PrintException The exception additionally may implement
-     * an interface that more precisely describes the cause of the
-     * exception
-     * <ul>
-     * <li>FlavorException.
-     *  If the document has a flavor not supported by this print job.
-     * <li>AttributeException.
-     *  If one or more of the attributes are not valid for this print job.
-     * </ul>
+     * @param  doc the document to be printed. It must be a flavor supported by
+     *         this PrintJob.
+     * @param  attributes the job attributes to be applied to this print job. If
+     *         this parameter is {@code null} then the default attributes are
+     *         used.
+     * @throws PrintException the exception additionally may implement an
+     *         interface that more precisely describes the cause of the
+     *         exception
+     *         <ul>
+     *           <li>{@code FlavorException}. If the document has a flavor not
+     *           supported by this print job.
+     *           <li>{@code AttributeException}. If one or more of the
+     *           attributes are not valid for this print job.
+     *         </ul>
      */
     public void print(Doc doc, PrintRequestAttributeSet attributes)
           throws PrintException;
--- a/jdk/src/java.desktop/share/classes/javax/print/FlavorException.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/FlavorException.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 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
@@ -25,23 +25,20 @@
 
 package javax.print;
 
-import javax.print.DocFlavor;
-
 /**
- * Interface FlavorException is a mixin interface which a subclass of {@link
- * PrintException PrintException} can implement to report an error condition
- * involving a doc flavor or flavors (class {@link javax.print.DocFlavor
- * DocFlavor}). The Print Service API does not define any print exception
- * classes that implement interface FlavorException, that being left to the
- * Print Service implementor's discretion.
- *
+ * Interface {@code FlavorException} is a mixin interface which a subclass of
+ * {@link PrintException PrintException} can implement to report an error
+ * condition involving a doc flavor or flavors (class {@link DocFlavor}). The
+ * Print Service API does not define any print exception classes that implement
+ * interface {@code FlavorException}, that being left to the Print Service
+ * implementor's discretion.
  */
 public interface FlavorException {
 
     /**
      * Returns the unsupported flavors.
-     * @return the unsupported doc flavors.
+     *
+     * @return the unsupported doc flavors
      */
     public DocFlavor[] getUnsupportedFlavors();
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/MimeType.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/MimeType.java	Sat Sep 09 14:36:45 2017 +0200
@@ -26,7 +26,6 @@
 package javax.print;
 
 import java.io.Serializable;
-
 import java.util.AbstractMap;
 import java.util.AbstractSet;
 import java.util.Iterator;
@@ -36,63 +35,63 @@
 import java.util.Vector;
 
 /**
- * Class MimeType encapsulates a Multipurpose Internet Mail Extensions (MIME)
- * media type as defined in <A HREF="http://www.ietf.org/rfc/rfc2045.txt">RFC
- * 2045</A> and <A HREF="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</A>. A
- * MIME type object is part of a {@link DocFlavor DocFlavor} object and
- * specifies the format of the print data.
- * <P>
- * Class MimeType is similar to the like-named
- * class in package {@link java.awt.datatransfer java.awt.datatransfer}. Class
- * java.awt.datatransfer.MimeType is not used in the Jini Print Service API
- * for two reasons:
- * <OL TYPE=1>
- * <LI>
- * Since not all Java profiles include the AWT, the Jini Print Service should
- * not depend on an AWT class.
- * <LI>
- * The implementation of class java.awt.datatransfer.MimeType does not
- * guarantee
- * that equivalent MIME types will have the same serialized representation.
- * Thus, since the Jini Lookup Service (JLUS) matches service attributes based
- * on equality of serialized representations, JLUS searches involving MIME
- * types encapsulated in class java.awt.datatransfer.MimeType may incorrectly
- * fail to match.
- * </OL>
- * <P>
+ * Class {@code MimeType} encapsulates a Multipurpose Internet Mail Extensions
+ * (MIME) media type as defined in
+ * <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a> and
+ * <a href="http://www.ietf.org/rfc/rfc2046.txt">RFC 2046</a>. A MIME type
+ * object is part of a {@link DocFlavor DocFlavor} object and specifies the
+ * format of the print data.
+ * <p>
+ * Class {@code MimeType} is similar to the like-named class in package
+ * {@link java.awt.datatransfer java.awt.datatransfer}. Class
+ * {@link java.awt.datatransfer.MimeType} is not used in the Jini Print Service
+ * API for two reasons:
+ * <ol type=1>
+ *   <li>Since not all Java profiles include the AWT, the Jini Print Service
+ *   should not depend on an AWT class.
+ *   <li>The implementation of class {@code java.awt.datatransfer.MimeType} does
+ *   not guarantee that equivalent MIME types will have the same serialized
+ *   representation. Thus, since the Jini Lookup Service (JLUS) matches service
+ *   attributes based on equality of serialized representations, JLUS searches
+ *   involving MIME types encapsulated in class
+ *   {@code java.awt.datatransfer.MimeType} may incorrectly fail to match.
+ * </ol>
  * Class MimeType's serialized representation is based on the following
  * canonical form of a MIME type string. Thus, two MIME types that are not
- * identical but that are equivalent (that have the same canonical form) will
- * be considered equal by the JLUS's matching algorithm.
- * <UL>
- * <LI> The media type, media subtype, and parameters are retained, but all
- *      comments and whitespace characters are discarded.
- * <LI> The media type, media subtype, and parameter names are converted to
- *      lowercase.
- * <LI> The parameter values retain their original case, except a charset
- *      parameter value for a text media type is converted to lowercase.
- * <LI> Quote characters surrounding parameter values are removed.
- * <LI> Quoting backslash characters inside parameter values are removed.
- * <LI> The parameters are arranged in ascending order of parameter name.
- * </UL>
+ * identical but that are equivalent (that have the same canonical form) will be
+ * considered equal by the JLUS's matching algorithm.
+ * <ul>
+ *   <li>The media type, media subtype, and parameters are retained, but all
+ *   comments and whitespace characters are discarded.
+ *   <li>The media type, media subtype, and parameter names are converted to
+ *   lowercase.
+ *   <li>The parameter values retain their original case, except a charset
+ *   parameter value for a text media type is converted to lowercase.
+ *   <li>Quote characters surrounding parameter values are removed.
+ *   <li>Quoting backslash characters inside parameter values are removed.
+ *   <li>The parameters are arranged in ascending order of parameter name.
+ * </ul>
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 class MimeType implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -2785720609362367683L;
 
     /**
-     * Array of strings that hold pieces of this MIME type's canonical form.
-     * If the MIME type has <I>n</I> parameters, <I>n</I> &gt;= 0, then the
+     * Array of strings that hold pieces of this MIME type's canonical form. If
+     * the MIME type has <i>n</i> parameters, <i>n</i> &gt;= 0, then the
      * strings in the array are:
-     * <BR>Index 0 -- Media type.
-     * <BR>Index 1 -- Media subtype.
-     * <BR>Index 2<I>i</I>+2 -- Name of parameter <I>i</I>,
-     * <I>i</I>=0,1,...,<I>n</I>-1.
-     * <BR>Index 2<I>i</I>+3 -- Value of parameter <I>i</I>,
-     * <I>i</I>=0,1,...,<I>n</I>-1.
-     * <BR>Parameters are arranged in ascending order of parameter name.
+     * <br>Index 0 -- Media type.
+     * <br>Index 1 -- Media subtype.
+     * <br>Index 2<i>i</i>+2 -- Name of parameter <i>i</i>,
+     * <i>i</i>=0,1,...,<i>n</i>-1.
+     * <br>Index 2<i>i</i>+3 -- Value of parameter <i>i</i>,
+     * <i>i</i>=0,1,...,<i>n</i>-1.
+     * <br>Parameters are arranged in ascending order of parameter name.
      * @serial
      */
     private String[] myPieces;
@@ -116,7 +115,17 @@
      * Parameter map entry.
      */
     private class ParameterMapEntry implements Map.Entry<String, String> {
+
+        /**
+         * The index of the entry.
+         */
         private int myIndex;
+
+        /**
+         * Constructs a new parameter map entry.
+         *
+         * @param  theIndex the index of the entry
+         */
         public ParameterMapEntry(int theIndex) {
             myIndex = theIndex;
         }
@@ -144,6 +153,10 @@
      * Parameter map entry set iterator.
      */
     private class ParameterMapEntrySetIterator implements Iterator<Map.Entry<String, String>> {
+
+        /**
+         * The current index of the iterator.
+         */
         private int myIndex = 2;
         public boolean hasNext() {
             return myIndex < myPieces.length;
@@ -187,16 +200,13 @@
     }
 
     /**
-     * Construct a new MIME type object from the given string. The given
-     * string is converted into canonical form and stored internally.
-     *
-     * @param  s  MIME media type string.
+     * Construct a new MIME type object from the given string. The given string
+     * is converted into canonical form and stored internally.
      *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code s} is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code s} does not obey the
-     *     syntax for a MIME media type string.
+     * @param  s MIME media type string
+     * @throws NullPointerException if {@code s} is {@code null}
+     * @throws IllegalArgumentException if {@code s} does not obey the syntax
+     *         for a MIME media type string
      */
     public MimeType(String s) {
         parse (s);
@@ -205,6 +215,8 @@
     /**
      * Returns this MIME type object's MIME type string based on the canonical
      * form. Each parameter value is enclosed in quotes.
+     *
+     * @return the mime type
      */
     public String getMimeType() {
         return getStringValue();
@@ -212,6 +224,8 @@
 
     /**
      * Returns this MIME type object's media type.
+     *
+     * @return the media type
      */
     public String getMediaType() {
         return myPieces[0];
@@ -219,6 +233,8 @@
 
     /**
      * Returns this MIME type object's media subtype.
+     *
+     * @return the media subtype
      */
     public String getMediaSubtype() {
         return myPieces[1];
@@ -226,11 +242,11 @@
 
     /**
      * Returns an unmodifiable map view of the parameters in this MIME type
-     * object. Each entry in the parameter map view consists of a parameter
-     * name String (key) mapping to a parameter value String. If this MIME
-     * type object has no parameters, an empty map is returned.
+     * object. Each entry in the parameter map view consists of a parameter name
+     * {@code String} (key) mapping to a parameter value {@code String}. If this
+     * MIME type object has no parameters, an empty map is returned.
      *
-     * @return  Parameter map for this MIME type object.
+     * @return parameter map for this MIME type object
      */
     public Map<String, String> getParameterMap() {
         if (myParameterMap == null) {
@@ -242,8 +258,8 @@
     /**
      * Converts this MIME type object to a string.
      *
-     * @return  MIME type string based on the canonical form. Each parameter
-     *          value is enclosed in quotes.
+     * @return MIME type string based on the canonical form. Each parameter
+     *         value is enclosed in quotes.
      */
     public String toString() {
         return getStringValue();
@@ -258,19 +274,18 @@
 
     /**
      * Determine if this MIME type object is equal to the given object. The two
-     * are equal if the given object is not null, is an instance of class
-     * net.jini.print.data.MimeType, and has the same canonical form as this
-     * MIME type object (that is, has the same type, subtype, and parameters).
-     * Thus, if two MIME type objects are the same except for comments, they are
-     * considered equal. However, "text/plain" and "text/plain;
-     * charset=us-ascii" are not considered equal, even though they represent
-     * the same media type (because the default character set for plain text is
-     * US-ASCII).
+     * are equal if the given object is not {@code null}, is an instance of
+     * class {@code javax.print.data.MimeType}, and has the same canonical form
+     * as this MIME type object (that is, has the same type, subtype, and
+     * parameters). Thus, if two MIME type objects are the same except for
+     * comments, they are considered equal. However, "text/plain" and
+     * "text/plain; charset=us-ascii" are not considered equal, even though they
+     * represent the same media type (because the default character set for
+     * plain text is US-ASCII).
      *
-     * @param  obj  Object to test.
-     *
-     * @return  True if this MIME type object equals {@code obj}, false
-     *          otherwise.
+     * @param  obj {@code object} to test
+     * @return {@code true} if this MIME type object equals {@code obj},
+     *         {@code false} otherwise
      */
     public boolean equals (Object obj) {
         return(obj != null &&
@@ -280,6 +295,8 @@
 
     /**
      * Returns this MIME type's string value in canonical form.
+     *
+     * @return the MIME type's string value in canonical form
      */
     private String getStringValue() {
         if (myStringValue == null) {
@@ -300,8 +317,8 @@
         return myStringValue;
     }
 
-// Hidden classes, constants, and operations for parsing a MIME media type
-// string.
+    // Hidden classes, constants, and operations for parsing a MIME media type
+    // string.
 
     // Lexeme types.
     private static final int TOKEN_LEXEME         = 0;
@@ -310,7 +327,9 @@
     private static final int EOF_LEXEME           = 3;
     private static final int ILLEGAL_LEXEME       = 4;
 
-    // Class for a lexical analyzer.
+    /**
+     *Class for a lexical analyzer.
+     */
     private static class LexicalAnalyzer {
         protected String mySource;
         protected int mySourceLength;
@@ -459,18 +478,19 @@
                     break;
                 }
             }
-
         }
-
     }
 
     /**
-     * Returns a lowercase version of the given string. The lowercase version
-     * is constructed by applying Character.toLowerCase() to each character of
-     * the given string, which maps characters to lowercase using the rules of
-     * Unicode. This mapping is the same regardless of locale, whereas the
-     * mapping of String.toLowerCase() may be different depending on the
+     * Returns a lowercase version of the given string. The lowercase version is
+     * constructed by applying {@code Character.toLowerCase()} to each character
+     * of the given string, which maps characters to lowercase using the rules
+     * of Unicode. This mapping is the same regardless of locale, whereas the
+     * mapping of {@code String.toLowerCase()} may be different depending on the
      * default locale.
+     *
+     * @param  s the string
+     * @return the lowercase version of the string
      */
     private static String toUnicodeLowerCase(String s) {
         int n = s.length();
@@ -483,6 +503,9 @@
 
     /**
      * Returns a version of the given string with backslashes removed.
+     *
+     * @param  s the string
+     * @return the string with backslashes removed
      */
     private static String removeBackslashes(String s) {
         int n = s.length();
@@ -503,6 +526,10 @@
     /**
      * Returns a version of the string surrounded by quotes and with interior
      * quotes preceded by a backslash.
+     *
+     * @param  s the string
+     * @return the string surrounded by quotes and with interior quotes preceded
+     *         by a backslash
      */
     private static String addQuotes(String s) {
         int n = s.length();
@@ -524,20 +551,17 @@
     /**
      * Parses the given string into canonical pieces and stores the pieces in
      * {@link #myPieces myPieces}.
-     * <P>
+     * <p>
      * Special rules applied:
-     * <UL>
-     * <LI> If the media type is text, the value of a charset parameter is
-     *      converted to lowercase.
-     * </UL>
+     * <ul>
+     *   <li>If the media type is text, the value of a charset parameter is
+     *   converted to lowercase.
+     * </ul>
      *
-     * @param  s  MIME media type string.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code s} is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code s} does not obey the
-     *     syntax for a MIME media type string.
+     * @param  s MIME media type string
+     * @throws NullPointerException if {@code s} is {@code null}
+     * @throws IllegalArgumentException if {@code s} does not obey the syntax
+     *         for a MIME media type string
      */
     private void parse(String s) {
         // Initialize.
--- a/jdk/src/java.desktop/share/classes/javax/print/MultiDoc.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/MultiDoc.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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,54 +28,52 @@
 import java.io.IOException;
 
 /**
- * Interface MultiDoc specifies the interface for an object that supplies more
- * than one piece of print data for a Print Job. "Doc" is a short,
+ * Interface {@code MultiDoc} specifies the interface for an object that
+ * supplies more than one piece of print data for a Print Job. "Doc" is a short,
  * easy-to-pronounce term that means "a piece of print data," and a "multidoc"
- * is a group of several docs. The client passes to the Print Job an object
- * that implements interface MultiDoc, and the Print Job calls methods on
- *  that object to obtain the print data.
- * <P>
- * Interface MultiDoc provides an abstraction similar to a "linked list" of
- * docs. A multidoc object is like a node in the linked list, containing the
+ * is a group of several docs. The client passes to the Print Job an object that
+ * implements interface {@code MultiDoc}, and the Print Job calls methods on
+ * that object to obtain the print data.
+ * <p>
+ * Interface {@code MultiDoc} provides an abstraction similar to a "linked list"
+ * of docs. A multidoc object is like a node in the linked list, containing the
  * current doc in the list and a pointer to the next node (multidoc) in the
- * list. The Print Job can call the multidoc's {@link #getDoc()
- * getDoc()} method to get the current doc. When it's ready to go
- * on to the next doc, the Print Job can call the multidoc's {@link #next()
- * next()} method to get the next multidoc, which contains the
- * next doc. So Print Job code for accessing a multidoc might look like this:
- * <PRE>
+ * list. The Print Job can call the multidoc's {@link #getDoc() getDoc()} method
+ * to get the current doc. When it's ready to go on to the next doc, the Print
+ * Job can call the multidoc's {@link #next() next()} method to get the next
+ * multidoc, which contains the next doc. So Print Job code for accessing a
+ * multidoc might look like this:
+ *
+ * <pre>
  *      void processMultiDoc(MultiDoc theMultiDoc) {
  *
  *          MultiDoc current = theMultiDoc;
-
+ *
  *          while (current != null) {
  *              processDoc (current.getDoc());
  *              current = current.next();
  *          }
  *      }
- * </PRE>
- * <P>
- * Of course, interface MultiDoc can be implemented in any way that fulfills
- * the contract; it doesn't have to use a linked list in the implementation.
- * <P>
- * To get all the print data for a multidoc print job, a Print Service
- * proxy could use either of two patterns:
- * <OL TYPE=1>
- * <LI>
- * The <B>interleaved</B> pattern: Get the doc from the current multidoc. Get
- * the print data representation object from the current doc. Get all the print
- * data from the print data representation object. Get the next multidoc from
- * the current multidoc, and repeat until there are no more. (The code example
- * above uses the interleaved pattern.)
- *
- * <LI>
- * The <B>all-at-once</B> pattern: Get the doc from the current multidoc, and
- * save the doc in a list. Get the next multidoc from the current multidoc, and
- * repeat until there are no more. Then iterate over the list of saved docs. Get
- * the print data representation object from the current doc. Get all the print
- * data from the print data representation object. Go to the next doc in the
- * list, and repeat until there are no more.
- * </OL>
+ * </pre>
+ * Of course, interface {@code MultiDoc} can be implemented in any way that
+ * fulfills the contract; it doesn't have to use a linked list in the
+ * implementation.
+ * <p>
+ * To get all the print data for a multidoc print job, a Print Service proxy
+ * could use either of two patterns:
+ * <ol type=1>
+ *   <li>The <b>interleaved</b> pattern: Get the doc from the current multidoc.
+ *   Get the print data representation object from the current doc. Get all the
+ *   print data from the print data representation object. Get the next multidoc
+ *   from the current multidoc, and repeat until there are no more. (The code
+ *   example above uses the interleaved pattern.)
+ *   <li>The <b>all-at-once</b> pattern: Get the doc from the current multidoc,
+ *   and save the doc in a list. Get the next multidoc from the current
+ *   multidoc, and repeat until there are no more. Then iterate over the list of
+ *   saved docs. Get the print data representation object from the current doc.
+ *   Get all the print data from the print data representation object. Go to the
+ *   next doc in the list, and repeat until there are no more.
+ * </ol>
  * Now, consider a printing client that is generating print data on the fly and
  * does not have the resources to store more than one piece of print data at a
  * time. If the print service proxy used the all-at-once pattern to get the
@@ -83,41 +81,37 @@
  * to keep all the docs' print data around until the print service proxy comes
  * back and asks for them, which the client is not able to do. To work with such
  * a client, the print service proxy must use the interleaved pattern.
- * <P>
+ * <p>
  * To address this problem, and to simplify the design of clients providing
-* multiple docs to a Print Job, every Print Service proxy that supports
- * multidoc print jobs is required to access a MultiDoc object using the
- * interleaved pattern. That is, given a MultiDoc object, the print service
- * proxy will call {@link #getDoc() getDoc()} one or more times
- * until it successfully obtains the current Doc object. The print service proxy
+ * multiple docs to a Print Job, every Print Service proxy that supports
+ * multidoc print jobs is required to access a {@code MultiDoc} object using the
+ * interleaved pattern. That is, given a {@code MultiDoc} object, the print
+ * service proxy will call {@link #getDoc() getDoc()} one or more times until it
+ * successfully obtains the current {@code Doc} object. The print service proxy
  * will then obtain the current doc's print data, not proceeding until all the
  * print data is obtained or an unrecoverable error occurs. If it is able to
- * continue, the print service proxy will then call {@link #next()
- * next()} one or more times until it successfully obtains either
- * the next MultiDoc object or an indication that there are no more. An
- * implementation of interface MultiDoc can assume the print service proxy will
- * follow this interleaved pattern; for any other pattern of usage, the MultiDoc
- * implementation's behavior is unspecified.
- * <P>
+ * continue, the print service proxy will then call {@link #next() next()} one
+ * or more times until it successfully obtains either the next {@code MultiDoc}
+ * object or an indication that there are no more. An implementation of
+ * interface {@code MultiDoc} can assume the print service proxy will follow
+ * this interleaved pattern; for any other pattern of usage, the
+ * {@code MultiDoc} implementation's behavior is unspecified.
+ * <p>
  * There is no restriction on the number of client threads that may be
  * simultaneously accessing the same multidoc. Therefore, all implementations of
  * interface MultiDoc must be designed to be multiple thread safe. In fact, a
  * client thread could be adding docs to the end of the (conceptual) list while
  * a Print Job thread is simultaneously obtaining docs from the beginning of the
  * list; provided the multidoc object synchronizes the threads properly, the two
- * threads will not interfere with each other
+ * threads will not interfere with each other.
  */
-
 public interface MultiDoc {
 
-
     /**
      * Obtain the current doc object.
      *
-     * @return  Current doc object.
-     *
-     * @exception  IOException
-     *     Thrown if a error occurred reading the document.
+     * @return current doc object
+     * @throws IOException if an error occurred when reading the document
      */
     public Doc getDoc() throws IOException;
 
@@ -125,12 +119,9 @@
      * Go to the multidoc object that contains the next doc object in the
      * sequence of doc objects.
      *
-     * @return  Multidoc object containing the next doc object, or null if
-     * there are no further doc objects.
-     *
-     * @exception  IOException
-     *     Thrown if an error occurred locating the next document
+     * @return multidoc object containing the next doc object, or {@code null}
+     *         if there are no further doc objects
+     * @throws IOException if an error occurred locating the next document
      */
     public MultiDoc next() throws IOException;
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintJob.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintJob.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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,39 +28,35 @@
 import javax.print.attribute.PrintRequestAttributeSet;
 
 /**
- *
- * Obtained from a MultiDocPrintService, a MultiDocPrintJob can print a
- * specified collection of documents as a single print job with a set of
+ * Obtained from a {@code MultiDocPrintService}, a {@code MultiDocPrintJob} can
+ * print a specified collection of documents as a single print job with a set of
  * job attributes.
  */
-
 public interface MultiDocPrintJob extends DocPrintJob {
 
-   /**
-     * Print a MultiDoc with the specified job attributes.
-     * This method should only be called once for a given print job.
-     * Calling it again will not result in a new job being spooled to
-     * the printer. The service implementation will define policy
-     * for service interruption and recovery. Application clients which
-     * want to monitor the success or failure should register a
-     * PrintJobListener.
-     *
-     * @param multiDoc The documents to be printed. ALL must be a flavor
-     *        supported by the PrintJob {@literal &} PrintService.
+    /**
+     * Print a {@code MultiDoc} with the specified job attributes. This method
+     * should only be called once for a given print job. Calling it again will
+     * not result in a new job being spooled to the printer. The service
+     * implementation will define policy for service interruption and recovery.
+     * Application clients which want to monitor the success or failure should
+     * register a {@code PrintJobListener}.
      *
-     * @param attributes The job attributes to be applied to this print job.
-     *        If this parameter is null then the default attributes are used.
-     *
-     * @throws PrintException The exception additionally may implement
-     * an interfaces which more precisely describes the cause of the exception
-     * <ul>
-     * <li>FlavorException.
-     *  If the document has a flavor not supported by this print job.
-     * <li>AttributeException.
-     *  If one or more of the attributes are not valid for this print job.
-     * </ul>
+     * @param  multiDoc the documents to be printed. ALL must be a flavor
+     *         supported by the PrintJob {@literal &} PrintService.
+     * @param  attributes the job attributes to be applied to this print job. If
+     *         this parameter is {@code null} then the default attributes are
+     *         used.
+     * @throws PrintException the exception additionally may implement an
+     *         interfaces which more precisely describes the cause of the
+     *         exception
+     *         <ul>
+     *           <li>{@code FlavorException}. If the document has a flavor not
+     *           supported by this print job.
+     *           <li>{@code AttributeException}. If one or more of the
+     *           attributes are not valid for this print job.
+     *         </ul>
      */
     public void print(MultiDoc multiDoc, PrintRequestAttributeSet attributes)
                 throws PrintException;
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintService.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintService.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 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
@@ -25,18 +25,18 @@
 
 package javax.print;
 
-
- /** Interface MultiPrintService is the factory for a MultiDocPrintJob.
-  * A MultiPrintService
-  * describes the capabilities of a Printer and can be queried regarding
-  * a printer's supported attributes.
-  */
+/**
+ * Interface {@code MultiPrintService} is the factory for a
+ * {@code MultiDocPrintJob}. A {@code MultiPrintService} describes the
+ * capabilities of a printer and can be queried regarding a printer's supported
+ * attributes.
+ */
 public interface MultiDocPrintService extends PrintService {
 
     /**
      * Create a job which can print a multiDoc.
-     * @return a MultiDocPrintJob
+     *
+     * @return a {@code MultiDocPrintJob}
      */
     public MultiDocPrintJob createMultiDocPrintJob();
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/PrintException.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/PrintException.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -26,13 +26,16 @@
 package javax.print;
 
 /**
- * Class PrintException encapsulates a printing-related error condition that
- * occurred while using a Print Service instance. This base class
- * furnishes only a string description of the error. Subclasses furnish more
- * detailed information if applicable.
- *
+ * Class {@code PrintException} encapsulates a printing-related error condition
+ * that occurred while using a Print Service instance. This base class furnishes
+ * only a string description of the error. Subclasses furnish more detailed
+ * information if applicable.
  */
 public class PrintException extends Exception {
+
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -5932531546705242471L;
 
     /**
@@ -45,7 +48,7 @@
     /**
      * Construct a print exception with the given detail message.
      *
-     * @param  s  Detail message, or null if no detail message.
+     * @param  s detail message, or {@code null} if no detail message
      */
     public PrintException (String s) {
         super (s);
@@ -54,20 +57,20 @@
     /**
      * Construct a print exception chaining the supplied exception.
      *
-     * @param  e  Chained exception.
+     * @param  e chained exception
      */
     public PrintException (Exception e) {
         super ( e);
     }
 
     /**
-     * Construct a print exception with the given detail message
-     * and chained exception.
-     * @param  s  Detail message, or null if no detail message.
-     * @param  e  Chained exception.
+     * Construct a print exception with the given detail message and chained
+     * exception.
+     *
+     * @param  s detail message, or {@code null} if no detail message
+     * @param  e chained exception
      */
     public PrintException (String s, Exception e) {
         super (s, e);
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/PrintService.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/PrintService.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -25,22 +25,19 @@
 
 package javax.print;
 
-import java.util.Locale;
-
 import javax.print.attribute.Attribute;
 import javax.print.attribute.AttributeSet;
 import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.PrintServiceAttributeSet;
 import javax.print.event.PrintServiceAttributeListener;
 
-
 /**
- * Interface PrintService is the factory for a DocPrintJob. A PrintService
- * describes the capabilities of a Printer and can be queried regarding
- * a printer's supported attributes.
- * <P>
+ * Interface {@code PrintService} is the factory for a {@code DocPrintJob}. A
+ * {@code PrintService} describes the capabilities of a printer and can be
+ * queried regarding a printer's supported attributes.
+ * <p>
  * Example:
- *   <PRE>{@code
+ *   <pre>{@code
  *   DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
  *   PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
  *   aset.add(MediaSizeName.ISO_A4);
@@ -56,299 +53,263 @@
  *        } catch (PrintException e) {
  *        }
  *   }
- *   }</PRE>
+ *   }</pre>
  */
 public interface PrintService {
 
-    /** Returns a String name for this print service which may be used
-      * by applications to request a particular print service.
-      * In a suitable context, such as a name service, this name must be
-      * unique.
-      * In some environments this unique name may be the same as the user
-      * friendly printer name defined as the
-      * {@link javax.print.attribute.standard.PrinterName PrinterName}
-      * attribute.
-      * @return name of the service.
-      */
+    /**
+     * Returns a string name for this print service which may be used by
+     * applications to request a particular print service. In a suitable
+     * context, such as a name service, this name must be unique. In some
+     * environments this unique name may be the same as the user friendly
+     * printer name defined as the
+     * {@link javax.print.attribute.standard.PrinterName PrinterName} attribute.
+     *
+     * @return name of the service
+     */
     public String getName();
 
     /**
-     * Creates and returns a PrintJob capable of handling data from
-     * any of the supported document flavors.
-     * @return a DocPrintJob object
+     * Creates and returns a {@code PrintJob} capable of handling data from any
+     * of the supported document flavors.
+     *
+     * @return a {@code DocPrintJob} object
      */
     public DocPrintJob createPrintJob();
 
     /**
-     * Registers a listener for events on this PrintService.
-     * @param listener  a PrintServiceAttributeListener, which
-     *        monitors the status of a print service
+     * Registers a listener for events on this {@code PrintService}.
+     *
+     * @param  listener a PrintServiceAttributeListener, which monitors the
+     *         status of a print service
      * @see #removePrintServiceAttributeListener
      */
     public void addPrintServiceAttributeListener(
                                        PrintServiceAttributeListener listener);
 
     /**
-     * Removes the print-service listener from this print service.
-     * This means the listener is no longer interested in
-     * {@code PrintService} events.
-     * @param listener  a PrintServiceAttributeListener object
+     * Removes the print-service listener from this print service. This means
+     * the listener is no longer interested in {@code PrintService} events.
+     *
+     * @param  listener a {@code PrintServiceAttributeListener} object
      * @see #addPrintServiceAttributeListener
      */
     public void removePrintServiceAttributeListener(
                                        PrintServiceAttributeListener listener);
 
     /**
-     * Obtains this print service's set of printer description attributes
-     * giving this Print Service's status. The returned attribute set object
-     * is unmodifiable. The returned attribute set object is a "snapshot" of
-     * this Print Service's attribute set at the time of the
-     * {@code getAttributes()} method call: that is, the returned
-     * attribute set's contents will <I>not</I> be updated if this print
-     * service's attribute set's contents change in the future. To detect
-     * changes in attribute values, call {@code getAttributes()} again
-     * and compare the new attribute set to the previous attribute set;
-     * alternatively, register a listener for print service events.
+     * Obtains this print service's set of printer description attributes giving
+     * this Print Service's status. The returned attribute set object is
+     * unmodifiable. The returned attribute set object is a "snapshot" of this
+     * Print Service's attribute set at the time of the {@code getAttributes()}
+     * method call: that is, the returned attribute set's contents will
+     * <i>not</i> be updated if this print service's attribute set's contents
+     * change in the future. To detect changes in attribute values, call
+     * {@code getAttributes()} again and compare the new attribute set to the
+     * previous attribute set; alternatively, register a listener for print
+     * service events.
      *
-     * @return  Unmodifiable snapshot of this Print Service's attribute set.
-     *          May be empty, but not null.
+     * @return unmodifiable snapshot of this Print Service's attribute set. May
+     *         be empty, but not {@code null}.
      */
     public PrintServiceAttributeSet getAttributes();
 
     /**
-     * Gets the value of the single specified service attribute.
-     * This may be useful to clients which only need the value of one
-     * attribute and want to minimize overhead.
-     * @param <T> the type of the specified service attribute
-     * @param category the category of a PrintServiceAttribute supported
-     * by this service - may not be null.
-     * @return the value of the supported attribute or null if the
-     * attribute is not supported by this service.
-     * @exception NullPointerException if the category is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) if {@code category} is not a
-     *     {@code Class} that implements interface
-     *{@link javax.print.attribute.PrintServiceAttribute PrintServiceAttribute}.
+     * Gets the value of the single specified service attribute. This may be
+     * useful to clients which only need the value of one attribute and want to
+     * minimize overhead.
+     *
+     * @param  <T> the type of the specified service attribute
+     * @param  category the category of a {@code PrintServiceAttribute}
+     *         supported by this service - may not be {@code null}
+     * @return the value of the supported attribute or {@code null} if the
+     *         attribute is not supported by this service
+     * @throws NullPointerException if the category is {@code null}
+     * @throws IllegalArgumentException if {@code category} is not a
+     *         {@code Class} that implements interface
+     *         {@link PrintServiceAttribute PrintServiceAttribute}
      */
     public <T extends PrintServiceAttribute>
         T getAttribute(Class<T> category);
 
     /**
-     * Determines the print data formats a client can specify when setting
-     * up a job for this {@code PrintService}. A print data format is
-     * designated by a "doc
-     * flavor" (class {@link javax.print.DocFlavor DocFlavor})
-     * consisting of a MIME type plus a print data representation class.
-     * <P>
-     * Note that some doc flavors may not be supported in combination
-     * with all attributes. Use {@code getUnsupportedAttributes(..)}
-     * to validate specific combinations.
+     * Determines the print data formats a client can specify when setting up a
+     * job for this {@code PrintService}. A print data format is designated by a
+     * "doc flavor" (class {@link DocFlavor DocFlavor}) consisting of a MIME
+     * type plus a print data representation class.
+     * <p>
+     * Note that some doc flavors may not be supported in combination with all
+     * attributes. Use {@code getUnsupportedAttributes(..)} to validate specific
+     * combinations.
      *
-     * @return  Array of supported doc flavors, should have at least
-     *          one element.
-     *
+     * @return array of supported doc flavors, should have at least one element
      */
     public DocFlavor[] getSupportedDocFlavors();
 
     /**
-     * Determines if this print service supports a specific
-     * {@code DocFlavor}.  This is a convenience method to determine
-     * if the {@code DocFlavor} would be a member of the result of
-     * {@code getSupportedDocFlavors()}.
+     * Determines if this print service supports a specific {@code DocFlavor}.
+     * This is a convenience method to determine if the {@code DocFlavor} would
+     * be a member of the result of {@code getSupportedDocFlavors()}.
      * <p>
-     * Note that some doc flavors may not be supported in combination
-     * with all attributes. Use {@code getUnsupportedAttributes(..)}
-     * to validate specific combinations.
+     * Note that some doc flavors may not be supported in combination with all
+     * attributes. Use {@code getUnsupportedAttributes(..)} to validate specific
+     * combinations.
      *
-     * @param flavor the {@code DocFlavor} to query for support.
-     * @return  {@code true} if this print service supports the
-     * specified {@code DocFlavor}; {@code false} otherwise.
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code flavor} is null.
+     * @param  flavor the {@code DocFlavor} to query for support
+     * @return {@code true} if this print service supports the specified
+     *         {@code DocFlavor}; {@code false} otherwise
+     * @throws NullPointerException if {@code flavor} is {@code null}
      */
     public boolean isDocFlavorSupported(DocFlavor flavor);
 
-
     /**
-     * Determines the printing attribute categories a client can specify
-     * when setting up a job for this print service.
-     * A printing attribute category is
+     * Determines the printing attribute categories a client can specify when
+     * setting up a job for this print service. A printing attribute category is
      * designated by a {@code Class} that implements interface
-     * {@link javax.print.attribute.Attribute Attribute}. This method returns
-     * just the attribute <I>categories</I> that are supported; it does not
-     * return the particular attribute <I>values</I> that are supported.
-     * <P>
-     * This method returns all the printing attribute
-     * categories this print service supports for any possible job.
-     * Some categories may not be supported in a particular context (ie
-     * for a particular {@code DocFlavor}).
-     * Use one of the methods that include a {@code DocFlavor} to
-     * validate the request before submitting it, such as
+     * {@link Attribute Attribute}. This method returns just the attribute
+     * <i>categories</i> that are supported; it does not return the particular
+     * attribute <i>values</i> that are supported.
+     * <p>
+     * This method returns all the printing attribute categories this print
+     * service supports for any possible job. Some categories may not be
+     * supported in a particular context (ie for a particular
+     * {@code DocFlavor}). Use one of the methods that include a
+     * {@code DocFlavor} to validate the request before submitting it, such as
      * {@code getSupportedAttributeValues(..)}.
      *
-     * @return  Array of printing attribute categories that the client can
-     *          specify as a doc-level or job-level attribute in a Print
-     *          Request. Each element in the array is a {@link java.lang.Class
-     *          Class} that implements interface {@link
-     *          javax.print.attribute.Attribute Attribute}.
-     *          The array is empty if no categories are supported.
+     * @return array of printing attribute categories that the client can
+     *         specify as a doc-level or job-level attribute in a Print Request.
+     *         Each element in the array is a {@link Class Class} that
+     *         implements interface {@link Attribute Attribute}. The array is
+     *         empty if no categories are supported.
      */
     public Class<?>[] getSupportedAttributeCategories();
 
     /**
-     * Determines whether a client can specify the given printing
-     * attribute category when setting up a job for this print service. A
-     * printing attribute category is designated by a {@code Class}
-     * that implements interface {@link javax.print.attribute.Attribute
-     * Attribute}. This method tells whether the attribute <I>category</I> is
-     * supported; it does not tell whether a particular attribute <I>value</I>
-     * is supported.
+     * Determines whether a client can specify the given printing attribute
+     * category when setting up a job for this print service. A printing
+     * attribute category is designated by a {@code Class} that implements
+     * interface {@link Attribute Attribute}. This method
+     * tells whether the attribute <i>category</i> is supported; it does not
+     * tell whether a particular attribute <i>value</i> is supported.
      * <p>
-     * Some categories may not be supported in a particular context (ie
-     * for a particular {@code DocFlavor}).
-     * Use one of the methods which include a {@code DocFlavor} to
-     * validate the request before submitting it, such as
+     * Some categories may not be supported in a particular context (ie for a
+     * particular {@code DocFlavor}). Use one of the methods which include a
+     * {@code DocFlavor} to validate the request before submitting it, such as
      * {@code getSupportedAttributeValues(..)}.
-     * <P>
-     * This is a convenience method to determine if the category
-     * would be a member of the result of
-     * {@code getSupportedAttributeCategories()}.
-     *
-     * @param  category    Printing attribute category to test. It must be a
-     *                        {@code Class} that implements
-     *                        interface
-     *                {@link javax.print.attribute.Attribute Attribute}.
+     * <p>
+     * This is a convenience method to determine if the category would be a
+     * member of the result of {@code getSupportedAttributeCategories()}.
      *
-     * @return  {@code true} if this print service supports
-     *          specifying a doc-level or
-     *          job-level attribute in {@code category} in a Print
-     *          Request; {@code false} if it doesn't.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code category} is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code category} is not a
-     *     {@code Class} that implements interface
-     *     {@link javax.print.attribute.Attribute Attribute}.
+     * @param  category printing attribute category to test. It must be a
+     *         {@code Class} that implements interface
+     *         {@link Attribute Attribute}.
+     * @return {@code true} if this print service supports specifying a
+     *         doc-level or job-level attribute in {@code category} in a Print
+     *         Request; {@code false} if it doesn't
+     * @throws NullPointerException if {@code category} is {@code null}
+     * @throws IllegalArgumentException if {@code category} is not a
+     *         {@code Class} that implements interface
+     *         {@link Attribute Attribute}
      */
     public boolean
         isAttributeCategorySupported(Class<? extends Attribute> category);
 
     /**
-     * Determines this print service's default printing attribute value in
-     * the given category. A printing attribute value is an instance of
-     * a class that implements interface
-     * {@link javax.print.attribute.Attribute Attribute}. If a client sets
-     * up a print job and does not specify any attribute value in the
-     * given category, this Print Service will use the
-     * default attribute value instead.
+     * Determines this print service's default printing attribute value in the
+     * given category. A printing attribute value is an instance of a class that
+     * implements interface {@link Attribute Attribute}. If a client sets up a
+     * print job and does not specify any attribute value in the given category,
+     * this Print Service will use the default attribute value instead.
      * <p>
-     * Some attributes may not be supported in a particular context (ie
-     * for a particular {@code DocFlavor}).
-     * Use one of the methods that include a {@code DocFlavor} to
-     * validate the request before submitting it, such as
+     * Some attributes may not be supported in a particular context (ie for a
+     * particular {@code DocFlavor}). Use one of the methods that include a
+     * {@code DocFlavor} to validate the request before submitting it, such as
      * {@code getSupportedAttributeValues(..)}.
-     * <P>
-     * Not all attributes have a default value. For example the
-     * service will not have a defaultvalue for {@code RequestingUser}
-     * i.e. a null return for a supported category means there is no
-     * service default value for that category. Use the
-     * {@code isAttributeCategorySupported(Class)} method to
-     * distinguish these cases.
+     * <p>
+     * Not all attributes have a default value. For example the service will not
+     * have a default value for {@code RequestingUser} i.e. a {@code null}
+     * return for a supported category means there is no service default value
+     * for that category. Use the {@code isAttributeCategorySupported(Class)}
+     * method to distinguish these cases.
      *
-     * @param  category    Printing attribute category for which the default
-     *                     attribute value is requested. It must be a {@link
-     *                        java.lang.Class Class} that implements interface
-     *                        {@link javax.print.attribute.Attribute
-     *                        Attribute}.
-     *
-     * @return  Default attribute value for {@code category}, or null
-     *       if this Print Service does not support specifying a doc-level or
-     *          job-level attribute in {@code category} in a Print
-     *          Request, or the service does not have a default value
-     *          for this attribute.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code category} is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code category} is not a
-     *     {@link java.lang.Class Class} that implements interface {@link
-     *     javax.print.attribute.Attribute Attribute}.
+     * @param  category printing attribute category for which the default
+     *         attribute value is requested. It must be a {@link Class Class}
+     *         that implements interface {@link Attribute Attribute}.
+     * @return default attribute value for {@code category}, or {@code null} if
+     *         this Print Service does not support specifying a doc-level or
+     *         job-level attribute in {@code category} in a Print Request, or
+     *         the service does not have a default value for this attribute
+     * @throws NullPointerException if {@code category} is {@code null}
+     * @throws IllegalArgumentException if {@code category} is not a
+     *         {@link Class Class} that implements interface
+     *         {@link Attribute Attribute}
      */
     public Object
         getDefaultAttributeValue(Class<? extends Attribute> category);
 
     /**
-     * Determines the printing attribute values a client can specify in
-     * the given category when setting up a job for this print service. A
-     * printing
+     * Determines the printing attribute values a client can specify in the
+     * given category when setting up a job for this print service. A printing
      * attribute value is an instance of a class that implements interface
-     * {@link javax.print.attribute.Attribute Attribute}.
-     * <P>
-     * If {@code flavor} is null and {@code attributes} is null
-     * or is an empty set, this method returns all the printing attribute
-     * values this Print Service supports for any possible job. If
-     * {@code flavor} is not null or {@code attributes} is not
-     * an empty set, this method returns just the printing attribute values
-     * that are compatible with the given doc flavor and/or set of attributes.
-     * That is, a null return value may indicate that specifying this attribute
-     * is incompatible with the specified DocFlavor.
-     * Also if DocFlavor is not null it must be a flavor supported by this
-     * PrintService, else IllegalArgumentException will be thrown.
-     * <P>
-     * If the {@code attributes} parameter contains an Attribute whose
-     * category is the same as the {@code category} parameter, the service
-     * must ignore this attribute in the AttributeSet.
+     * {@link Attribute Attribute}.
      * <p>
-     * {@code DocAttribute}s which are to be specified on the
-     * {@code Doc} must be included in this set to accurately
-     * represent the context.
+     * If {@code flavor} is {@code null} and {@code attributes} is {@code null}
+     * or is an empty set, this method returns all the printing attribute values
+     * this Print Service supports for any possible job. If {@code flavor} is not
+     * {@code null} or {@code attributes} is not an empty set, this method
+     * returns just the printing attribute values that are compatible with the
+     * given doc flavor and/or set of attributes. That is, a {@code null} return
+     * value may indicate that specifying this attribute is incompatible with
+     * the specified DocFlavor. Also if {@code DocFlavor} is not {@code null} it
+     * must be a flavor supported by this {@code PrintService}, else
+     * {@code IllegalArgumentException} will be thrown.
      * <p>
-     * This method returns an Object because different printing attribute
-     * categories indicate the supported attribute values in different ways.
-     * The documentation for each printing attribute in package {@link
-     * javax.print.attribute.standard javax.print.attribute.standard}
+     * If the {@code attributes} parameter contains an {@code Attribute} whose
+     * category is the same as the {@code category} parameter, the service must
+     * ignore this attribute in the {@code AttributeSet}.
+     * <p>
+     * {@code DocAttribute}s which are to be specified on the {@code Doc} must
+     * be included in this set to accurately represent the context.
+     * <p>
+     * This method returns an {@code Object} because different printing
+     * attribute categories indicate the supported attribute values in different
+     * ways. The documentation for each printing attribute in package
+     * {@link javax.print.attribute.standard javax.print.attribute.standard}
      * describes how each attribute indicates its supported values. Possible
      * ways of indicating support include:
-     * <UL>
-     * <LI>
-     * Return a single instance of the attribute category to indicate that any
-     * value is legal -- used, for example, by an attribute whose value is an
-     * arbitrary text string. (The value of the returned attribute object is
-     * irrelevant.)
-     * <LI>
-     * Return an array of one or more instances of the attribute category,
-     * containing the legal values -- used, for example, by an attribute with
-     * a list of enumerated values. The type of the array is an array of the
-     * specified attribute category type as returned by its
-     * {@code getCategory(Class)}.
-     * <LI>
-     * Return a single object (of some class other than the attribute category)
-     * that indicates bounds on the legal values -- used, for example, by an
-     * integer-valued attribute that must lie within a certain range.
-     * </UL>
+     * <ul>
+     *   <li>Return a single instance of the attribute category to indicate that
+     *   any value is legal -- used, for example, by an attribute whose value is
+     *   an arbitrary text string. (The value of the returned attribute object
+     *   is irrelevant.)
+     *   <li>Return an array of one or more instances of the attribute category,
+     *   containing the legal values -- used, for example, by an attribute with
+     *   a list of enumerated values. The type of the array is an array of the
+     *   specified attribute category type as returned by its
+     *   {@code getCategory(Class)}.
+     *   <li>Return a single object (of some class other than the attribute
+     *   category) that indicates bounds on the legal values -- used, for
+     *   example, by an integer-valued attribute that must lie within a certain
+     *   range.
+     * </ul>
      *
-     * @param  category    Printing attribute category to test. It must be a
-     *                        {@link java.lang.Class Class} that implements
-     *                        interface {@link
-     *                        javax.print.attribute.Attribute Attribute}.
-     * @param  flavor      Doc flavor for a supposed job, or null.
-     * @param  attributes  Set of printing attributes for a supposed job
-     *                        (both job-level attributes and document-level
-     *                        attributes), or null.
-     *
-     * @return  Object indicating supported values for {@code category},
-     *          or null if this Print Service does not support specifying a
-     *          doc-level or job-level attribute in {@code category} in
-     *          a Print Request.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code category} is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code category} is not a
-     *     {@link java.lang.Class Class} that implements interface {@link
-     *     javax.print.attribute.Attribute Attribute}, or
-     *     {@code DocFlavor} is not supported by this service.
+     * @param  category printing attribute category to test. It must be a
+     *         {@link Class Class} that implements interface
+     *         {@link Attribute Attribute}.
+     * @param  flavor doc flavor for a supposed job, or {@code null}
+     * @param  attributes set of printing attributes for a supposed job (both
+     *         job-level attributes and document-level attributes), or
+     *         {@code null}
+     * @return object indicating supported values for {@code category}, or
+     *         {@code null} if this Print Service does not support specifying a
+     *         doc-level or job-level attribute in {@code category} in a Print
+     *         Request
+     * @throws NullPointerException if {@code category} is {@code null}
+     * @throws IllegalArgumentException if {@code category} is not a
+     *         {@link Class Class} that implements interface
+     *         {@link Attribute Attribute}, or {@code DocFlavor} is not
+     *         supported by this service
      */
     public Object
         getSupportedAttributeValues(Class<? extends Attribute> category,
@@ -356,133 +317,121 @@
                                     AttributeSet attributes);
 
     /**
-     * Determines whether a client can specify the given printing
-     * attribute
-     * value when setting up a job for this Print Service. A printing
-     * attribute value is an instance of a class that implements interface
-     *  {@link javax.print.attribute.Attribute Attribute}.
-     * <P>
-     * If {@code flavor} is null and {@code attributes} is null or
-     * is an empty set, this method tells whether this Print Service supports
+     * Determines whether a client can specify the given printing attribute
+     * value when setting up a job for this Print Service. A printing attribute
+     * value is an instance of a class that implements interface
+     * {@link Attribute Attribute}.
+     * <p>
+     * If {@code flavor} is {@code null} and {@code attributes} is {@code null}
+     * or is an empty set, this method tells whether this Print Service supports
      * the given printing attribute value for some possible combination of doc
-     * flavor and set of attributes. If {@code flavor} is not null or
-     * {@code attributes} is not an empty set, this method tells whether
-     * this Print Service supports the given printing attribute value in
-     * combination with the given doc flavor and/or set of attributes.
+     * flavor and set of attributes. If {@code flavor} is not {@code null} or
+     * {@code attributes} is not an empty set, this method tells whether this
+     * Print Service supports the given printing attribute value in combination
+     * with the given doc flavor and/or set of attributes.
      * <p>
-     * Also if DocFlavor is not null it must be a flavor supported by this
-     * PrintService, else IllegalArgumentException will be thrown.
+     * Also if {@code DocFlavor} is not {@code null} it must be a flavor
+     * supported by this {@code PrintService}, else
+     * {@code IllegalArgumentException} will be thrown.
      * <p>
-     * {@code DocAttribute}s which are to be specified on the
-     * {@code Doc} must be included in this set to accurately
-     * represent the context.
+     * {@code DocAttribute}s which are to be specified on the {@code Doc} must
+     * be included in this set to accurately represent the context.
      * <p>
-     * This is a convenience method to determine if the value
-     * would be a member of the result of
-     * {@code getSupportedAttributeValues(...)}.
+     * This is a convenience method to determine if the value would be a member
+     * of the result of {@code getSupportedAttributeValues(...)}.
      *
-     * @param  attrval       Printing attribute value to test.
-     * @param  flavor      Doc flavor for a supposed job, or null.
-     * @param  attributes  Set of printing attributes for a supposed job
-     *                        (both job-level attributes and document-level
-     *                        attributes), or null.
-     *
-     * @return  True if this Print Service supports specifying
-     *        {@code attrval} as a doc-level or job-level attribute in a
-     *          Print Request, false if it doesn't.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception)  if {@code attrval} is null.
-     * @exception  IllegalArgumentException if flavor is not supported by
-     *      this PrintService.
+     * @param  attrval printing attribute value to test
+     * @param  flavor doc flavor for a supposed job, or {@code null}
+     * @param  attributes set of printing attributes for a supposed job (both
+     *         job-level attributes and document-level attributes), or
+     *         {@code null}
+     * @return {@code true} if this Print Service supports specifying
+     *         {@code attrval} as a doc-level or job-level attribute in a Print
+     *         Request, {@code false} if it doesn't
+     * @throws NullPointerException if {@code attrval} is {@code null}
+     * @throws IllegalArgumentException if flavor is not supported by this
+     *         {@code PrintService}
      */
     public boolean isAttributeValueSupported(Attribute attrval,
                                              DocFlavor flavor,
                                              AttributeSet attributes);
 
-
     /**
-     * Identifies the attributes that are unsupported for a print request
-     * in the context of a particular DocFlavor.
-     * This method is useful for validating a potential print job and
-     * identifying the specific attributes which cannot be supported.
-     * It is important to supply only a supported DocFlavor or an
-     * IllegalArgumentException will be thrown. If the
-     * return value from this method is null, all attributes are supported.
+     * Identifies the attributes that are unsupported for a print request in the
+     * context of a particular {@code DocFlavor}. This method is useful for
+     * validating a potential print job and identifying the specific attributes
+     * which cannot be supported. It is important to supply only a supported
+     * {@code DocFlavor} or an {@code IllegalArgumentException} will be thrown.
+     * If the return value from this method is {@code null}, all attributes are
+     * supported.
      * <p>
-     * {@code DocAttribute}s which are to be specified on the
-     * {@code Doc} must be included in this set to accurately
-     * represent the context.
+     * {@code DocAttribute}s which are to be specified on the {@code Doc} must
+     * be included in this set to accurately represent the context.
      * <p>
-     * If the return value is non-null, all attributes in the returned
-     * set are unsupported with this DocFlavor. The returned set does not
-     * distinguish attribute categories that are unsupported from
+     * If the return value is {@code non-null}, all attributes in the returned
+     * set are unsupported with this {@code DocFlavor}. The returned set does
+     * not distinguish attribute categories that are unsupported from
      * unsupported attribute values.
      * <p>
-     * A supported print request can then be created by removing
-     * all unsupported attributes from the original attribute set,
-     * except in the case that the DocFlavor is unsupported.
+     * A supported print request can then be created by removing all unsupported
+     * attributes from the original attribute set, except in the case that the
+     * {@code DocFlavor} is unsupported.
      * <p>
-     * If any attributes are unsupported only because they are in conflict
-     * with other attributes then it is at the discretion of the service
-     * to select the attribute(s) to be identified as the cause of the
-     * conflict.
+     * If any attributes are unsupported only because they are in conflict with
+     * other attributes then it is at the discretion of the service to select
+     * the attribute(s) to be identified as the cause of the conflict.
      * <p>
-     * Use {@code isDocFlavorSupported()} to verify that a DocFlavor
-     * is supported before calling this method.
+     * Use {@code isDocFlavorSupported()} to verify that a {@code DocFlavor} is
+     * supported before calling this method.
      *
-     * @param  flavor      Doc flavor to test, or null
-     * @param  attributes  Set of printing attributes for a supposed job
-     *                        (both job-level attributes and document-level
-     *                        attributes), or null.
-     *
-     * @return  null if this Print Service supports the print request
-     * specification, else the unsupported attributes.
-     *
-     * @exception IllegalArgumentException if {@code flavor} is
-     *             not supported by this PrintService.
+     * @param  flavor doc flavor to test, or {@code null}
+     * @param  attributes set of printing attributes for a supposed job (both
+     *         job-level attributes and document-level attributes), or
+     *         {@code null}
+     * @return {@code null} if this Print Service supports the print request
+     *         specification, else the unsupported attributes
+     * @throws IllegalArgumentException if {@code flavor} is not supported by
+     *         this {@code PrintService}
      */
     public AttributeSet getUnsupportedAttributes(DocFlavor flavor,
                                            AttributeSet attributes);
 
     /**
-     * Returns a factory for UI components which allow users to interact
-     * with the service in various roles.
-     * Services which do not provide any UI should return null.
-     * Print Services which do provide UI but want to be supported in
-     * an environment with no UI support should ensure that the factory
-     * is not initialised unless the application calls this method to
-     * obtain the factory.
-     * See {@code ServiceUIFactory} for more information.
-     * @return null or a factory for UI components.
+     * Returns a factory for UI components which allow users to interact with
+     * the service in various roles. Services which do not provide any UI should
+     * return {@code null}. Print Services which do provide UI but want to be
+     * supported in an environment with no UI support should ensure that the
+     * factory is not initialised unless the application calls this method to
+     * obtain the factory. See {@code ServiceUIFactory} for more information.
+     *
+     * @return {@code null} or a factory for UI components
      */
     public ServiceUIFactory getServiceUIFactory();
 
     /**
-     * Determines if two services are referring to the same underlying
-     * service.  Objects encapsulating a print service may not exhibit
-     * equality of reference even though they refer to the same underlying
-     * service.
+     * Determines if two services are referring to the same underlying service.
+     * Objects encapsulating a print service may not exhibit equality of
+     * reference even though they refer to the same underlying service.
      * <p>
      * Clients should call this method to determine if two services are
      * referring to the same underlying service.
      * <p>
-     * Services must implement this method and return true only if the
-     * service objects being compared may be used interchangeably by the
-     * client.
+     * Services must implement this method and return {@code true} only if the
+     * service objects being compared may be used interchangeably by the client.
      * Services are free to return the same object reference to an underlying
      * service if that, but clients must not depend on equality of reference.
-     * @param obj the reference object with which to compare.
-     * @return true if this service is the same as the obj argument,
-     * false otherwise.
+     *
+     * @param  obj the reference object with which to compare
+     * @return {@code true} if this service is the same as the obj argument,
+     *         {@code false} otherwise
      */
     public boolean equals(Object obj);
 
     /**
      * This method should be implemented consistently with
      * {@code equals(Object)}.
-     * @return hash code of this object.
+     *
+     * @return hash code of this object
      */
     public int hashCode();
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/PrintServiceLookup.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/PrintServiceLookup.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,56 +23,69 @@
  * questions.
  */
 
-
 package javax.print;
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
+
 import javax.print.attribute.AttributeSet;
 
 import sun.awt.AppContext;
-import java.util.ServiceLoader;
-import java.util.ServiceConfigurationError;
 
-/** Implementations of this class provide lookup services for
-  * print services (typically equivalent to printers) of a particular type.
-  * <p>
-  * Multiple implementations may be installed concurrently.
-  * All implementations must be able to describe the located printers
-  * as instances of a PrintService.
-  * Typically implementations of this service class are located
-  * automatically in JAR files (see the SPI JAR file specification).
-  * These classes must be instantiable using a default constructor.
-  * Alternatively applications may explicitly register instances
-  * at runtime.
-  * <p>
-  * Applications use only the static methods of this abstract class.
-  * The instance methods are implemented by a service provider in a subclass
-  * and the unification of the results from all installed lookup classes
-  * are reported by the static methods of this class when called by
-  * the application.
-  * <p>
-  * A PrintServiceLookup implementor is recommended to check for the
-  * SecurityManager.checkPrintJobAccess() to deny access to untrusted code.
-  * Following this recommended policy means that untrusted code may not
-  * be able to locate any print services. Downloaded applets are the most
-  * common example of untrusted code.
-  * <p>
-  * This check is made on a per lookup service basis to allow flexibility in
-  * the policy to reflect the needs of different lookup services.
-  * <p>
-  * Services which are registered by registerService(PrintService)
-  * will not be included in lookup results if a security manager is
-  * installed and its checkPrintJobAccess() method denies access.
-  */
-
+/**
+ * Implementations of this class provide lookup services for print services
+ * (typically equivalent to printers) of a particular type.
+ * <p>
+ * Multiple implementations may be installed concurrently. All implementations
+ * must be able to describe the located printers as instances of a
+ * {@code PrintService}. Typically implementations of this service class are
+ * located automatically in JAR files (see the SPI JAR file specification).
+ * These classes must be instantiable using a default constructor. Alternatively
+ * applications may explicitly register instances at runtime.
+ * <p>
+ * Applications use only the static methods of this abstract class. The instance
+ * methods are implemented by a service provider in a subclass and the
+ * unification of the results from all installed lookup classes are reported by
+ * the static methods of this class when called by the application.
+ * <p>
+ * A {@code PrintServiceLookup} implementor is recommended to check for the
+ * {@code SecurityManager.checkPrintJobAccess()} to deny access to untrusted
+ * code. Following this recommended policy means that untrusted code may not be
+ * able to locate any print services. Downloaded applets are the most common
+ * example of untrusted code.
+ * <p>
+ * This check is made on a per lookup service basis to allow flexibility in the
+ * policy to reflect the needs of different lookup services.
+ * <p>
+ * Services which are registered by {@link #registerService(PrintService)} will
+ * not be included in lookup results if a security manager is installed and its
+ * {@code checkPrintJobAccess()} method denies access.
+ */
 public abstract class PrintServiceLookup {
 
+    /**
+     * Contains a lists of services.
+     */
     static class Services {
+
+        /**
+         * The list of lookup services.
+         */
         private ArrayList<PrintServiceLookup> listOfLookupServices = null;
+
+        /**
+         * The list of registered services.
+         */
         private ArrayList<PrintService> registeredServices = null;
     }
 
+    /**
+     * Returns the services from the current appcontext.
+     *
+     * @return the services
+     */
     private static Services getServicesForContext() {
         Services services =
             (Services)AppContext.getAppContext().get(Services.class);
@@ -83,21 +96,40 @@
         return services;
     }
 
+    /**
+     * Returns the list of lookup services.
+     *
+     * @return the list of lookup services
+     */
     private static ArrayList<PrintServiceLookup> getListOfLookupServices() {
         return getServicesForContext().listOfLookupServices;
     }
 
+    /**
+     * Initialize the list of lookup services.
+     *
+     * @return the list of lookup services
+     */
     private static ArrayList<PrintServiceLookup> initListOfLookupServices() {
         ArrayList<PrintServiceLookup> listOfLookupServices = new ArrayList<>();
         getServicesForContext().listOfLookupServices = listOfLookupServices;
         return listOfLookupServices;
     }
 
-
+    /**
+     * Returns the list of registered services.
+     *
+     * @return the list of registered services
+     */
     private static ArrayList<PrintService> getRegisteredServices() {
         return getServicesForContext().registeredServices;
     }
 
+    /**
+     * Initialize the list of registered services.
+     *
+     * @return the list of registered services
+     */
     private static ArrayList<PrintService> initRegisteredServices() {
         ArrayList<PrintService> registeredServices = new ArrayList<>();
         getServicesForContext().registeredServices = registeredServices;
@@ -108,14 +140,13 @@
      * Locates print services capable of printing the specified
      * {@link DocFlavor}.
      *
-     * @param flavor the flavor to print. If null, this constraint is not
-     *        used.
-     * @param attributes attributes that the print service must support.
-     * If null this constraint is not used.
-     *
-     * @return array of matching {@code PrintService} objects
-     * representing print services that support the specified flavor
-     * attributes.  If no services match, the array is zero-length.
+     * @param  flavor the flavor to print. If {@code null}, this constraint is
+     *         not used.
+     * @param  attributes attributes that the print service must support. If
+     *         {@code null} this constraint is not used.
+     * @return array of matching {@code PrintService} objects representing print
+     *         services that support the specified flavor attributes. If no
+     *         services match, the array is zero-length.
      */
     public static final PrintService[]
         lookupPrintServices(DocFlavor flavor,
@@ -124,26 +155,23 @@
         return list.toArray(new PrintService[list.size()]);
     }
 
-
     /**
-     * Locates MultiDoc print Services capable of printing MultiDocs
-     * containing all the specified doc flavors.
-     * <P> This method is useful to help locate a service that can print
-     * a {@code MultiDoc} in which the elements may be different
-     * flavors. An application could perform this itself by multiple lookups
-     * on each {@code DocFlavor} in turn and collating the results,
-     * but the lookup service may be able to do this more efficiently.
+     * Locates {@code MultiDoc} print {@code Services} capable of printing
+     * {@code MultiDocs} containing all the specified doc flavors.
+     * <p>
+     * This method is useful to help locate a service that can print a
+     * {@code MultiDoc} in which the elements may be different flavors. An
+     * application could perform this itself by multiple lookups on each
+     * {@code DocFlavor} in turn and collating the results, but the lookup
+     * service may be able to do this more efficiently.
      *
-     * @param flavors the flavors to print. If null or empty this
-     *        constraint is not used.
-     * Otherwise return only multidoc print services that can print all
-     * specified doc flavors.
-     * @param attributes attributes that the print service must
-     * support.  If null this constraint is not used.
-     *
-     * @return array of matching {@link MultiDocPrintService} objects.
-     * If no services match, the array is zero-length.
-     *
+     * @param  flavors the flavors to print. If {@code null} or empty this
+     *         constraint is not used. Otherwise return only multidoc print
+     *         services that can print all specified doc flavors.
+     * @param  attributes attributes that the print service must support. If
+     *         {@code null} this constraint is not used.
+     * @return array of matching {@link MultiDocPrintService} objects. If no
+     *         services match, the array is zero-length.
      */
     public static final MultiDocPrintService[]
         lookupMultiDocPrintServices(DocFlavor[] flavors,
@@ -152,28 +180,23 @@
         return list.toArray(new MultiDocPrintService[list.size()]);
     }
 
-
     /**
-     * Locates the default print service for this environment.
-     * This may return null.
-     * If multiple lookup services each specify a default, the
-     * chosen service is not precisely defined, but a
-     * platform native service, rather than an installed service,
-     * is usually returned as the default.  If there is no clearly
-     * identifiable
-     * platform native default print service, the default is the first
-     * to be located in an implementation-dependent manner.
+     * Locates the default print service for this environment. This may return
+     * {@code null}. If multiple lookup services each specify a default, the
+     * chosen service is not precisely defined, but a platform native service,
+     * rather than an installed service, is usually returned as the default. If
+     * there is no clearly identifiable platform native default print service,
+     * the default is the first to be located in an implementation-dependent
+     * manner.
      * <p>
-     * This may include making use of any preferences API that is available
-     * as part of the Java or native platform.
-     * This algorithm may be overridden by a user setting the property
-     * javax.print.defaultPrinter.
-     * A service specified must be discovered to be valid and currently
-     * available to be returned as the default.
+     * This may include making use of any preferences API that is available as
+     * part of the Java or native platform. This algorithm may be overridden by
+     * a user setting the property {@code javax.print.defaultPrinter}. A service
+     * specified must be discovered to be valid and currently available to be
+     * returned as the default.
      *
-     * @return the default PrintService.
+     * @return the default {@code PrintService}
      */
-
     public static final PrintService lookupDefaultPrintService() {
 
         Iterator<PrintServiceLookup> psIterator = getAllLookupServices().iterator();
@@ -190,19 +213,16 @@
         return null;
     }
 
-
     /**
-     * Allows an application to explicitly register a class that
-     * implements lookup services. The registration will not persist
-     * across VM invocations.
-     * This is useful if an application needs to make a new service
-     * available that is not part of the installation.
-     * If the lookup service is already registered, or cannot be registered,
-     * the method returns false.
+     * Allows an application to explicitly register a class that implements
+     * lookup services. The registration will not persist across VM invocations.
+     * This is useful if an application needs to make a new service available
+     * that is not part of the installation. If the lookup service is already
+     * registered, or cannot be registered, the method returns {@code false}.
      *
-     * @param sp an implementation of a lookup service.
-     * @return {@code true} if the new lookup service is newly
-     *         registered; {@code false} otherwise.
+     * @param  sp an implementation of a lookup service
+     * @return {@code true} if the new lookup service is newly registered;
+     *         {@code false} otherwise
      */
     public static boolean registerServiceProvider(PrintServiceLookup sp) {
         synchronized (PrintServiceLookup.class) {
@@ -220,29 +240,24 @@
             getListOfLookupServices().add(sp);
             return true;
         }
-
     }
 
-
     /**
-     * Allows an application to directly register an instance of a
-     * class which implements a print service.
-     * The lookup operations for this service will be
-     * performed by the PrintServiceLookup class using the attribute
-     * values and classes reported by the service.
-     * This may be less efficient than a lookup
-     * service tuned for that service.
-     * Therefore registering a {@code PrintServiceLookup} instance
-     * instead is recommended.
-     * The method returns true if this service is not previously
-     * registered and is now successfully registered.
-     * This method should not be called with StreamPrintService instances.
-     * They will always fail to register and the method will return false.
-     * @param service an implementation of a print service.
-     * @return {@code true} if the service is newly
-     *         registered; {@code false} otherwise.
+     * Allows an application to directly register an instance of a class which
+     * implements a print service. The lookup operations for this service will
+     * be performed by the {@code PrintServiceLookup} class using the attribute
+     * values and classes reported by the service. This may be less efficient
+     * than a lookup service tuned for that service. Therefore registering a
+     * {@code PrintServiceLookup} instance instead is recommended. The method
+     * returns {@code true} if this service is not previously registered and is
+     * now successfully registered. This method should not be called with
+     * {@code StreamPrintService} instances. They will always fail to register
+     * and the method will return {@code false}.
+     *
+     * @param  service an implementation of a print service
+     * @return {@code true} if the service is newly registered; {@code false}
+     *         otherwise
      */
-
     public static boolean registerService(PrintService service) {
         synchronized (PrintServiceLookup.class) {
             if (service == null || service instanceof StreamPrintService) {
@@ -262,68 +277,72 @@
         }
     }
 
-
-   /**
-    * Locates services that can be positively confirmed to support
-    * the combination of attributes and DocFlavors specified.
-    * This method is not called directly by applications.
-    * <p>
-    * Implemented by a service provider, used by the static methods
-    * of this class.
-    * <p>
-    * The results should be the same as obtaining all the PrintServices
-    * and querying each one individually on its support for the
-    * specified attributes and flavors, but the process can be more
-    * efficient by taking advantage of the capabilities of lookup services
-    * for the print services.
-    *
-    * @param flavor of document required.  If null it is ignored.
-    * @param attributes required to be supported. If null this
-    * constraint is not used.
-    * @return array of matching PrintServices. If no services match, the
-    * array is zero-length.
-    */
+    /**
+     * Locates services that can be positively confirmed to support the
+     * combination of attributes and {@code DocFlavors} specified. This method
+     * is not called directly by applications.
+     * <p>
+     * Implemented by a service provider, used by the static methods of this
+     * class.
+     * <p>
+     * The results should be the same as obtaining all the {@code PrintServices}
+     * and querying each one individually on its support for the specified
+     * attributes and flavors, but the process can be more efficient by taking
+     * advantage of the capabilities of lookup services for the print services.
+     *
+     * @param  flavor of document required. If {@code null} it is ignored.
+     * @param  attributes required to be supported. If {@code null} this
+     *         constraint is not used.
+     * @return array of matching {@code PrintServices}. If no services match,
+     *         the array is zero-length.
+     */
     public abstract PrintService[] getPrintServices(DocFlavor flavor,
                                                     AttributeSet attributes);
 
     /**
-     * Not called directly by applications.
-     * Implemented by a service provider, used by the static methods
-     * of this class.
-     * @return array of all PrintServices known to this lookup service
-     * class. If none are found, the array is zero-length.
+     * Not called directly by applications. Implemented by a service provider,
+     * used by the static methods of this class.
+     *
+     * @return array of all {@code PrintServices} known to this lookup service
+     *         class. If none are found, the array is zero-length.
      */
     public abstract PrintService[] getPrintServices() ;
 
-
-   /**
-    * Not called directly by applications.
-    * <p>
-    * Implemented by a service provider, used by the static methods
-    * of this class.
-    * <p>
-    * Locates MultiDoc print services which can be positively confirmed
-    * to support the combination of attributes and DocFlavors specified.
-    *
-    * @param flavors of documents required. If null or empty it is ignored.
-    * @param attributes required to be supported. If null this
-     * constraint is not used.
-    * @return array of matching PrintServices. If no services match, the
-    * array is zero-length.
-    */
+    /**
+     * Not called directly by applications.
+     * <p>
+     * Implemented by a service provider, used by the static methods of this
+     * class.
+     * <p>
+     * Locates {@code MultiDoc} print services which can be positively confirmed
+     * to support the combination of attributes and {@code DocFlavors}
+     * specified.
+     *
+     * @param  flavors of documents required. If {@code null} or empty it is
+     *         ignored.
+     * @param  attributes required to be supported. If {@code null} this
+     *         constraint is not used.
+     * @return array of matching {@code PrintServices}. If no services match,
+     *         the array is zero-length.
+     */
     public abstract MultiDocPrintService[]
         getMultiDocPrintServices(DocFlavor[] flavors,
                                  AttributeSet attributes);
 
     /**
-     * Not called directly by applications.
-     * Implemented by a service provider, and called by the print lookup
-     * service
-     * @return the default PrintService for this lookup service.
-     * If there is no default, returns null.
+     * Not called directly by applications. Implemented by a service provider,
+     * and called by the print lookup service.
+     *
+     * @return the default {@code PrintService} for this lookup service. If
+     *         there is no default, returns {@code null}.
      */
     public abstract PrintService getDefaultPrintService();
 
+    /**
+     * Returns all lookup services for this environment.
+     *
+     * @return all lookup services for this environment
+     */
     private static ArrayList<PrintServiceLookup> getAllLookupServices() {
         synchronized (PrintServiceLookup.class) {
             ArrayList<PrintServiceLookup> listOfLookupServices = getListOfLookupServices();
@@ -362,6 +381,18 @@
         }
     }
 
+    /**
+     * Locates print services capable of printing the specified
+     * {@link DocFlavor}.
+     *
+     * @param  flavor the flavor to print. If {@code null}, this constraint is
+     *         not used.
+     * @param  attributes attributes that the print service must support. If
+     *         {@code null} this constraint is not used.
+     * @return list of matching {@code PrintService} objects representing print
+     *         services that support the specified flavor attributes. If no
+     *         services match, the empty list is returned.
+     */
     private static ArrayList<PrintService> getServices(DocFlavor flavor,
                                                        AttributeSet attributes) {
 
@@ -388,7 +419,9 @@
             } catch (Exception e) {
             }
         }
-        /* add any directly registered services */
+        /*
+         * add any directly registered services
+         */
         ArrayList<PrintService> registeredServices = null;
         try {
           SecurityManager security = System.getSecurityManager();
@@ -418,6 +451,18 @@
         return listOfServices;
     }
 
+    /**
+     * Locates {@code MultiDoc} print {@code Services} capable of printing
+     * {@code MultiDocs} containing all the specified doc flavors.
+     *
+     * @param  flavors the flavors to print. If {@code null} or empty this
+     *         constraint is not used. Otherwise return only multidoc print
+     *         services that can print all specified doc flavors.
+     * @param  attributes attributes that the print service must support. If
+     *         {@code null} this constraint is not used.
+     * @return list of matching {@link MultiDocPrintService} objects. If no
+     *         services match, the empty list is returned.
+     */
     private static ArrayList<MultiDocPrintService> getMultiDocServices(DocFlavor[] flavors,
                                                                        AttributeSet attributes) {
 
@@ -438,7 +483,9 @@
             } catch (Exception e) {
             }
         }
-        /* add any directly registered services */
+        /*
+         * add any directly registered services
+         */
         ArrayList<PrintService> registeredServices = null;
         try {
           SecurityManager security = System.getSecurityManager();
@@ -480,5 +527,4 @@
         }
         return listOfServices;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -25,99 +25,93 @@
 
 package javax.print;
 
+import java.awt.Dialog;
+import java.awt.Frame;
 import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
 import java.awt.GraphicsEnvironment;
 import java.awt.HeadlessException;
-import java.awt.Dialog;
-import java.awt.Frame;
-import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.Window;
-import java.awt.KeyboardFocusManager;
+
 import javax.print.attribute.Attribute;
 import javax.print.attribute.AttributeSet;
 import javax.print.attribute.PrintRequestAttributeSet;
 import javax.print.attribute.standard.Destination;
 import javax.print.attribute.standard.Fidelity;
+
 import sun.print.DialogOwner;
-
 import sun.print.ServiceDialog;
 import sun.print.SunAlternateMedia;
 
-/** This class is a collection of UI convenience methods which provide a
+/**
+ * This class is a collection of UI convenience methods which provide a
  * graphical user dialog for browsing print services looked up through the Java
  * Print Service API.
  * <p>
  * The dialogs follow a standard pattern of acting as a continue/cancel option
- *for a user as well as allowing the user to select the print service to use
- *and specify choices such as paper size and number of copies.
+ * for a user as well as allowing the user to select the print service to use
+ * and specify choices such as paper size and number of copies.
  * <p>
  * The dialogs are designed to work with pluggable print services though the
  * public APIs of those print services.
  * <p>
  * If a print service provides any vendor extensions these may be made
- * accessible to the user through a vendor supplied tab panel Component.
+ * accessible to the user through a vendor supplied tab panel {@code Component}.
  * Such a vendor extension is encouraged to use Swing! and to support its
- * accessibility APIs.
- * The vendor extensions should return the settings as part of the
- * AttributeSet.
- * Applications which want to preserve the user settings should use those
- * settings to specify the print job.
- * Note that this class is not referenced by any other part of the Java
- * Print Service and may not be included in profiles which cannot depend
- * on the presence of the AWT packages.
+ * accessibility APIs. The vendor extensions should return the settings as part
+ * of the {@code AttributeSet}. Applications which want to preserve the user
+ * settings should use those settings to specify the print job. Note that this
+ * class is not referenced by any other part of the Java Print Service and may
+ * not be included in profiles which cannot depend on the presence of the AWT
+ * packages.
  */
-
 public class ServiceUI {
 
-
     /**
-     * Presents a dialog to the user for selecting a print service (printer).
-     * It is displayed at the location specified by the application and
-     * is modal.
+     * Presents a dialog to the user for selecting a print service (printer). It
+     * is displayed at the location specified by the application and is modal.
      * If the specification is invalid or would make the dialog not visible it
-     * will be displayed at a location determined by the implementation.
-     * The dialog blocks its calling thread and is application modal.
+     * will be displayed at a location determined by the implementation. The
+     * dialog blocks its calling thread and is application modal.
      * <p>
      * The dialog may include a tab panel with custom UI lazily obtained from
-     * the PrintService's ServiceUIFactory when the PrintService is browsed.
-     * The dialog will attempt to locate a MAIN_UIROLE first as a JComponent,
-     * then as a Panel. If there is no ServiceUIFactory or no matching role
-     * the custom tab will be empty or not visible.
+     * the {@code PrintService}'s {@code ServiceUIFactory} when the
+     * {@code PrintService} is browsed. The dialog will attempt to locate a
+     * {@code MAIN_UIROLE} first as a {@code JComponent}, then as a
+     * {@code Panel}. If there is no {@code ServiceUIFactory} or no matching
+     * role the custom tab will be empty or not visible.
      * <p>
      * The dialog returns the print service selected by the user if the user
-     * OK's the dialog and null if the user cancels the dialog.
+     * OK's the dialog and {@code null} if the user cancels the dialog.
      * <p>
-     * An application must pass in an array of print services to browse.
-     * The array must be non-null and non-empty.
-     * Typically an application will pass in only PrintServices capable
-     * of printing a particular document flavor.
+     * An application must pass in an array of print services to browse. The
+     * array must be {@code non-null} and non-empty. Typically an application
+     * will pass in only {@code PrintServices} capable of printing a particular
+     * document flavor.
      * <p>
-     * An application may pass in a PrintService to be initially displayed.
-     * A non-null parameter must be included in the array of browsable
-     * services.
-     * If this parameter is null a service is chosen by the implementation.
+     * An application may pass in a {@code PrintService} to be initially
+     * displayed. A {@code non-null} parameter must be included in the array of
+     * browsable services. If this parameter is {@code null} a service is chosen
+     * by the implementation.
      * <p>
-     * An application may optionally pass in the flavor to be printed.
-     * If this is non-null choices presented to the user can be better
-     * validated against those supported by the services.
-     * An application must pass in a PrintRequestAttributeSet for returning
-     * user choices.
-     * On calling the PrintRequestAttributeSet may be empty, or may contain
+     * An application may optionally pass in the flavor to be printed. If this
+     * is {@code non-null} choices presented to the user can be better validated
+     * against those supported by the services. An application must pass in a
+     * {@code PrintRequestAttributeSet} for returning user choices. On calling
+     * the {@code PrintRequestAttributeSet} may be empty, or may contain
      * application-specified values.
      * <p>
-     * These are used to set the initial settings for the initially
-     * displayed print service. Values which are not supported by the print
-     * service are ignored. As the user browses print services, attributes
-     * and values are copied to the new display. If a user browses a
-     * print service which does not support a particular attribute-value, the
-     * default for that service is used as the new value to be copied.
+     * These are used to set the initial settings for the initially displayed
+     * print service. Values which are not supported by the print service are
+     * ignored. As the user browses print services, attributes and values are
+     * copied to the new display. If a user browses a print service which does
+     * not support a particular attribute-value, the default for that service is
+     * used as the new value to be copied.
      * <p>
      * If the user cancels the dialog, the returned attributes will not reflect
      * any changes made by the user.
-     *
-     * A typical basic usage of this method may be :
+     * <p>
+     * A typical basic usage of this method may be:
      * <pre>{@code
      * PrintService[] services = PrintServiceLookup.lookupPrintServices(
      *                            DocFlavor.INPUT_STREAM.JPEG, null);
@@ -133,24 +127,25 @@
      * }
      * }</pre>
      *
-     * @param gc used to select screen. null means primary or default screen.
-     * @param x location of dialog including border in screen coordinates
-     * relative to the origin of {@code gc}.
-     * @param y location of dialog including border in screen coordinates
-     * relative to the origin of {@code gc}.
-     * @param services to be browsable, must be non-null.
-     * @param defaultService initial PrintService to display.
-     * @param flavor the flavor to be printed, or null.
-     * @param attributes on input is the initial application supplied
-     * preferences. This cannot be null but may be empty.
-     * On output the attributes reflect changes made by the user.
-     * @return print service selected by the user, or null if the user
-     * cancelled the dialog.
-     * @throws HeadlessException if GraphicsEnvironment.isHeadless()
-     * returns true.
-     * @throws IllegalArgumentException if services is null or empty,
-     * or attributes is null, or the initial PrintService is not in the
-     * list of browsable services.
+     * @param  gc used to select screen, {@code null} means primary or default
+     *         screen
+     * @param  x location of dialog including border in screen coordinates
+     *         relative to the origin of {@code gc}
+     * @param  y location of dialog including border in screen coordinates
+     *         relative to the origin of {@code gc}
+     * @param  services to be browsable, must be {@code non-null}
+     * @param  defaultService initial {@code PrintService} to display
+     * @param  flavor the flavor to be printed, or {@code null}
+     * @param  attributes on input is the initial application supplied
+     *         preferences. This cannot be {@code null} but may be empty. On
+     *         output the attributes reflect changes made by the user.
+     * @return print service selected by the user, or {@code null} if the user
+     *         cancelled the dialog
+     * @throws HeadlessException if {@code GraphicsEnvironment.isHeadless()}
+     *         returns {@code true}
+     * @throws IllegalArgumentException if services is {@code null} or empty, or
+     *         attributes is {@code null}, or the initial {@code PrintService}
+     *         is not in the list of browsable services
      */
     @SuppressWarnings("deprecation")
     public static PrintService printDialog(GraphicsConfiguration gc,
@@ -220,8 +215,8 @@
             // check if dialog exceed window bounds at left or bottom
             // Then position the dialog by moving it by the amount it exceeds
             // the window bounds
-            // If it results in dialog moving beyond the window bounds at top/left
-            // then position it at window top/left
+            // If it results in dialog moving beyond the window bounds at
+            // top/left then position it at window top/left
             if (dlgBounds.x + dlgBounds.width > gcBounds.x + gcBounds.width) {
                 if ((gcBounds.x + gcBounds.width - dlgBounds.width) > gcBounds.x) {
                     x = (gcBounds.x + gcBounds.width) - dlgBounds.width;
@@ -315,8 +310,8 @@
     */
 
     /**
-     * Removes any attributes from the given AttributeSet that are
-     * unsupported by the given PrintService/DocFlavor combination.
+     * Removes any attributes from the given {@code AttributeSet} that are
+     * unsupported by the given {@code PrintService/DocFlavor} combination.
      */
     private static void removeUnsupportedAttributes(PrintService ps,
                                                     DocFlavor flavor,
--- a/jdk/src/java.desktop/share/classes/javax/print/ServiceUIFactory.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/ServiceUIFactory.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -26,21 +26,20 @@
 package javax.print;
 
 /**
- * Services may optionally provide UIs which allow different styles
- * of interaction in different roles.
- * One role may be end-user browsing and setting of print options.
- * Another role may be administering the print service.
+ * Services may optionally provide UIs which allow different styles of
+ * interaction in different roles. One role may be end-user browsing and setting
+ * of print options. Another role may be administering the print service.
  * <p>
  * Although the Print Service API does not presently provide standardised
- * support for administering a print service, monitoring of the print
- * service is possible and a UI may provide for private update mechanisms.
+ * support for administering a print service, monitoring of the print service is
+ * possible and a UI may provide for private update mechanisms.
  * <p>
  * The basic design intent is to allow applications to lazily locate and
- * initialize services only when needed without any API dependencies
- * except in an environment in which they are used.
+ * initialize services only when needed without any API dependencies except in
+ * an environment in which they are used.
  * <p>
- * Swing UIs are preferred as they provide a more consistent {@literal L&F}
- * and can support accessibility APIs.
+ * Swing UIs are preferred as they provide a more consistent {@literal L&F} and
+ * can support accessibility APIs.
  * <p>
  * Example usage:
  * <pre>
@@ -55,34 +54,29 @@
  *  }
  * </pre>
  */
-
 public abstract class ServiceUIFactory {
 
     /**
-     * Denotes a UI implemented as a Swing component.
-     * The value of the String is the fully qualified classname :
-     * "javax.swing.JComponent".
+     * Denotes a UI implemented as a Swing component. The value of the string is
+     * the fully qualified classname : "javax.swing.JComponent".
      */
     public static final String JCOMPONENT_UI = "javax.swing.JComponent";
 
     /**
-     * Denotes a UI implemented as an AWT panel.
-     * The value of the String is the fully qualified classname :
-     * "java.awt.Panel"
+     * Denotes a UI implemented as an AWT panel. The value of the string is the
+     * fully qualified classname : "java.awt.Panel"
      */
     public static final String PANEL_UI = "java.awt.Panel";
 
     /**
-     * Denotes a UI implemented as an AWT dialog.
-     * The value of the String is the fully qualified classname :
-     * "java.awt.Dialog"
+     * Denotes a UI implemented as an AWT dialog. The value of the string is the
+     * fully qualified classname : "java.awt.Dialog"
      */
     public static final String DIALOG_UI = "java.awt.Dialog";
 
     /**
-     * Denotes a UI implemented as a Swing dialog.
-     * The value of the String is the fully qualified classname :
-     * "javax.swing.JDialog"
+     * Denotes a UI implemented as a Swing dialog. The value of the string is
+     * the fully qualified classname : "javax.swing.JDialog"
      */
     public static final String JDIALOG_UI = "javax.swing.JDialog";
 
@@ -102,41 +96,38 @@
     public static final int MAIN_UIROLE = 3;
 
     /**
-     * Not a valid role but role id's greater than this may be used
-     * for private roles supported by a service. Knowledge of the
-     * function performed by this role is required to make proper use
-     * of it.
+     * Not a valid role but role id's greater than this may be used for private
+     * roles supported by a service. Knowledge of the function performed by this
+     * role is required to make proper use of it.
      */
     public static final int RESERVED_UIROLE = 99;
+
     /**
-     * Get a UI object which may be cast to the requested UI type
-     * by the application and used in its user interface.
+     * Get a UI object which may be cast to the requested UI type by the
+     * application and used in its user interface.
      *
-     * @param role requested. Must be one of the standard roles or
-     * a private role supported by this factory.
-     * @param ui type in which the role is requested.
-     * @return the UI role or null if the requested UI role is not available
-     * from this factory
-     * @throws IllegalArgumentException if the role or ui is neither
-     * one of the standard ones, nor a private one
-     * supported by the factory.
+     * @param  role requested. Must be one of the standard roles or a private
+     *         role supported by this factory.
+     * @param  ui type in which the role is requested
+     * @return the UI role or {@code null} if the requested UI role is not
+     *         available from this factory
+     * @throws IllegalArgumentException if the role or ui is neither one of the
+     *         standard ones, nor a private one supported by the factory
      */
     public abstract Object getUI(int role, String ui) ;
 
     /**
-     * Given a UI role obtained from this factory obtain the UI
-     * types available from this factory which implement this role.
-     * The returned Strings should refer to the static variables defined
-     * in this class so that applications can use equality of reference
-     * ("==").
-     * @param role to be looked up.
+     * Given a UI role obtained from this factory obtain the UI types available
+     * from this factory which implement this role. The returned {@code Strings}
+     * should refer to the static variables defined in this class so that
+     * applications can use equality of reference ("==").
+     *
+     * @param  role to be looked up
      * @return the UI types supported by this class for the specified role,
-     * null if no UIs are available for the role.
-     * @throws IllegalArgumentException is the role is a non-standard
-     * role not supported by this factory.
+     *         {@code null} if no UIs are available for the role
+     * @throws IllegalArgumentException is the role is a non-standard role not
+     *         supported by this factory
      */
     public abstract String[] getUIClassNamesForRole(int role) ;
 
-
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/SimpleDoc.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/SimpleDoc.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, 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
@@ -27,60 +27,76 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.CharArrayReader;
-import java.io.StringReader;
+import java.io.IOException;
 import java.io.InputStream;
-import java.io.IOException;
 import java.io.Reader;
+import java.io.StringReader;
+
 import javax.print.attribute.AttributeSetUtilities;
 import javax.print.attribute.DocAttributeSet;
 
 /**
- * This class is an implementation of interface {@code Doc} that can
- * be used in many common printing requests.
- * It can handle all of the presently defined "pre-defined" doc flavors
- * defined as static variables in the DocFlavor class.
+ * This class is an implementation of interface {@code Doc} that can be used in
+ * many common printing requests. It can handle all of the presently defined
+ * "pre-defined" doc flavors defined as static variables in the
+ * {@code DocFlavor} class.
  * <p>
  * In particular this class implements certain required semantics of the
- * Doc specification as follows:
+ * {@code Doc} specification as follows:
  * <ul>
- * <li>constructs a stream for the service if requested and appropriate.
- * <li>ensures the same object is returned for each call on a method.
- * <li>ensures multiple threads can access the Doc
- * <li>performs some validation of that the data matches the doc flavor.
+ *   <li>constructs a stream for the service if requested and appropriate.
+ *   <li>ensures the same object is returned for each call on a method.
+ *   <li>ensures multiple threads can access the {@code Doc}
+ *   <li>performs some validation of that the data matches the doc flavor.
  * </ul>
- * Clients who want to re-use the doc object in other jobs,
- * or need a MultiDoc will not want to use this class.
+ * Clients who want to re-use the doc object in other jobs, or need a
+ * {@code MultiDoc} will not want to use this class.
  * <p>
- * If the print data is a stream, or a print job requests data as a
- * stream, then {@code SimpleDoc} does not monitor if the service
- * properly closes the stream after data transfer completion or job
- * termination.
- * Clients may prefer to use provide their own implementation of doc that
- * adds a listener to monitor job completion and to validate that
- * resources such as streams are freed (ie closed).
+ * If the print data is a stream, or a print job requests data as a stream, then
+ * {@code SimpleDoc} does not monitor if the service properly closes the stream
+ * after data transfer completion or job termination. Clients may prefer to use
+ * provide their own implementation of doc that adds a listener to monitor job
+ * completion and to validate that resources such as streams are freed (ie
+ * closed).
  */
-
 public final class SimpleDoc implements Doc {
 
+    /**
+     * The doc flavor in which this doc will supply its piece of print data.
+     */
     private DocFlavor flavor;
+
+    /**
+     * The set of printing attributes for this doc.
+     */
     private DocAttributeSet attributes;
+
+    /**
+     * The print data.
+     */
     private Object printData;
+
+    /**
+     * The reader for extracting character print data from this doc.
+     */
     private Reader reader;
+
+    /**
+     * The input stream for extracting byte print data from this doc.
+     */
     private InputStream inStream;
 
     /**
-     * Constructs a {@code SimpleDoc} with the specified
-     * print data, doc flavor and doc attribute set.
-     * @param printData the print data object
-     * @param flavor the {@code DocFlavor} object
-     * @param attributes a {@code DocAttributeSet}, which can
-     *                   be {@code null}
-     * @throws IllegalArgumentException if {@code flavor} or
-     *         {@code printData} is {@code null}, or the
-     *         {@code printData} does not correspond
-     *         to the specified doc flavor--for example, the data is
-     *         not of the type specified as the representation in the
-     *         {@code DocFlavor}.
+     * Constructs a {@code SimpleDoc} with the specified print data, doc flavor
+     * and doc attribute set.
+     *
+     * @param  printData the print data object
+     * @param  flavor the {@code DocFlavor} object
+     * @param  attributes a {@code DocAttributeSet}, which can be {@code null}
+     * @throws IllegalArgumentException if {@code flavor} or {@code printData}
+     *         is {@code null}, or the {@code printData} does not correspond to
+     *         the specified doc flavor--for example, the data is not of the
+     *         type specified as the representation in the {@code DocFlavor}
      */
     public SimpleDoc(Object printData,
                      DocFlavor flavor, DocAttributeSet attributes) {
@@ -110,11 +126,11 @@
        this.printData = printData;
     }
 
-   /**
-     * Determines the doc flavor in which this doc object will supply its
-     * piece of print data.
+    /**
+     * Determines the doc flavor in which this doc object will supply its piece
+     * of print data.
      *
-     * @return  Doc flavor.
+     * @return doc flavor
      */
     public DocFlavor getDocFlavor() {
         return flavor;
@@ -123,67 +139,60 @@
     /**
      * Obtains the set of printing attributes for this doc object. If the
      * returned attribute set includes an instance of a particular attribute
-     * <I>X,</I> the printer must use that attribute value for this doc,
-     * overriding any value of attribute <I>X</I> in the job's attribute set.
-     * If the returned attribute set does not include an instance
-     * of a particular attribute <I>X</I> or if null is returned, the printer
-     * must consult the job's attribute set to obtain the value for
-     * attribute <I>X,</I> and if not found there, the printer must use an
+     * <i>X,</i> the printer must use that attribute value for this doc,
+     * overriding any value of attribute <i>X</i> in the job's attribute set. If
+     * the returned attribute set does not include an instance of a particular
+     * attribute <i>X</i> or if {@code null} is returned, the printer must
+     * consult the job's attribute set to obtain the value for attribute
+     * <i>X,</i> and if not found there, the printer must use an
      * implementation-dependent default value. The returned attribute set is
      * unmodifiable.
      *
-     * @return  Unmodifiable set of printing attributes for this doc, or null
-     *          to obtain all attribute values from the job's attribute
-     *          set.
+     * @return unmodifiable set of printing attributes for this doc, or
+     *         {@code null} to obtain all attribute values from the job's
+     *         attribute set
      */
     public DocAttributeSet getAttributes() {
         return attributes;
     }
 
-    /*
+    /**
      * Obtains the print data representation object that contains this doc
-     * object's piece of print data in the format corresponding to the
-     * supported doc flavor.
-     * The {@code getPrintData()} method returns an instance of
-     * the representation class whose name is given by
-     * {@link DocFlavor#getRepresentationClassName() getRepresentationClassName},
-     * and the return value can be cast
-     * from class Object to that representation class.
+     * object's piece of print data in the format corresponding to the supported
+     * doc flavor. The {@code getPrintData()} method returns an instance of the
+     * representation class whose name is given by {@link #getDocFlavor()
+     * getDocFlavor()}.{@link DocFlavor#getRepresentationClassName()
+     * getRepresentationClassName()}, and the return value can be cast from
+     * class {@code Object} to that representation class.
      *
-     * @return  Print data representation object.
-     *
-     * @exception  IOException if the representation class is a stream and
-     *     there was an I/O error while constructing the stream.
+     * @return print data representation object
+     * @throws IOException if the representation class is a stream and there was
+     *         an I/O error while constructing the stream
      */
     public Object getPrintData() throws IOException {
         return printData;
     }
 
     /**
-     * Obtains a reader for extracting character print data from this doc.
-     * The {@code Doc} implementation is required to support this
-     * method if the {@code DocFlavor} has one of the following print
-     * data representation classes, and return {@code null}
-     * otherwise:
-     * <UL>
-     * <LI> {@code char[]}
-     * <LI> {@code java.lang.String}
-     * <LI> {@code java.io.Reader}
-     * </UL>
+     * Obtains a reader for extracting character print data from this doc. The
+     * {@code Doc} implementation is required to support this method if the
+     * {@code DocFlavor} has one of the following print data representation
+     * classes, and return {@code null} otherwise:
+     * <ul>
+     *   <li>{@code char[]}
+     *   <li>{@code java.lang.String}
+     *   <li>{@code java.io.Reader}
+     * </ul>
      * The doc's print data representation object is used to construct and
-     * return a {@code Reader} for reading the print data as a stream
-     * of characters from the print data representation object.
-     * However, if the print data representation object is itself a
-     * {@code Reader} then the print data representation object is
-     * simply returned.
+     * return a {@code Reader} for reading the print data as a stream of
+     * characters from the print data representation object. However, if the
+     * print data representation object is itself a {@code Reader} then the
+     * print data representation object is simply returned.
      *
-     * @return  a {@code Reader} for reading the print data
-     *          characters from this doc.
-     *          If a reader cannot be provided because this doc does not meet
-     *          the criteria stated above, {@code null} is returned.
-     *
-     * @exception  IOException if there was an I/O error while creating
-     *             the reader.
+     * @return a {@code Reader} for reading the print data characters from this
+     *         doc. If a reader cannot be provided because this doc does not
+     *         meet the criteria stated above, {@code null} is returned.
+     * @throws IOException if there was an I/O error while creating the reader
      */
     public Reader getReaderForText() throws IOException {
 
@@ -207,31 +216,25 @@
     }
 
     /**
-     * Obtains an input stream for extracting byte print data from
-     * this doc.
-     * The {@code Doc} implementation is required to support this
-     * method if the {@code DocFlavor} has one of the following print
-     * data representation classes; otherwise this method
-     * returns {@code null}:
-     * <UL>
-     * <LI> {@code byte[]}
-     * <LI> {@code java.io.InputStream}
-     * </UL>
-     * The doc's print data representation object is obtained.  Then, an
-     * input stream for reading the print data
-     * from the print data representation object as a stream of bytes is
-     * created and returned.
-     * However, if the print data representation object is itself an
-     * input stream then the print data representation object is simply
-     * returned.
+     * Obtains an input stream for extracting byte print data from this doc. The
+     * {@code Doc} implementation is required to support this method if the
+     * {@code DocFlavor} has one of the following print data representation
+     * classes; otherwise this method returns {@code null}:
+     * <ul>
+     *   <li>{@code byte[]}
+     *   <li>{@code java.io.InputStream}
+     * </ul>
+     * The doc's print data representation object is obtained. Then, an input
+     * stream for reading the print data from the print data representation
+     * object as a stream of bytes is created and returned. However, if the
+     * print data representation object is itself an input stream then the print
+     * data representation object is simply returned.
      *
-     * @return  an {@code InputStream} for reading the print data
-     *          bytes from this doc.  If an input stream cannot be
-     *          provided because this doc does not meet
-     *          the criteria stated above, {@code null} is returned.
-     *
-     * @exception  IOException
-     *     if there was an I/O error while creating the input stream.
+     * @return an {@code InputStream} for reading the print data bytes from this
+     *         doc. If an input stream cannot be provided because this doc does
+     *         not meet the criteria stated above, {@code null} is returned.
+     * @throws IOException if there was an I/O error while creating the input
+     *         stream
      */
     public InputStream getStreamForBytes() throws IOException {
 
@@ -250,5 +253,4 @@
         }
         return inStream;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/StreamPrintService.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/StreamPrintService.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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,43 +28,47 @@
 import java.io.OutputStream;
 
 /**
- * This class extends {@link PrintService} and represents a
- * print service that prints data in different formats to a
- * client-provided output stream.
- * This is principally intended for services where
- * the output format is a document type suitable for viewing
- * or archiving.
- * The output format must be declared as a mime type.
- * This is equivalent to an output document flavor where the
- * representation class is always "java.io.OutputStream"
- * An instance of the {@code StreamPrintService} class is
- * obtained from a {@link StreamPrintServiceFactory} instance.
+ * This class extends {@link PrintService} and represents a print service that
+ * prints data in different formats to a client-provided output stream. This is
+ * principally intended for services where the output format is a document type
+ * suitable for viewing or archiving. The output format must be declared as a
+ * mime type. This is equivalent to an output document flavor where the
+ * representation class is always "java.io.OutputStream" An instance of the
+ * {@code StreamPrintService} class is obtained from a
+ * {@link StreamPrintServiceFactory} instance.
  * <p>
  * Note that a {@code StreamPrintService} is different from a
  * {@code PrintService}, which supports a
- * {@link javax.print.attribute.standard.Destination Destination}
- * attribute.  A {@code StreamPrintService} always requires an output
- * stream, whereas a {@code PrintService} optionally accepts a
- * {@code Destination}. A {@code StreamPrintService}
- * has no default destination for its formatted output.
- * Additionally a {@code StreamPrintService} is expected to generate
-output in
- * a format useful in other contexts.
- * StreamPrintService's are not expected to support the Destination attribute.
+ * {@link javax.print.attribute.standard.Destination Destination} attribute. A
+ * {@code StreamPrintService} always requires an output stream, whereas a
+ * {@code PrintService} optionally accepts a {@code Destination}. A
+ * {@code StreamPrintService} has no default destination for its formatted
+ * output. Additionally a {@code StreamPrintService} is expected to generate
+ * output in a format useful in other contexts. {@code StreamPrintService}'s are
+ * not expected to support the {@code Destination} attribute.
  */
-
 public abstract class StreamPrintService implements PrintService {
 
+    /**
+     * The output stream to which this service will send formatted print data.
+     */
     private OutputStream outStream;
+
+    /**
+     * Whether or not this {@code StreamPrintService} has been disposed.
+     */
     private boolean disposed = false;
 
+    /**
+     * Constructs a {@code StreamPrintService} object.
+     */
     private StreamPrintService() {
     };
 
     /**
-     * Constructs a StreamPrintService object.
+     * Constructs a {@code StreamPrintService} object.
      *
-     * @param out  stream to which to send formatted print data.
+     * @param  out stream to which to send formatted print data
      */
     protected StreamPrintService(OutputStream out) {
         this.outStream = out;
@@ -73,42 +77,44 @@
     /**
      * Gets the output stream.
      *
-     * @return the stream to which this service will send formatted print data.
+     * @return the stream to which this service will send formatted print data
      */
     public OutputStream getOutputStream() {
         return outStream;
     }
 
     /**
-     * Returns the document format emitted by this print service.
-     * Must be in mimetype format, compatible with the mime type
-     * components of DocFlavors @see DocFlavor.
-     * @return mime type identifying the output format.
+     * Returns the document format emitted by this print service. Must be in
+     * mimetype format, compatible with the mime type components of
+     * {@code DocFlavors}
+     *
+     * @return mime type identifying the output format
+     * @see DocFlavor
      */
     public abstract String getOutputFormat();
 
     /**
-     * Disposes this {@code StreamPrintService}.
-     * If a stream service cannot be re-used, it must be disposed
-     * to indicate this. Typically the client will call this method.
-     * Services which write data which cannot meaningfully be appended to
-     * may also dispose the stream. This does not close the stream. It
-     * just marks it as not for further use by this service.
+     * Disposes this {@code StreamPrintService}. If a stream service cannot be
+     * re-used, it must be disposed to indicate this. Typically the client will
+     * call this method. Services which write data which cannot meaningfully be
+     * appended to may also dispose the stream. This does not close the stream.
+     * It just marks it as not for further use by this service.
      */
     public void dispose() {
         disposed = true;
     }
 
     /**
-     * Returns a {@code boolean} indicating whether or not
-     * this {@code StreamPrintService} has been disposed.
-     * If this object has been disposed, will return true.
-     * Used by services and client applications to recognize streams
-     * to which no further data should be written.
-     * @return if this {@code StreamPrintService} has been disposed
+     * Returns a {@code boolean} indicating whether or not this
+     * {@code StreamPrintService} has been disposed. If this object has been
+     * disposed, will return {@code true}. Used by services and client
+     * applications to recognize streams to which no further data should be
+     * written.
+     *
+     * @return {@code true} if this {@code StreamPrintService} has been
+     *         disposed; {@code false} otherwise
      */
     public boolean isDisposed() {
         return disposed;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java	Sat Sep 09 14:36:45 2017 +0200
@@ -26,40 +26,48 @@
 package javax.print;
 
 import java.io.OutputStream;
-
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
 
-import javax.print.DocFlavor;
+import javax.print.attribute.PrintRequestAttributeSet;
 
 import sun.awt.AppContext;
-import java.util.ServiceLoader;
-import java.util.ServiceConfigurationError;
 
 /**
  * A {@code StreamPrintServiceFactory} is the factory for
- * {@link StreamPrintService} instances,
- * which can print to an output stream in a particular
- * document format described as a mime type.
- * A typical output document format may be Postscript(TM).
+ * {@link StreamPrintService} instances, which can print to an output stream in
+ * a particular document format described as a mime type. A typical output
+ * document format may be Postscript(TM).
  * <p>
- * This class is implemented by a service and located by the
- * implementation using the {@link java.util.ServiceLoader} facility.
+ * This class is implemented by a service and located by the implementation
+ * using the {@link ServiceLoader} facility.
  * <p>
  * Applications locate instances of this class by calling the
  * {@link #lookupStreamPrintServiceFactories(DocFlavor, String)} method.
  * <p>
- * Applications can use a {@code StreamPrintService} obtained from a
- * factory in place of a {@code PrintService} which represents a
- * physical printer device.
+ * Applications can use a {@code StreamPrintService} obtained from a factory in
+ * place of a {@code PrintService} which represents a physical printer device.
  */
-
 public abstract class StreamPrintServiceFactory {
 
+    /**
+     * Contains a list of factories.
+     */
     static class Services {
+
+        /**
+         * The list of factories which will be stored per appcontext.
+         */
         private ArrayList<StreamPrintServiceFactory> listOfFactories = null;
     }
 
+    /**
+     * Returns the services from the current appcontext.
+     *
+     * @return the services
+     */
     private static Services getServices() {
         Services services =
             (Services)AppContext.getAppContext().get(Services.class);
@@ -70,10 +78,20 @@
         return services;
     }
 
+    /**
+     * Returns the list of factories.
+     *
+     * @return the list of factories
+     */
     private static ArrayList<StreamPrintServiceFactory> getListOfFactories() {
         return getServices().listOfFactories;
     }
 
+    /**
+     * Initialize the list of factories.
+     *
+     * @return the list of factories
+     */
     private static ArrayList<StreamPrintServiceFactory> initListOfFactories() {
         ArrayList<StreamPrintServiceFactory> listOfFactories = new ArrayList<>();
         getServices().listOfFactories = listOfFactories;
@@ -81,26 +99,26 @@
     }
 
     /**
-     * Locates factories for print services that can be used with
-     * a print job to output a stream of data in the
-     * format specified by {@code outputMimeType}.
+     * Locates factories for print services that can be used with a print job to
+     * output a stream of data in the format specified by
+     * {@code outputMimeType}.
      * <p>
-     * The {@code outputMimeType} parameter describes the document type that
-     * you want to create, whereas the {@code flavor} parameter describes the
-     * format in which the input data will be provided by the application
-     * to the {@code StreamPrintService}.
+     * The {@code outputMimeType} parameter describes the document type that you
+     * want to create, whereas the {@code flavor} parameter describes the format
+     * in which the input data will be provided by the application to the
+     * {@code StreamPrintService}.
      * <p>
-     * Although null is an acceptable value to use in the lookup of stream
-     * printing services, it's typical to search for a particular
-     * desired format, such as Postscript(TM).
+     * Although {@code null} is an acceptable value to use in the lookup of
+     * stream printing services, it's typical to search for a particular desired
+     * format, such as Postscript(TM).
      *
-     * @param flavor of the input document type - null means match all
-     * types.
-     * @param outputMimeType representing the required output format, used to
-     * identify suitable stream printer factories. A value of null means
-     * match all formats.
-     * @return   matching factories for stream print service instance,
-     *           empty if no suitable factories could be located.
+     * @param  flavor of the input document type - {@code null} means match all
+     *         types
+     * @param  outputMimeType representing the required output format, used to
+     *         identify suitable stream printer factories. A value of
+     *         {@code null} means match all formats.
+     * @return matching factories for stream print service instance, empty if no
+     *         suitable factories could be located
      */
      public static StreamPrintServiceFactory[]
          lookupStreamPrintServiceFactories(DocFlavor flavor,
@@ -110,55 +128,56 @@
          return list.toArray(new StreamPrintServiceFactory[list.size()]);
      }
 
-    /** Queries the factory for the document format that is emitted
-     * by printers obtained from this factory.
+    /**
+     * Queries the factory for the document format that is emitted by printers
+     * obtained from this factory.
      *
-     * @return the output format described as a mime type.
+     * @return the output format described as a mime type
      */
     public abstract String getOutputFormat();
 
     /**
-     * Queries the factory for the document flavors that can be accepted
-     * by printers obtained from this factory.
-     * @return array of supported doc flavors.
+     * Queries the factory for the document flavors that can be accepted by
+     * printers obtained from this factory.
+     *
+     * @return array of supported doc flavors
      */
     public abstract DocFlavor[] getSupportedDocFlavors();
 
     /**
-     * Returns a {@code StreamPrintService} that can print to
-     * the specified output stream.
-     * The output stream is created and managed by the application.
-     * It is the application's responsibility to close the stream and
-     * to ensure that this Printer is not reused.
-     * The application should not close this stream until any print job
-     * created from the printer is complete. Doing so earlier may generate
-     * a {@code PrinterException} and an event indicating that the
-     * job failed.
+     * Returns a {@code StreamPrintService} that can print to the specified
+     * output stream. The output stream is created and managed by the
+     * application. It is the application's responsibility to close the stream
+     * and to ensure that this {@code Printer} is not reused. The application
+     * should not close this stream until any print job created from the printer
+     * is complete. Doing so earlier may generate a {@code PrinterException} and
+     * an event indicating that the job failed.
      * <p>
-     * Whereas a {@code PrintService} connected to a physical printer
-     * can be reused,
-     * a {@code StreamPrintService} connected to a stream cannot.
-     * The underlying {@code StreamPrintService} may be disposed by
-     * the print system with
-     * the {@link StreamPrintService#dispose() dispose} method
-     * before returning from the
-     * {@link DocPrintJob#print(Doc, javax.print.attribute.PrintRequestAttributeSet) print}
-     * method of {@code DocPrintJob} so that the print system knows
-     * this printer is no longer usable.
-     * This is equivalent to a physical printer going offline - permanently.
-     * Applications may supply a null print stream to create a queryable
-     * service. It is not valid to create a PrintJob for such a stream.
-     * Implementations which allocate resources on construction should examine
-     * the stream and may wish to only allocate resources if the stream is
-     * non-null.
+     * Whereas a {@code PrintService} connected to a physical printer can be
+     * reused, a {@code StreamPrintService} connected to a stream cannot. The
+     * underlying {@code StreamPrintService} may be disposed by the print system
+     * with the {@link StreamPrintService#dispose() dispose} method before
+     * returning from the
+     * {@link DocPrintJob#print(Doc, PrintRequestAttributeSet) print} method of
+     * {@code DocPrintJob} so that the print system knows this printer is no
+     * longer usable. This is equivalent to a physical printer going offline -
+     * permanently. Applications may supply a {@code null} print stream to
+     * create a queryable service. It is not valid to create a {@code PrintJob}
+     * for such a stream. Implementations which allocate resources on
+     * construction should examine the stream and may wish to only allocate
+     * resources if the stream is {@code non-null}.
      *
-     * @param out destination stream for generated output.
-     * @return a PrintService which will generate the format specified by the
-     * DocFlavor supported by this Factory.
+     * @param  out destination stream for generated output
+     * @return a {@code PrintService} which will generate the format specified
+     *         by the {@code DocFlavor} supported by this factory
      */
     public abstract StreamPrintService getPrintService(OutputStream out);
 
-
+    /**
+     * Returns all factories for print services.
+     *
+     * @return all factories
+     */
     private static ArrayList<StreamPrintServiceFactory> getAllFactories() {
         synchronized (StreamPrintServiceFactory.class) {
 
@@ -198,6 +217,15 @@
         }
     }
 
+    /**
+     * Checks if the array of {@code flavors} contains the {@code flavor}
+     * object.
+     *
+     * @param  flavor the flavor
+     * @param  flavors the array of flavors
+     * @return {@code true} if {@code flavors} contains the {@code flavor}
+     *         object; {@code false} otherwise
+     */
     private static boolean isMember(DocFlavor flavor, DocFlavor[] flavors) {
         for (int f=0; f<flavors.length; f++ ) {
             if (flavor.equals(flavors[f])) {
@@ -207,6 +235,21 @@
         return false;
     }
 
+    /**
+     * Utility method for {@link #lookupStreamPrintServiceFactories}.
+     * <p>
+     * Locates factories for print services that can be used with a print job to
+     * output a stream of data in the format specified by
+     * {@code outputMimeType}.
+     *
+     * @param  flavor of the input document type - {@code null} means match all
+     *         types
+     * @param  outType representing the required output format, used to identify
+     *         suitable stream printer factories. A value of {@code null} means
+     *         match all formats.
+     * @return matching factories for stream print service instance, empty if no
+     *         suitable factories could be located
+     */
     private static ArrayList<StreamPrintServiceFactory> getFactories(DocFlavor flavor, String outType) {
 
         if (flavor == null && outType == null) {
@@ -227,5 +270,4 @@
 
         return list;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/URIException.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/URIException.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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,46 +28,45 @@
 import java.net.URI;
 
 /**
- * Interface URIException is a mixin interface which a subclass of {@link
- * PrintException PrintException} can implement to report an error condition
- * involving a URI address. The Print Service API does not define any print
- * exception classes that implement interface URIException, that being left to
- * the Print Service implementor's discretion.
- *
+ * Interface {@code URIException} is a mixin interface which a subclass of
+ * {@link PrintException PrintException} can implement to report an error
+ * condition involving a {@code URI} address. The Print Service API does not
+ * define any print exception classes that implement interface
+ * {@code URIException}, that being left to the Print Service implementor's
+ * discretion.
  */
-
 public interface URIException {
 
     /**
-     * Indicates that the printer cannot access the URI address.
-     * For example, the printer might report this error if it goes to get
-     * the print data and cannot even establish a connection to the
-     * URI address.
+     * Indicates that the printer cannot access the {@code URI} address. For
+     * example, the printer might report this error if it goes to get the print
+     * data and cannot even establish a connection to the {@code URI} address.
      */
     public static final int URIInaccessible = 1;
 
     /**
-     * Indicates that the printer does not support the URI
-     * scheme ("http", "ftp", etc.) in the URI address.
+     * Indicates that the printer does not support the {@code URI} scheme
+     * ("http", "ftp", etc.) in the {@code URI} address.
      */
     public static final int URISchemeNotSupported = 2;
 
     /**
-     * Indicates any kind of problem not specifically identified
-     * by the other reasons.
+     * Indicates any kind of problem not specifically identified by the other
+     * reasons.
      */
     public static final int URIOtherProblem = -1;
 
     /**
-     * Return the URI.
-     * @return the URI that is the cause of this exception.
+     * Returns the {@code URI}.
+     *
+     * @return the {@code URI} that is the cause of this exception
      */
     public URI getUnsupportedURI();
 
     /**
-     * Return the reason for the event.
-     * @return one of the predefined reasons enumerated in this interface.
+     * Returns the reason of this exception.
+     *
+     * @return one of the predefined reasons enumerated in this interface
      */
     public int getReason();
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/Attribute.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/Attribute.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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,35 +28,34 @@
 import java.io.Serializable;
 
 /**
- * Interface Attribute is the base interface implemented by any and every
- * printing attribute class to indicate that the class represents a
+ * Interface {@code Attribute} is the base interface implemented by any and
+ * every printing attribute class to indicate that the class represents a
  * printing attribute. All printing attributes are serializable.
  *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
  */
 public interface Attribute extends Serializable {
 
-  /**
-   * Get the printing attribute class which is to be used as the "category"
-   * for this printing attribute value when it is added to an attribute set.
-   *
-   * @return  Printing attribute class (category), an instance of class
-   *          {@link java.lang.Class java.lang.Class}.
-   */
-  public Class<? extends Attribute> getCategory();
+    /**
+     * Get the printing attribute class which is to be used as the "category"
+     * for this printing attribute value when it is added to an attribute set.
+     *
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
+     */
+    public Class<? extends Attribute> getCategory();
 
-  /**
-   * Get the name of the category of which this attribute value is an
-   * instance.
-   * <P>
-   * <I>Note:</I> This method is intended to provide a default, nonlocalized
-   * string for the attribute's category. If two attribute objects return the
-   * same category from the {@code getCategory()} method, they should
-   * return the same name from the {@code getName()} method.
-   *
-   * @return  Attribute category name.
-   */
-  public String getName();
-
+    /**
+     * Get the name of the category of which this attribute value is an
+     * instance.
+     * <p>
+     * <i>Note:</i> This method is intended to provide a default, nonlocalized
+     * string for the attribute's category. If two attribute objects return the
+     * same category from the {@code getCategory()} method, they should return
+     * the same name from the {@code getName()} method.
+     *
+     * @return attribute category name
+     */
+    public String getName();
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -26,284 +26,240 @@
 package javax.print.attribute;
 
 /**
- * Interface AttributeSet specifies the interface for a set of printing
+ * Interface {@code AttributeSet} specifies the interface for a set of printing
  * attributes. A printing attribute is an object whose class implements
  * interface {@link Attribute Attribute}.
- * <P>
- * An attribute set contains a group of <I>attribute values,</I>
- * where duplicate values are not allowed in the set.
- * Furthermore, each value in an attribute set is
- * a member of some <I>category,</I> and at most one value in any particular
- * category is allowed in the set. For an attribute set, the values are {@link
- * Attribute Attribute} objects, and the categories are {@link java.lang.Class
- * Class} objects. An attribute's category is the class (or interface) at the
- * root of the class hierarchy for that kind of attribute. Note that an
- * attribute object's category may be a superclass of the attribute object's
- * class rather than the attribute object's class itself. An attribute
- * object's
- * category is determined by calling the {@link Attribute#getCategory()
- * getCategory()} method defined in interface {@link Attribute
- * Attribute}.
- * <P>
- * The interfaces of an AttributeSet resemble those of the Java Collections
- * API's java.util.Map interface, but is more restrictive in the types
- * it will accept, and combines keys and values into an Attribute.
- * <P>
- * Attribute sets are used in several places in the Print Service API. In
- * each context, only certain kinds of attributes are allowed to appear in the
+ * <p>
+ * An attribute set contains a group of <i>attribute values,</i> where duplicate
+ * values are not allowed in the set. Furthermore, each value in an attribute
+ * set is a member of some <i>category,</i> and at most one value in any
+ * particular category is allowed in the set. For an attribute set, the values
+ * are {@link Attribute Attribute} objects, and the categories are
+ * {@link Class Class} objects. An attribute's category is the class (or
+ * interface) at the root of the class hierarchy for that kind of attribute.
+ * Note that an attribute object's category may be a superclass of the attribute
+ * object's class rather than the attribute object's class itself. An attribute
+ * object's category is determined by calling the
+ * {@link Attribute#getCategory() getCategory()} method defined in interface
+ * {@link Attribute Attribute}.
+ * <p>
+ * The interfaces of an {@code AttributeSet} resemble those of the Java
+ * Collections API's {@code java.util.Map} interface, but is more restrictive in
+ * the types it will accept, and combines keys and values into an
+ * {@code Attribute}.
+ * <p>
+ * Attribute sets are used in several places in the Print Service API. In each
+ * context, only certain kinds of attributes are allowed to appear in the
  * attribute set, as determined by the tagging interfaces which the attribute
- * class implements -- {@link DocAttribute DocAttribute}, {@link
- * PrintRequestAttribute PrintRequestAttribute}, {@link PrintJobAttribute
- * PrintJobAttribute}, and {@link PrintServiceAttribute
- * PrintServiceAttribute}.
+ * class implements -- {@link DocAttribute DocAttribute},
+ * {@link PrintRequestAttribute PrintRequestAttribute},
+ * {@link PrintJobAttribute PrintJobAttribute}, and
+ * {@link PrintServiceAttribute PrintServiceAttribute}.
  * There are four specializations of an attribute set that are restricted to
- * contain just one of the four kinds of attribute -- {@link DocAttributeSet
- * DocAttributeSet}, {@link PrintRequestAttributeSet
- * PrintRequestAttributeSet},
- * {@link PrintJobAttributeSet PrintJobAttributeSet}, and {@link
- * PrintServiceAttributeSet PrintServiceAttributeSet}, respectively. Note that
- * many attribute classes implement more than one tagging interface and so may
- * appear in more than one context.
- * <UL>
- * <LI>
- * A {@link DocAttributeSet DocAttributeSet}, containing {@link DocAttribute
- * DocAttribute}s, specifies the characteristics of an individual doc and the
- * print job settings to be applied to an individual doc.
- *
- * <LI>
- * A {@link PrintRequestAttributeSet PrintRequestAttributeSet}, containing
- * {@link PrintRequestAttribute PrintRequestAttribute}s, specifies the
- * settings
- * to be applied to a whole print job and to all the docs in the print job.
- *
- * <LI>
- * A {@link PrintJobAttributeSet PrintJobAttributeSet}, containing {@link
- * PrintJobAttribute PrintJobAttribute}s, reports the status of a print job.
- *
- * <LI>
- * A {@link PrintServiceAttributeSet PrintServiceAttributeSet}, containing
- * {@link PrintServiceAttribute PrintServiceAttribute}s, reports the status of
- *  a Print Service instance.
- * </UL>
- * <P>
+ * contain just one of the four kinds of attribute --
+ * {@link DocAttributeSet DocAttributeSet},
+ * {@link PrintRequestAttributeSet PrintRequestAttributeSet},
+ * {@link PrintJobAttributeSet PrintJobAttributeSet}, and
+ * {@link PrintServiceAttributeSet PrintServiceAttributeSet}, respectively. Note
+ * that many attribute classes implement more than one tagging interface and so
+ * may appear in more than one context.
+ * <ul>
+ *   <li>A {@link DocAttributeSet DocAttributeSet}, containing
+ *   {@link DocAttribute DocAttribute}s, specifies the characteristics of an
+ *   individual doc and the print job settings to be applied to an individual
+ *   doc.
+ *   <li>A {@link PrintRequestAttributeSet PrintRequestAttributeSet}, containing
+ *   {@link PrintRequestAttribute PrintRequestAttribute}s, specifies the
+ *   settings to be applied to a whole print job and to all the docs in the
+ *   print job.
+ *   <li>A {@link PrintJobAttributeSet PrintJobAttributeSet}, containing
+ *   {@link PrintJobAttribute PrintJobAttribute}s, reports the status of a print
+ *   job.
+ *   <li>A {@link PrintServiceAttributeSet PrintServiceAttributeSet}, containing
+ *   {@link PrintServiceAttribute PrintServiceAttribute}s, reports the status of
+ *   a Print Service instance.
+ * </ul>
  * In some contexts, the client is only allowed to examine an attribute set's
  * contents but not change them (the set is read-only). In other places, the
  * client is allowed both to examine and to change an attribute set's contents
  * (the set is read-write). For a read-only attribute set, calling a mutating
- * operation throws an UnmodifiableSetException.
- * <P>
+ * operation throws an {@code UnmodifiableSetException}.
+ * <p>
  * The Print Service API provides one implementation of interface
- * AttributeSet, class {@link HashAttributeSet HashAttributeSet}.
- * A client can use class {@link
- * HashAttributeSet HashAttributeSet} or provide its own implementation of
- * interface AttributeSet. The Print Service API also provides
- * implementations of interface AttributeSet's subinterfaces -- classes {@link
- * HashDocAttributeSet HashDocAttributeSet},
- * {@link HashPrintRequestAttributeSet
- * HashPrintRequestAttributeSet}, {@link HashPrintJobAttributeSet
- * HashPrintJobAttributeSet}, and {@link HashPrintServiceAttributeSet
- * HashPrintServiceAttributeSet}.
+ * {@code AttributeSet}, class {@link HashAttributeSet HashAttributeSet}. A
+ * client can use class {@link HashAttributeSet HashAttributeSet} or provide its
+ * own implementation of interface {@code AttributeSet}. The Print Service API
+ * also provides implementations of interface {@code AttributeSet}'s
+ * subinterfaces -- classes
+ * {@link HashDocAttributeSet HashDocAttributeSet},
+ * {@link HashPrintRequestAttributeSet HashPrintRequestAttributeSet},
+ * {@link HashPrintJobAttributeSet HashPrintJobAttributeSet}, and
+ * {@link HashPrintServiceAttributeSet HashPrintServiceAttributeSet}.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public interface AttributeSet {
 
-
     /**
      * Returns the attribute value which this attribute set contains in the
-     * given attribute category. Returns {@code null} if this attribute set
-     * does not contain any attribute value in the given attribute category.
-     *
-     * @param  category  Attribute category whose associated attribute value
-     *                   is to be returned. It must be a
-     *                   {@link java.lang.Class Class}
-     *                   that implements interface {@link Attribute
-     *                   Attribute}.
+     * given attribute category. Returns {@code null} if this attribute set does
+     * not contain any attribute value in the given attribute category.
      *
-     * @return  The attribute value in the given attribute category contained
-     *          in this attribute set, or {@code null} if this attribute set
-     *          does not contain any attribute value in the given attribute
-     *          category.
-     *
-     * @throws  NullPointerException
-     *     (unchecked exception) Thrown if the {@code category} is null.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if the {@code category} is not a
-     *     {@link java.lang.Class Class} that implements interface {@link
-     *     Attribute Attribute}.
+     * @param  category attribute category whose associated attribute value is
+     *         to be returned. It must be a {@link Class Class} that implements
+     *         interface {@link Attribute Attribute}.
+     * @return the attribute value in the given attribute category contained in
+     *         this attribute set, or {@code null} if this attribute set does
+     *         not contain any attribute value in the given attribute category
+     * @throws NullPointerException if the {@code category} is {@code null}
+     * @throws ClassCastException if the {@code category} is not a
+     *         {@link Class Class} that implements interface
+     *         {@link Attribute Attribute}
      */
     public Attribute get(Class<?> category);
 
     /**
-     * Adds the specified attribute to this attribute set if it is not
-     * already present, first removing any existing value in the same
-     * attribute category as the specified attribute value.
-     *
-     * @param  attribute  Attribute value to be added to this attribute set.
+     * Adds the specified attribute to this attribute set if it is not already
+     * present, first removing any existing value in the same attribute category
+     * as the specified attribute value.
      *
-     * @return  {@code true} if this attribute set changed as a result of the
-     *          call, i.e., the given attribute value was not already a member
-     *          of this attribute set.
-     *
-     * @throws  NullPointerException
-     *     (unchecked exception) Thrown if the {@code attribute} is null.
-     * @throws  UnmodifiableSetException
-     *     (unchecked exception) Thrown if this attribute set does not support
-     *     the {@code add()} operation.
+     * @param  attribute attribute value to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call, i.e., the given attribute value was not already a member of
+     *         this attribute set
+     * @throws NullPointerException if the {@code attribute} is {@code null}
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code add()} operation
      */
     public boolean add(Attribute attribute);
 
-
     /**
      * Removes any attribute for this category from this attribute set if
-     * present. If {@code category} is null, then
-     * {@code remove()} does nothing and returns {@code false}.
-     *
-     * @param  category Attribute category to be removed from this
-     *                  attribute set.
+     * present. If {@code category} is {@code null}, then {@code remove()} does
+     * nothing and returns {@code false}.
      *
-     * @return  {@code true} if this attribute set changed as a result of the
+     * @param  category attribute category to be removed from this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
      *         call, i.e., the given attribute value had been a member of this
-     *          attribute set.
-     *
-     * @throws  UnmodifiableSetException
-     *     (unchecked exception) Thrown if this attribute set does not support
-     *     the {@code remove()} operation.
+     *         attribute set
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code remove()} operation
      */
     public boolean remove(Class<?> category);
 
     /**
-     * Removes the specified attribute from this attribute set if
-     * present. If {@code attribute} is null, then
-     * {@code remove()} does nothing and returns {@code false}.
-     *
-     * @param  attribute Attribute value to be removed from this attribute set.
+     * Removes the specified attribute from this attribute set if present. If
+     * {@code attribute} is {@code null}, then {@code remove()} does nothing and
+     * returns {@code false}.
      *
-     * @return  {@code true} if this attribute set changed as a result of the
+     * @param  attribute attribute value to be removed from this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
      *         call, i.e., the given attribute value had been a member of this
-     *          attribute set.
-     *
-     * @throws  UnmodifiableSetException
-     *     (unchecked exception) Thrown if this attribute set does not support
-     *     the {@code remove()} operation.
+     *         attribute set
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code remove()} operation
      */
     public boolean remove(Attribute attribute);
 
     /**
-     * Returns {@code true} if this attribute set contains an
-     * attribute for the specified category.
+     * Returns {@code true} if this attribute set contains an attribute for the
+     * specified category.
      *
-     * @param  category whose presence in this attribute set is
-     *            to be tested.
-     *
-     * @return  {@code true} if this attribute set contains an attribute
-     *         value for the specified category.
+     * @param  category whose presence in this attribute set is to be tested
+     * @return {@code true} if this attribute set contains an attribute value
+     *         for the specified category
      */
     public boolean containsKey(Class<?> category);
 
     /**
-     * Returns {@code true} if this attribute set contains the given
-     * attribute value.
+     * Returns {@code true} if this attribute set contains the given attribute
+     * value.
      *
-     * @param  attribute  Attribute value whose presence in this
-     * attribute set is to be tested.
-     *
-     * @return  {@code true} if this attribute set contains the given
-     *      attribute  value.
+     * @param  attribute attribute value whose presence in this attribute set is
+     *         to be tested
+     * @return {@code true} if this attribute set contains the given attribute
+     *         value
      */
     public boolean containsValue(Attribute attribute);
 
     /**
-     * Adds all of the elements in the specified set to this attribute.
-     * The outcome is the same as if the =
-     * {@link #add(Attribute) add(Attribute)}
+     * Adds all of the elements in the specified set to this attribute. The
+     * outcome is the same as if the = {@link #add(Attribute) add(Attribute)}
      * operation had been applied to this attribute set successively with each
-     * element from the specified set.
-     * The behavior of the {@code addAll(AttributeSet)}
-     * operation is unspecified if the specified set is modified while
-     * the operation is in progress.
-     * <P>
-     * If the {@code addAll(AttributeSet)} operation throws an exception,
-     * the effect on this attribute set's state is implementation dependent;
-     * elements from the specified set before the point of the exception may
-     * or may not have been added to this attribute set.
+     * element from the specified set. The behavior of the
+     * {@code addAll(AttributeSet)} operation is unspecified if the specified
+     * set is modified while the operation is in progress.
+     * <p>
+     * If the {@code addAll(AttributeSet)} operation throws an exception, the
+     * effect on this attribute set's state is implementation dependent;
+     * elements from the specified set before the point of the exception may or
+     * may not have been added to this attribute set.
      *
-     * @param  attributes  whose elements are to be added to this attribute
-     *            set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of the
-     *          call.
-     *
-     * @throws  UnmodifiableSetException
-     *     (Unchecked exception) Thrown if this attribute set does not support
-     *     the {@code addAll(AttributeSet)} method.
-     * @throws  NullPointerException
-     *     (Unchecked exception) Thrown if some element in the specified
-     *     set is null.
-     *
+     * @param  attributes whose elements are to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code addAll(AttributeSet)} method
+     * @throws NullPointerException if some element in the specified set is
+     *         {@code null}
      * @see #add(Attribute)
      */
     public boolean addAll(AttributeSet attributes);
 
     /**
-     * Returns the number of attributes in this attribute set. If this
-     * attribute set contains more than {@code Integer.MAX_VALUE} elements,
-     * returns  {@code Integer.MAX_VALUE}.
+     * Returns the number of attributes in this attribute set. If this attribute
+     * set contains more than {@code Integer.MAX_VALUE} elements, returns
+     * {@code Integer.MAX_VALUE}.
      *
-     * @return  The number of attributes in this attribute set.
+     * @return the number of attributes in this attribute set
      */
     public int size();
 
     /**
      * Returns an array of the attributes contained in this set.
-     * @return the Attributes contained in this set as an array, zero length
-     * if the AttributeSet is empty.
+     *
+     * @return the {@code Attributes} contained in this set as an array, zero
+     *         length if the {@code AttributeSet} is empty
      */
     public Attribute[] toArray();
 
-
     /**
      * Removes all attributes from this attribute set.
      *
-     * @throws  UnmodifiableSetException
-     *   (unchecked exception) Thrown if this attribute set does not support
-     *     the {@code clear()} operation.
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code clear()} operation
      */
     public void clear();
 
     /**
-     * Returns true if this attribute set contains no attributes.
+     * Returns {@code true} if this attribute set contains no attributes.
      *
-     * @return true if this attribute set contains no attributes.
+     * @return {@code true} if this attribute set contains no attributes
      */
     public boolean isEmpty();
 
     /**
      * Compares the specified object with this attribute set for equality.
-     * Returns {@code true} if the given object is also an attribute set and
-     * the two attribute sets contain the same attribute category-attribute
-     * value mappings. This ensures that the
-     * {@code equals()} method works properly across different
-     * implementations of the AttributeSet interface.
+     * Returns {@code true} if the given object is also an attribute set and the
+     * two attribute sets contain the same attribute category-attribute value
+     * mappings. This ensures that the {@code equals()} method works properly
+     * across different implementations of the {@code AttributeSet} interface.
      *
-     * @param  object to be compared for equality with this attribute set.
-     *
-     * @return  {@code true} if the specified object is equal to this
-     *       attribute   set.
+     * @param  object to be compared for equality with this attribute set
+     * @return {@code true} if the specified object is equal to this attribute
+     *         set
      */
     public boolean equals(Object object);
 
     /**
      * Returns the hash code value for this attribute set. The hash code of an
-     * attribute set is defined to be the sum of the hash codes of each entry
-     * in the AttributeSet.
-     * This ensures that {@code t1.equals(t2)} implies that
-     * {@code t1.hashCode()==t2.hashCode()} for any two attribute sets
+     * attribute set is defined to be the sum of the hash codes of each entry in
+     * the {@code AttributeSet}. This ensures that {@code t1.equals(t2)} implies
+     * that {@code t1.hashCode()==t2.hashCode()} for any two attribute sets
      * {@code t1} and {@code t2}, as required by the general contract of
-     * {@link java.lang.Object#hashCode() Object.hashCode()}.
+     * {@link Object#hashCode() Object.hashCode()}.
      *
-     * @return  The hash code value for this attribute set.
+     * @return the hash code value for this attribute set
      */
     public int hashCode();
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSetUtilities.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSetUtilities.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,65 +23,75 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
 
 /**
- * Class AttributeSetUtilities provides static methods for manipulating
- * AttributeSets.
+ * Class {@code AttributeSetUtilities} provides static methods for manipulating
+ * {@code AttributeSets}.
  * <ul>
- * <li>Methods for creating unmodifiable and synchronized views of attribute
- * sets.
- * <li>operations useful for building
- * implementations of interface {@link AttributeSet AttributeSet}
+ *   <li>Methods for creating unmodifiable and synchronized views of attribute
+ *   sets.
+ *   <li>operations useful for building implementations of interface
+ *   {@link AttributeSet AttributeSet}
  * </ul>
- * <P>
- * An <B>unmodifiable view</B> <I>U</I> of an AttributeSet <I>S</I> provides a
- * client with "read-only" access to <I>S</I>. Query operations on <I>U</I>
- * "read through" to <I>S</I>; thus, changes in <I>S</I> are reflected in
- * <I>U</I>. However, any attempt to modify <I>U</I>,
- *  results in an UnmodifiableSetException.
- * The unmodifiable view object <I>U</I> will be serializable if the
- * attribute set object <I>S</I> is serializable.
- * <P>
- * A <B>synchronized view</B> <I>V</I> of an attribute set <I>S</I> provides a
- * client with synchronized (multiple thread safe) access to <I>S</I>. Each
- * operation of <I>V</I> is synchronized using <I>V</I> itself as the lock
- * object and then merely invokes the corresponding operation of <I>S</I>. In
- * order to guarantee mutually exclusive access, it is critical that all
- * access to <I>S</I> is accomplished through <I>V</I>. The synchronized view
- * object <I>V</I> will be serializable if the attribute set object <I>S</I>
- * is serializable.
- * <P>
- * As mentioned in the package description of javax.print, a null reference
- * parameter to methods is
- * incorrect unless explicitly documented on the method as having a meaningful
- * interpretation.  Usage to the contrary is incorrect coding and may result in
- * a run time exception either immediately
- * or at some later time. IllegalArgumentException and NullPointerException
- * are examples of typical and acceptable run time exceptions for such cases.
+ * An <b>unmodifiable view</b> <i>U</i> of an {@code AttributeSet} <i>S</i>
+ * provides a client with "read-only" access to <i>S</i>. Query operations on
+ * <i>U</i> "read through" to <i>S</i>; thus, changes in <i>S</i> are reflected
+ * in <i>U</i>. However, any attempt to modify <i>U</i>, results in an
+ * {@code UnmodifiableSetException}. The unmodifiable view object <i>U</i> will
+ * be serializable if the attribute set object <i>S</i> is serializable.
+ * <p>
+ * A <b>synchronized view</b> <i>V</i> of an attribute set <i>S</i> provides a
+ * client with synchronized (multiple thread safe) access to <i>S</i>. Each
+ * operation of <i>V</i> is synchronized using <i>V</i> itself as the lock
+ * object and then merely invokes the corresponding operation of <i>S</i>. In
+ * order to guarantee mutually exclusive access, it is critical that all access
+ * to <i>S</i> is accomplished through <i>V</i>. The synchronized view object
+ * <i>V</i> will be serializable if the attribute set object <i>S</i> is
+ * serializable.
+ * <p>
+ * As mentioned in the package description of {@code javax.print}, a
+ * {@code null} reference parameter to methods is incorrect unless explicitly
+ * documented on the method as having a meaningful interpretation. Usage to the
+ * contrary is incorrect coding and may result in a run time exception either
+ * immediately or at some later time. {@code IllegalArgumentException} and
+ * {@code NullPointerException} are examples of typical and acceptable run time
+ * exceptions for such cases.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class AttributeSetUtilities {
 
-    /* Suppress default constructor, ensuring non-instantiability.
+    /**
+     * Suppress default constructor, ensuring non-instantiability.
      */
     private AttributeSetUtilities() {
     }
 
     /**
-      * @serial include
-      */
+     * Unmodifiable view of {@code AttributeSet}.
+     *
+     * @serial include
+     */
     private static class UnmodifiableAttributeSet
         implements AttributeSet, Serializable {
+
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = -6131802583863447813L;
 
+        /**
+         * The attribute set.
+         */
         private AttributeSet attrset;
 
-        /* Unmodifiable view of the underlying attribute set.
+        /**
+         * Constructs unmodifiable view of the underlying attribute set.
+         *
+         * @param  attributeSet the attribute set
          */
         public UnmodifiableAttributeSet(AttributeSet attributeSet) {
 
@@ -139,17 +149,27 @@
         public int hashCode() {
             return attrset.hashCode();
         }
-
     }
 
     /**
-      * @serial include
-      */
+     * Unmodifiable view of {@code DocAttributeSet}.
+     *
+     * @serial include
+     */
     private static class UnmodifiableDocAttributeSet
         extends UnmodifiableAttributeSet
         implements DocAttributeSet, Serializable {
+
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = -6349408326066898956L;
 
+        /**
+         * Constructs a new unmodifiable doc attribute set.
+         *
+         * @param  attributeSet the doc attribute set
+         */
         public UnmodifiableDocAttributeSet(DocAttributeSet attributeSet) {
 
             super (attributeSet);
@@ -157,13 +177,25 @@
     }
 
     /**
-      * @serial include
-      */
+     * Unmodifiable view of {@code PrintRequestAttributeSet}.
+     *
+     * @serial include
+     */
     private static class UnmodifiablePrintRequestAttributeSet
         extends UnmodifiableAttributeSet
         implements PrintRequestAttributeSet, Serializable
     {
+
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = 7799373532614825073L;
+
+        /**
+         * Constructs a new unmodifiable print request attribute set.
+         *
+         * @param  attributeSet the print request attribute set
+         */
         public UnmodifiablePrintRequestAttributeSet
             (PrintRequestAttributeSet attributeSet) {
 
@@ -172,13 +204,24 @@
     }
 
     /**
-      * @serial include
-      */
+     * Unmodifiable view of {@code PrintJobAttributeSet}.
+     *
+     * @serial include
+     */
     private static class UnmodifiablePrintJobAttributeSet
         extends UnmodifiableAttributeSet
         implements PrintJobAttributeSet, Serializable
     {
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = -8002245296274522112L;
+
+        /**
+         * Constructs a new unmodifiable print job attribute set.
+         *
+         * @param  attributeSet the print job attribute set
+         */
         public UnmodifiablePrintJobAttributeSet
             (PrintJobAttributeSet attributeSet) {
 
@@ -187,13 +230,24 @@
     }
 
     /**
-      * @serial include
-      */
+     * Unmodifiable view of {@code PrintServiceAttributeSet}.
+     *
+     * @serial include
+     */
     private static class UnmodifiablePrintServiceAttributeSet
         extends UnmodifiableAttributeSet
         implements PrintServiceAttributeSet, Serializable
     {
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = -7112165137107826819L;
+
+        /**
+         * Constructs a new unmodifiable print service attribute set.
+         *
+         * @param  attributeSet the print service attribute set
+         */
         public UnmodifiablePrintServiceAttributeSet
             (PrintServiceAttributeSet attributeSet) {
 
@@ -204,12 +258,9 @@
     /**
      * Creates an unmodifiable view of the given attribute set.
      *
-     * @param  attributeSet  Underlying attribute set.
-     *
-     * @return  Unmodifiable view of {@code attributeSet}.
-     *
-     * @exception  NullPointerException
-     *     Thrown if {@code attributeSet} is null. Null is never a
+     * @param  attributeSet underlying attribute set
+     * @return unmodifiable view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static AttributeSet unmodifiableView(AttributeSet attributeSet) {
         if (attributeSet == null) {
@@ -222,12 +273,9 @@
     /**
      * Creates an unmodifiable view of the given doc attribute set.
      *
-     * @param  attributeSet  Underlying doc attribute set.
-     *
-     * @return  Unmodifiable view of {@code attributeSet}.
-     *
-     * @exception  NullPointerException
-     *     Thrown if {@code attributeSet} is null.
+     * @param  attributeSet underlying doc attribute set
+     * @return unmodifiable view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static DocAttributeSet unmodifiableView
         (DocAttributeSet attributeSet) {
@@ -240,12 +288,9 @@
     /**
      * Creates an unmodifiable view of the given print request attribute set.
      *
-     * @param  attributeSet  Underlying print request attribute set.
-     *
-     * @return  Unmodifiable view of {@code attributeSet}.
-     *
-     * @exception  NullPointerException
-     *     Thrown if {@code attributeSet} is null.
+     * @param  attributeSet underlying print request attribute set
+     * @return unmodifiable view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static PrintRequestAttributeSet
         unmodifiableView(PrintRequestAttributeSet attributeSet) {
@@ -258,12 +303,9 @@
     /**
      * Creates an unmodifiable view of the given print job attribute set.
      *
-     * @param  attributeSet  Underlying print job attribute set.
-     *
-     * @return  Unmodifiable view of {@code attributeSet}.
-     *
-     * @exception  NullPointerException
-     *     Thrown if {@code attributeSet} is null.
+     * @param  attributeSet underlying print job attribute set
+     * @return unmodifiable view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static PrintJobAttributeSet
         unmodifiableView(PrintJobAttributeSet attributeSet) {
@@ -276,12 +318,9 @@
     /**
      * Creates an unmodifiable view of the given print service attribute set.
      *
-     * @param  attributeSet  Underlying print service attribute set.
-     *
-     * @return  Unmodifiable view of {@code attributeSet}.
-     *
-     * @exception  NullPointerException
-     *     Thrown if {@code attributeSet} is null.
+     * @param  attributeSet underlying print service attribute set
+     * @return unmodifiable view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static PrintServiceAttributeSet
         unmodifiableView(PrintServiceAttributeSet attributeSet) {
@@ -292,14 +331,28 @@
     }
 
     /**
-      * @serial include
-      */
+     * Synchronized view of {@code AttributeSet}.
+     *
+     * @serial include
+     */
     private static class SynchronizedAttributeSet
                         implements AttributeSet, Serializable {
+
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = 8365731020128564925L;
 
+        /**
+         * The attribute set.
+         */
         private AttributeSet attrset;
 
+        /**
+         * Constructs a new synchronized attribute set.
+         *
+         * @param  attributeSet the attribute set
+         */
         public SynchronizedAttributeSet(AttributeSet attributeSet) {
             attrset = attributeSet;
         }
@@ -358,26 +411,48 @@
     }
 
     /**
-      * @serial include
-      */
+     * Synchronized view of {@code DocAttributeSet}.
+     *
+     * @serial include
+     */
     private static class SynchronizedDocAttributeSet
         extends SynchronizedAttributeSet
         implements DocAttributeSet, Serializable {
+
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = 6455869095246629354L;
 
+        /**
+         * Constructs a new synchronized doc attribute set.
+         *
+         * @param  attributeSet the doc attribute set
+         */
         public SynchronizedDocAttributeSet(DocAttributeSet attributeSet) {
             super(attributeSet);
         }
     }
 
     /**
-      * @serial include
-      */
+     * Synchronized view of {@code PrintRequestAttributeSet}.
+     *
+     * @serial include
+     */
     private static class SynchronizedPrintRequestAttributeSet
         extends SynchronizedAttributeSet
         implements PrintRequestAttributeSet, Serializable {
+
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = 5671237023971169027L;
 
+        /**
+         * Constructs a new synchronized print request attribute set.
+         *
+         * @param  attributeSet the print request attribute set
+         */
         public SynchronizedPrintRequestAttributeSet
             (PrintRequestAttributeSet attributeSet) {
             super(attributeSet);
@@ -385,13 +460,24 @@
     }
 
     /**
-      * @serial include
-      */
+     * Synchronized view of {@code PrintJobAttributeSet}.
+     *
+     * @serial include
+     */
     private static class SynchronizedPrintJobAttributeSet
         extends SynchronizedAttributeSet
         implements PrintJobAttributeSet, Serializable {
+
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = 2117188707856965749L;
 
+        /**
+         * Constructs a new synchronized print job attribute set.
+         *
+         * @param  attributeSet the print job attribute set
+         */
         public SynchronizedPrintJobAttributeSet
             (PrintJobAttributeSet attributeSet) {
             super(attributeSet);
@@ -399,13 +485,24 @@
     }
 
     /**
-      * @serial include
-      */
+     * Synchronized view of {@code PrintServiceAttributeSet}.
+     *
+     * @serial include
+     */
     private static class SynchronizedPrintServiceAttributeSet
         extends SynchronizedAttributeSet
         implements PrintServiceAttributeSet, Serializable {
+
+        /**
+         * Use serialVersionUID from JDK 1.4 for interoperability.
+         */
         private static final long serialVersionUID = -2830705374001675073L;
 
+        /**
+         * Constructs a new synchronized print service attribute set.
+         *
+         * @param  attributeSet the print service attribute set
+         */
         public SynchronizedPrintServiceAttributeSet
             (PrintServiceAttributeSet attributeSet) {
             super(attributeSet);
@@ -415,12 +512,9 @@
     /**
      * Creates a synchronized view of the given attribute set.
      *
-     * @param  attributeSet  Underlying attribute set.
-     *
-     * @return  Synchronized view of {@code attributeSet}.
-     *
-     * @exception  NullPointerException
-     *     Thrown if {@code attributeSet} is null.
+     * @param  attributeSet underlying attribute set
+     * @return synchronized view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static AttributeSet synchronizedView
         (AttributeSet attributeSet) {
@@ -433,12 +527,9 @@
     /**
      * Creates a synchronized view of the given doc attribute set.
      *
-     * @param  attributeSet  Underlying doc attribute set.
-     *
-     * @return  Synchronized view of {@code attributeSet}.
-     *
-     * @exception  NullPointerException
-     *     Thrown if {@code attributeSet} is null.
+     * @param  attributeSet underlying doc attribute set
+     * @return synchronized view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static DocAttributeSet
         synchronizedView(DocAttributeSet attributeSet) {
@@ -451,12 +542,9 @@
     /**
      * Creates a synchronized view of the given print request attribute set.
      *
-     * @param  attributeSet  Underlying print request attribute set.
-     *
-     * @return  Synchronized view of {@code attributeSet}.
-     *
-     * @exception  NullPointerException
-     *     Thrown if {@code attributeSet} is null.
+     * @param  attributeSet underlying print request attribute set
+     * @return synchronized view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static PrintRequestAttributeSet
         synchronizedView(PrintRequestAttributeSet attributeSet) {
@@ -469,12 +557,9 @@
     /**
      * Creates a synchronized view of the given print job attribute set.
      *
-     * @param  attributeSet  Underlying print job attribute set.
-     *
-     * @return  Synchronized view of {@code attributeSet}.
-     *
-     * @exception  NullPointerException
-     *     Thrown if {@code attributeSet} is null.
+     * @param  attributeSet underlying print job attribute set
+     * @return synchronized view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static PrintJobAttributeSet
         synchronizedView(PrintJobAttributeSet attributeSet) {
@@ -487,9 +572,9 @@
     /**
      * Creates a synchronized view of the given print service attribute set.
      *
-     * @param  attributeSet  Underlying print service attribute set.
-     *
-     * @return  Synchronized view of {@code attributeSet}.
+     * @param  attributeSet underlying print service attribute set
+     * @return synchronized view of {@code attributeSet}
+     * @throws NullPointerException if {@code attributeSet} is {@code null}
      */
     public static PrintServiceAttributeSet
         synchronizedView(PrintServiceAttributeSet attributeSet) {
@@ -499,26 +584,19 @@
         return new SynchronizedPrintServiceAttributeSet(attributeSet);
     }
 
-
     /**
-     * Verify that the given object is a {@link java.lang.Class Class} that
-     * implements the given interface, which is assumed to be interface {@link
-     * Attribute Attribute} or a subinterface thereof.
-     *
-     * @param  object     Object to test.
-     * @param  interfaceName  Interface the object must implement.
+     * Verify that the given object is a {@link Class Class} that implements the
+     * given interface, which is assumed to be interface
+     * {@link Attribute Attribute} or a subinterface thereof.
      *
-     * @return  If {@code object} is a {@link java.lang.Class Class}
-     *          that implements {@code interfaceName},
-     *          {@code object} is returned downcast to type {@link
-     *          java.lang.Class Class}; otherwise an exception is thrown.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code object} is null.
-     * @exception  ClassCastException
-     *     (unchecked exception) Thrown if {@code object} is not a
-     *     {@link java.lang.Class Class} that implements
-     *     {@code interfaceName}.
+     * @param  object {@code Object} to test
+     * @param  interfaceName interface the object must implement
+     * @return if {@code object} is a {@link Class Class} that implements
+     *         {@code interfaceName}, {@code object} is returned downcast to
+     *         type {@link Class Class}; otherwise an exception is thrown
+     * @throws NullPointerException if {@code object} is {@code null}
+     * @throws ClassCastException if {@code object} is not a
+     *         {@link Class Class} that implements {@code interfaceName}
      */
     public static Class<?>
         verifyAttributeCategory(Object object, Class<?> interfaceName) {
@@ -537,19 +615,14 @@
      * is assumed to be interface {@link Attribute Attribute} or a subinterface
      * thereof.
      *
-     * @param  object     Object to test.
-     * @param  interfaceName  Interface of which the object must be an instance.
-     *
-     * @return  If {@code object} is an instance of
-     *          {@code interfaceName}, {@code object} is returned
-     *          downcast to type {@link Attribute Attribute}; otherwise an
-     *          exception is thrown.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code object} is null.
-     * @exception  ClassCastException
-     *     (unchecked exception) Thrown if {@code object} is not an
-     *     instance of {@code interfaceName}.
+     * @param  object {@code Object} to test
+     * @param  interfaceName interface of which the object must be an instance
+     * @return if {@code object} is an instance of {@code interfaceName},
+     *         {@code object} is returned downcast to type
+     *         {@link Attribute Attribute}; otherwise an exception is thrown
+     * @throws NullPointerException if {@code object} is {@code null}
+     * @throws ClassCastException if {@code object} is not an instance of
+     *         {@code interfaceName}
      */
     public static Attribute
         verifyAttributeValue(Object object, Class<?> interfaceName) {
@@ -565,19 +638,16 @@
     }
 
     /**
-     * Verify that the given attribute category object is equal to the
-     * category of the given attribute value object. If so, this method
-     * returns doing nothing. If not, this method throws an exception.
-     *
-     * @param  category   Attribute category to test.
-     * @param  attribute  Attribute value to test.
+     * Verify that the given attribute category object is equal to the category
+     * of the given attribute value object. If so, this method returns doing
+     * nothing. If not, this method throws an exception.
      *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if the {@code category} is
-     *     null or if the {@code attribute} is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if the {@code category} is not
-     *     equal to the category of the {@code attribute}.
+     * @param  category attribute category to test
+     * @param  attribute attribute value to test
+     * @throws NullPointerException if the {@code category} or {@code attribute}
+     *         are {@code null}
+     * @throws IllegalArgumentException if the {@code category} is not equal to
+     *         the category of the {@code attribute}
      */
     public static void
         verifyCategoryForValue(Class<?> category, Attribute attribute) {
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/DateTimeSyntax.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/DateTimeSyntax.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,47 +23,48 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
-
 import java.util.Date;
 
 /**
- * Class DateTimeSyntax is an abstract base class providing the common
+ * Class {@code DateTimeSyntax} is an abstract base class providing the common
  * implementation of all attributes whose value is a date and time.
- * <P>
+ * <p>
  * Under the hood, a date-time attribute is stored as a value of class
- * {@code java.util.Date}. You can get a date-time attribute's Date value by
- * calling {@link #getValue() getValue()}. A date-time attribute's
- * Date value is established when it is constructed (see {@link
- * #DateTimeSyntax(Date) DateTimeSyntax(Date)}). Once
- * constructed, a date-time attribute's value is immutable.
- * <P>
+ * {@code java.util.Date}. You can get a date-time attribute's {@code Date}
+ * value by calling {@link #getValue() getValue()}. A date-time attribute's
+ * {@code Date} value is established when it is constructed (see
+ * {@link #DateTimeSyntax(Date) DateTimeSyntax(Date)}). Once constructed, a
+ * date-time attribute's value is immutable.
+ * <p>
  * To construct a date-time attribute from separate values of the year, month,
- * day, hour, minute, and so on, use a {@code java.util.Calendar}
- * object to construct a {@code java.util.Date} object, then use the
- * {@code java.util.Date} object to construct the date-time attribute.
- * To convert
- * a date-time attribute to separate values of the year, month, day, hour,
- * minute, and so on, create a {@code java.util.Calendar} object and
- * set it to the {@code java.util.Date} from the date-time attribute. Class
- * DateTimeSyntax stores its value in the form of a {@code java.util.Date}
- * rather than a {@code java.util.Calendar} because it typically takes
- * less memory to store and less time to compare a {@code java.util.Date}
- * than a {@code java.util.Calendar}.
+ * day, hour, minute, and so on, use a {@code java.util.Calendar} object to
+ * construct a {@code java.util.Date} object, then use the
+ * {@code java.util.Date} object to construct the date-time attribute. To
+ * convert a date-time attribute to separate values of the year, month, day,
+ * hour, minute, and so on, create a {@code java.util.Calendar} object and set
+ * it to the {@code java.util.Date} from the date-time attribute. Class
+ * {@code DateTimeSyntax} stores its value in the form of a
+ * {@code java.util.Date} rather than a {@code java.util.Calendar} because it
+ * typically takes less memory to store and less time to compare a
+ * {@code java.util.Date} than a {@code java.util.Calendar}.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public abstract class DateTimeSyntax implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -1400819079791208582L;
 
     // Hidden data members.
 
     /**
      * This date-time attribute's {@code java.util.Date} value.
+     *
      * @serial
      */
     private Date value;
@@ -71,13 +72,11 @@
     // Hidden constructors.
 
     /**
-     * Construct a new date-time attribute with the given
-     * {@code java.util.Date} value.
+     * Construct a new date-time attribute with the given {@code java.util.Date}
+     * value.
      *
-     * @param  value   {@code java.util.Date} value.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code theValue} is null.
+     * @param  value {@code java.util.Date} value
+     * @throws NullPointerException if {@code value} is {@code null}
      */
     protected DateTimeSyntax(Date value) {
         if (value == null) {
@@ -89,9 +88,9 @@
     // Exported operations.
 
     /**
-     * Returns this date-time attribute's {@code java.util.Date}
-     * value.
-     * @return the Date.
+     * Returns this date-time attribute's {@code java.util.Date} value.
+     *
+     * @return the {@code Date}
      */
     public Date getValue() {
         return new Date (value.getTime());
@@ -102,20 +101,16 @@
     /**
      * Returns whether this date-time attribute is equivalent to the passed in
      * object. To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class DateTimeSyntax.
-     * <LI>
-     * This date-time attribute's {@code java.util.Date} value and
-     * {@code object}'s {@code java.util.Date} value are
-     * equal. </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code DateTimeSyntax}.
+     *   <li>This date-time attribute's {@code java.util.Date} value and
+     *   {@code object}'s {@code java.util.Date} value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this date-time
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this date-time
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (object != null &&
@@ -132,13 +127,11 @@
     }
 
     /**
-     * Returns a string value corresponding to this date-time attribute.
-     * The string value is just this attribute's
-     * {@code java.util.Date}  value
+     * Returns a string value corresponding to this date-time attribute. The
+     * string value is just this attribute's {@code java.util.Date} value
      * converted to a string.
      */
     public String toString() {
         return "" + value;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttribute.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttribute.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,25 +23,22 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 /**
- * Interface DocAttribute is a tagging interface which a printing attribute
- * class implements to indicate the attribute denotes a setting for a doc.
- * ("Doc" is a short, easy-to-pronounce term that means "a piece of print
- * data.") The client may include a DocAttribute in a {@code Doc}'s
- * attribute set to specify a characteristic of
- * that doc. If an attribute implements {@link PrintRequestAttribute
- * PrintRequestAttribute} as well as DocAttribute, the client may include the
- * attribute in a attribute set which specifies a print job
- * to specify a characteristic for all the docs in that job.
+ * Interface {@code DocAttribute} is a tagging interface which a printing
+ * attribute class implements to indicate the attribute denotes a setting for a
+ * doc. ("Doc" is a short, easy-to-pronounce term that means "a piece of print
+ * data.") The client may include a {@code DocAttribute} in a {@code Doc}'s
+ * attribute set to specify a characteristic of that doc. If an attribute
+ * implements {@link PrintRequestAttribute PrintRequestAttribute} as well as
+ * {@code DocAttribute}, the client may include the attribute in a attribute set
+ * which specifies a print job to specify a characteristic for all the docs in
+ * that job.
  *
+ * @author Alan Kaminsky
  * @see DocAttributeSet
  * @see PrintRequestAttributeSet
- *
- * @author  Alan Kaminsky
  */
 public interface DocAttribute extends Attribute {
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,88 +23,70 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 /**
- * Interface DocAttributeSet specifies the interface for a set of doc
- * attributes, i.e. printing attributes that implement interface {@link
- * DocAttribute DocAttribute}. In the Print Service API, the client uses a
- * DocAttributeSet to specify the characteristics of an individual doc and
- * the print job settings to be applied to an individual doc.
- * <P>
- * A DocAttributeSet is just an {@link AttributeSet AttributeSet} whose
+ * Interface {@code DocAttributeSet} specifies the interface for a set of doc
+ * attributes, i.e. printing attributes that implement interface
+ * {@link DocAttribute DocAttribute}. In the Print Service API, the client uses
+ * a {@code DocAttributeSet} to specify the characteristics of an individual doc
+ * and the print job settings to be applied to an individual doc.
+ * <p>
+ * A {@code DocAttributeSet} is just an {@link AttributeSet AttributeSet} whose
  * constructors and mutating operations guarantee an additional invariant,
- * namely that all attribute values in the DocAttributeSet must be instances
- * of interface {@link DocAttribute DocAttribute}.
- * The {@link #add(Attribute) add(Attribute)}, and
- * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations
- * are respecified below to guarantee this additional invariant.
+ * namely that all attribute values in the {@code DocAttributeSet} must be
+ * instances of interface {@link DocAttribute DocAttribute}. The
+ * {@link #add(Attribute) add(Attribute)}, and
+ * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified
+ * below to guarantee this additional invariant.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public interface DocAttributeSet extends AttributeSet {
 
-
     /**
      * Adds the specified attribute value to this attribute set if it is not
-     * already present, first removing any existing value in the same
-     * attribute category as the specified attribute value (optional
-     * operation).
-     *
-     * @param  attribute  Attribute value to be added to this attribute set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of
-     *          the call, i.e., the given attribute value was not already a
-     *          member of this attribute set.
+     * already present, first removing any existing value in the same attribute
+     * category as the specified attribute value (optional operation).
      *
-     * @throws  UnmodifiableSetException
-     *     (unchecked exception) Thrown if this attribute set does not
-     *     support the {@code add()} operation.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if the {@code attribute} is
-     *     not an instance of interface
-     *     {@link DocAttribute DocAttribute}.
-     * @throws  NullPointerException
-     *    (unchecked exception) Thrown if the {@code attribute} is null.
+     * @param  attribute attribute value to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call, i.e., the given attribute value was not already a member of
+     *         this attribute set
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code add()} operation
+     * @throws ClassCastException if the {@code attribute} is not an instance of
+     *         interface {@link DocAttribute DocAttribute}
+     * @throws NullPointerException if the {@code attribute} is {@code null}
      */
     public boolean add(Attribute attribute);
 
     /**
-     * Adds all of the elements in the specified set to this attribute.
-     * The outcome is  the same as if the
-     * {@link #add(Attribute) add(Attribute)}
-     * operation had been applied to this attribute set successively with
-     * each element from the specified set. If none of the categories in the
-     * specified set  are the same as any categories in this attribute set,
-     * the {@code addAll()} operation effectively modifies this attribute
-     * set so that its value is the <i>union</i> of the two sets.
-     * <P>
-     * The behavior of the {@code addAll()} operation is unspecified if
-     * the specified set is modified while the operation is in progress.
-     * <P>
-     * If the {@code addAll()} operation throws an exception, the effect
-     * on this attribute set's state is implementation dependent; elements
-     * from the specified set before the point of the exception may or
-     * may not have been added to this attribute set.
+     * Adds all of the elements in the specified set to this attribute. The
+     * outcome is the same as if the {@link #add(Attribute) add(Attribute)}
+     * operation had been applied to this attribute set successively with each
+     * element from the specified set. If none of the categories in the
+     * specified set are the same as any categories in this attribute set, the
+     * {@code addAll()} operation effectively modifies this attribute set so
+     * that its value is the <i>union</i> of the two sets.
+     * <p>
+     * The behavior of the {@code addAll()} operation is unspecified if the
+     * specified set is modified while the operation is in progress.
+     * <p>
+     * If the {@code addAll()} operation throws an exception, the effect on this
+     * attribute set's state is implementation dependent; elements from the
+     * specified set before the point of the exception may or may not have been
+     * added to this attribute set.
      *
-     * @param  attributes  whose elements are to be added to this attribute
-     *            set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of
-     *          the call.
-     *
-     * @throws  UnmodifiableSetException
-     *     (Unchecked exception) Thrown if this attribute set does not
-     *     support the {@code addAll()} method.
-     * @throws  ClassCastException
-     *     (Unchecked exception) Thrown if some element in the specified
-     *     set is not an instance of interface {@link DocAttribute
-     *     DocAttribute}.
-     * @throws  NullPointerException
-     *     (Unchecked exception) Thrown if the specified  set is null.
-     *
+     * @param  attributes whose elements are to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code addAll()} method
+     * @throws ClassCastException if some element in the specified set is not an
+     *         instance of interface {@link DocAttribute DocAttribute}
+     * @throws NullPointerException if the specified set is {@code null}
      * @see #add(Attribute)
      */
-   public boolean addAll(AttributeSet attributes);
+    public boolean addAll(AttributeSet attributes);
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/EnumSyntax.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/EnumSyntax.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,7 +23,6 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.InvalidObjectException;
@@ -31,11 +30,13 @@
 import java.io.Serializable;
 
 /**
- * Class EnumSyntax is an abstract base class providing the common
+ * Class {@code EnumSyntax} is an abstract base class providing the common
  * implementation of all "type safe enumeration" objects. An enumeration class
- * (which extends class EnumSyntax) provides a group of enumeration values
- * (objects) that are singleton instances of the enumeration class; for example:
- * <PRE>
+ * (which extends class {@code EnumSyntax}) provides a group of enumeration
+ * values (objects) that are singleton instances of the enumeration class; for
+ * example:
+ *
+ * <pre>
  *     public class Bach extends EnumSyntax {
  *         public static final Bach JOHANN_SEBASTIAN     = new Bach(0);
  *         public static final Bach WILHELM_FRIEDEMANN   = new Bach(1);
@@ -67,51 +68,54 @@
  *             return enumValueTable;
  *         }
  *     }
- * </PRE>
- * You can then write code that uses the {@code ==} and {@code !=}
- * operators to test enumeration values; for example:
- * <PRE>
+ * </pre>
+ * You can then write code that uses the {@code ==} and {@code !=} operators to
+ * test enumeration values; for example:
+ * <pre>
  *     Bach theComposer;
  *     . . .
  *     if (theComposer == Bach.JOHANN_SEBASTIAN) {
  *         System.out.println ("The greatest composer of all time!");
  *     }
- * </PRE>
- * The {@code equals()} method for an enumeration class just does a test
- * for identical objects ({@code ==}).
- * <P>
- * You can convert an enumeration value to a string by calling {@link
- * #toString() toString()}. The string is obtained from a table
- * supplied by the enumeration class.
- * <P>
+ * </pre>
+ * The {@code equals()} method for an enumeration class just does a test for
+ * identical objects ({@code ==}).
+ * <p>
+ * You can convert an enumeration value to a string by calling
+ * {@link #toString() toString()}. The string is obtained from a table supplied
+ * by the enumeration class.
+ * <p>
  * Under the hood, an enumeration value is just an integer, a different integer
  * for each enumeration value within an enumeration class. You can get an
- * enumeration value's integer value by calling {@link #getValue()
- * getValue()}. An enumeration value's integer value is established
- * when it is constructed (see {@link #EnumSyntax(int)
- * EnumSyntax(int)}). Since the constructor is protected, the only
- * possible enumeration values are the singleton objects declared in the
- * enumeration class; additional enumeration values cannot be created at run
- * time.
- * <P>
+ * enumeration value's integer value by calling {@link #getValue() getValue()}.
+ * An enumeration value's integer value is established when it is constructed
+ * (see {@link #EnumSyntax(int) EnumSyntax(int)}). Since the constructor is
+ * protected, the only possible enumeration values are the singleton objects
+ * declared in the enumeration class; additional enumeration values cannot be
+ * created at run time.
+ * <p>
  * You can define a subclass of an enumeration class that extends it with
  * additional enumeration values. The subclass's enumeration values' integer
  * values need not be distinct from the superclass's enumeration values' integer
- * values; the {@code ==}, {@code !=}, {@code equals()}, and
- * {@code toString()} methods will still work properly even if the subclass
- * uses some of the same integer values as the superclass. However, the
- * application in which the enumeration class and subclass are used may need to
- * have distinct integer values in the superclass and subclass.
+ * values; the {@code ==}, {@code !=}, {@code equals()}, and {@code toString()}
+ * methods will still work properly even if the subclass uses some of the same
+ * integer values as the superclass. However, the application in which the
+ * enumeration class and subclass are used may need to have distinct integer
+ * values in the superclass and subclass.
  *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
  */
 public abstract class EnumSyntax implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -2739521845085831642L;
 
     /**
      * This enumeration value's integer value.
+     *
      * @serial
      */
     private int value;
@@ -119,7 +123,7 @@
     /**
      * Construct a new enumeration value with the given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected EnumSyntax(int value) {
         this.value = value;
@@ -127,6 +131,7 @@
 
     /**
      * Returns this enumeration value's integer value.
+     *
      * @return the value
      */
     public int getValue() {
@@ -167,22 +172,20 @@
      * During object input, convert this deserialized enumeration instance to
      * the proper enumeration value defined in the enumeration attribute class.
      *
-     * @return  The enumeration singleton value stored at index
-     *          <I>i</I>-<I>L</I> in the enumeration value table returned by
-     *          {@link #getEnumValueTable() getEnumValueTable()},
-     *          where <I>i</I> is this enumeration value's integer value and
-     *          <I>L</I> is the value returned by {@link #getOffset()
-     *          getOffset()}.
-     *
+     * @return The enumeration singleton value stored at index <i>i</i>-<i>L</i>
+     *         in the enumeration value table returned by
+     *         {@link #getEnumValueTable() getEnumValueTable()}, where <i>i</i>
+     *         is this enumeration value's integer value and <i>L</i> is the
+     *         value returned by {@link #getOffset() getOffset()}
      * @throws ObjectStreamException if the stream can't be deserialised
-     * @throws  InvalidObjectException
-     *     Thrown if the enumeration value table is null, this enumeration
-     *     value's integer value does not correspond to an element in the
-     *     enumeration value table, or the corresponding element in the
-     *     enumeration value table is null. (Note: {@link
-     *     java.io.InvalidObjectException InvalidObjectException} is a subclass
-     *     of {@link java.io.ObjectStreamException ObjectStreamException}, which
-     *     {@code readResolve()} is declared to throw.)
+     * @throws InvalidObjectException if the enumeration value table is
+     *         {@code null}, this enumeration value's integer value does not
+     *         correspond to an element in the enumeration value table, or the
+     *         corresponding element in the enumeration value table is
+     *         {@code null}. (Note:
+     *         {@link InvalidObjectException InvalidObjectException} is a
+     *         subclass of {@link ObjectStreamException ObjectStreamException},
+     *         which {@code readResolve()} is declared to throw.)
      */
     protected Object readResolve() throws ObjectStreamException {
 
@@ -218,20 +221,21 @@
     /**
      * Returns the string table for this enumeration value's enumeration class.
      * The enumeration class's integer values are assumed to lie in the range
-     * <I>L</I>..<I>L</I>+<I>N</I>-1, where <I>L</I> is the value returned by
-     * {@link #getOffset() getOffset()} and <I>N</I> is the length
-     * of the string table. The element in the string table at index
-     * <I>i</I>-<I>L</I> is the value returned by {@link #toString()
-     * toString()} for the enumeration value whose integer value
-     * is <I>i</I>. If an integer within the above range is not used by any
-     * enumeration value, leave the corresponding table element null.
-     * <P>
-     * The default implementation returns null. If the enumeration class (a
-     * subclass of class EnumSyntax) does not override this method to return a
-     * non-null string table, and the subclass does not override the {@link
-     * #toString() toString()} method, the base class {@link
-     * #toString() toString()} method will return just a string
+     * <i>L</i>..<i>L</i>+<i>N</i>-1, where <i>L</i> is the value returned by
+     * {@link #getOffset() getOffset()} and <i>N</i> is the length of the string
+     * table. The element in the string table at index <i>i</i>-<i>L</i> is the
+     * value returned by {@link #toString() toString()} for the enumeration
+     * value whose integer value is <i>i</i>. If an integer within the above
+     * range is not used by any enumeration value, leave the corresponding table
+     * element {@code null}.
+     * <p>
+     * The default implementation returns {@code null}. If the enumeration class
+     * (a subclass of class {@code EnumSyntax}) does not override this method to
+     * return a {@code non-null} string table, and the subclass does not
+     * override the {@link #toString() toString()} method, the base class
+     * {@link #toString() toString()} method will return just a string
      * representation of this enumeration value's integer value.
+     *
      * @return the string table
      */
     protected String[] getStringTable() {
@@ -241,23 +245,24 @@
     /**
      * Returns the enumeration value table for this enumeration value's
      * enumeration class. The enumeration class's integer values are assumed to
-     * lie in the range <I>L</I>..<I>L</I>+<I>N</I>-1, where <I>L</I> is the
-     * value returned by {@link #getOffset() getOffset()} and
-     * <I>N</I> is the length of the enumeration value table. The element in the
-     * enumeration value table at index <I>i</I>-<I>L</I> is the enumeration
-     * value object whose integer value is <I>i</I>; the {@link #readResolve()
-     * readResolve()} method needs this to preserve singleton
-     * semantics during deserialization of an enumeration instance. If an
-     * integer within the above range is not used by any enumeration value,
-     * leave the corresponding table element null.
-     * <P>
-     * The default implementation returns null. If the enumeration class (a
-     * subclass of class EnumSyntax) does not override this method to return
-     * a non-null enumeration value table, and the subclass does not override
-     * the {@link #readResolve() readResolve()} method, the base
-     * class {@link #readResolve() readResolve()} method will throw
-     * an exception whenever an enumeration instance is deserialized from an
-     * object input stream.
+     * lie in the range <i>L</i>..<i>L</i>+<i>N</i>-1, where <i>L</i> is the
+     * value returned by {@link #getOffset() getOffset()} and <i>N</i> is the
+     * length of the enumeration value table. The element in the enumeration
+     * value table at index <i>i</i>-<i>L</i> is the enumeration value object
+     * whose integer value is <i>i</i>; the {@link #readResolve() readResolve()}
+     * method needs this to preserve singleton semantics during deserialization
+     * of an enumeration instance. If an integer within the above range is not
+     * used by any enumeration value, leave the corresponding table element
+     * {@code null}.
+     * <p>
+     * The default implementation returns {@code null}. If the enumeration class
+     * (a subclass of class EnumSyntax) does not override this method to return
+     * a {@code non-null} enumeration value table, and the subclass does not
+     * override the {@link #readResolve() readResolve()} method, the base class
+     * {@link #readResolve() readResolve()} method will throw an exception
+     * whenever an enumeration instance is deserialized from an object input
+     * stream.
+     *
      * @return the value table
      */
     protected EnumSyntax[] getEnumValueTable() {
@@ -267,14 +272,14 @@
     /**
      * Returns the lowest integer value used by this enumeration value's
      * enumeration class.
-     * <P>
+     * <p>
      * The default implementation returns 0. If the enumeration class (a
-     * subclass of class EnumSyntax) uses integer values starting at other than
-     * 0, override this method in the subclass.
-     * @return the offset of the lowest enumeration value.
+     * subclass of class {@code EnumSyntax}) uses integer values starting at
+     * other than 0, override this method in the subclass.
+     *
+     * @return the offset of the lowest enumeration value
      */
     protected int getOffset() {
         return 0;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashAttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashAttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -32,37 +32,42 @@
 import java.util.HashMap;
 
 /**
- * Class HashAttributeSet provides an {@code AttributeSet}
+ * Class {@code HashAttributeSet} provides an {@code AttributeSet}
  * implementation with characteristics of a hash map.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class HashAttributeSet implements AttributeSet, Serializable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 5311560590283707917L;
 
     /**
      * The interface of which all members of this attribute set must be an
-     * instance. It is assumed to be interface {@link Attribute Attribute}
-     * or a subinterface thereof.
+     * instance. It is assumed to be interface {@link Attribute Attribute} or a
+     * subinterface thereof.
+     *
      * @serial
      */
     private Class<?> myInterface;
 
-    /*
-     * A HashMap used by the implementation.
-     * The serialised form doesn't include this instance variable.
+    /**
+     * A {@code HashMap} used by the implementation. The serialised form doesn't
+     * include this instance variable.
      */
     private transient HashMap<Class<?>, Attribute> attrMap = new HashMap<>();
 
     /**
-     * Write the instance to a stream (ie serialize the object)
+     * Write the instance to a stream (ie serialize the object).
      *
-     * @serialData
-     * The serialized form of an attribute set explicitly writes the
-     * number of attributes in the set, and each of the attributes.
-     * This does not guarantee equality of serialized forms since
-     * the order in which the attributes are written is not defined.
+     * @param  s the output stream
+     * @throws IOException if an I/O exception has occurred
+     * @serialData The serialized form of an attribute set explicitly writes the
+     *             number of attributes in the set, and each of the attributes.
+     *             This does not guarantee equality of serialized forms since
+     *             the order in which the attributes are written is not defined.
      */
     private void writeObject(ObjectOutputStream s) throws IOException {
 
@@ -76,6 +81,10 @@
 
     /**
      * Reconstitute an instance from a stream that is, deserialize it).
+     *
+     * @param  s the input stream
+     * @throws ClassNotFoundException if the class is not found
+     * @throws IOException if an I/O exception has occurred
      */
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException {
@@ -98,59 +107,51 @@
     }
 
     /**
-     * Construct a new attribute set,
-     * initially populated with the given attribute.
+     * Construct a new attribute set, initially populated with the given
+     * attribute.
      *
-     * @param  attribute  Attribute value to add to the set.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code attribute} is null.
+     * @param  attribute attribute value to add to the set
+     * @throws NullPointerException if {@code attribute} is {@code null}
      */
     public HashAttributeSet(Attribute attribute) {
         this (attribute, Attribute.class);
     }
 
     /**
-     * Construct a new attribute set,
-     * initially populated with the values from the
-     * given array. The new attribute set is populated by
-     * adding the elements of {@code attributes} array to the set in
-     * sequence, starting at index 0. Thus, later array elements may replace
-     * earlier array elements if the array contains duplicate attribute
-     * values or attribute categories.
+     * Construct a new attribute set, initially populated with the values from
+     * the given array. The new attribute set is populated by adding the
+     * elements of {@code attributes} array to the set in sequence, starting at
+     * index 0. Thus, later array elements may replace earlier array elements if
+     * the array contains duplicate attribute values or attribute categories.
      *
-     * @param  attributes  Array of attribute values to add to the set.
-     *                    If null, an empty attribute set is constructed.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if any element of
-     *     {@code attributes} is null.
+     * @param  attributes array of attribute values to add to the set. If
+     *         {@code null}, an empty attribute set is constructed.
+     * @throws NullPointerException if any element of {@code attributes} is
+     *         {@code null}
      */
     public HashAttributeSet(Attribute[] attributes) {
         this (attributes, Attribute.class);
     }
 
     /**
-     * Construct a new attribute set,
-     * initially populated with the values from the  given set.
+     * Construct a new attribute set, initially populated with the values from
+     * the given set.
      *
-     * @param  attributes Set of attributes from which to initialise this set.
-     *                 If null, an empty attribute set is constructed.
-     *
+     * @param  attributes set of attributes from which to initialise this set.
+     *         If {@code null}, an empty attribute set is constructed.
      */
     public HashAttributeSet(AttributeSet attributes) {
         this (attributes, Attribute.class);
     }
 
     /**
-     * Construct a new, empty attribute set, where the members of
-     * the attribute set are restricted to the given interface.
+     * Construct a new, empty attribute set, where the members of the attribute
+     * set are restricted to the given interface.
      *
-     * @param  interfaceName  The interface of which all members of this
-     *                     attribute set must be an instance. It is assumed to
-     *                     be interface {@link Attribute Attribute} or a
-     *                     subinterface thereof.
-     * @exception NullPointerException if interfaceName is null.
+     * @param  interfaceName the interface of which all members of this
+     *         attribute set must be an instance. It is assumed to be interface
+     *         {@link Attribute Attribute} or a subinterface thereof.
+     * @throws NullPointerException if {@code interfaceName} is {@code null}
      */
     protected HashAttributeSet(Class<?> interfaceName) {
         if (interfaceName == null) {
@@ -164,18 +165,14 @@
      * attribute, where the members of the attribute set are restricted to the
      * given interface.
      *
-     * @param  attribute      Attribute value to add to the set.
-     * @param  interfaceName  The interface of which all members of this
-     *                    attribute set must be an instance. It is assumed to
-     *                    be interface {@link Attribute Attribute} or a
-     *                    subinterface thereof.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code attribute} is null.
-     * @exception NullPointerException if interfaceName is null.
-     * @exception  ClassCastException
-     *     (unchecked exception) Thrown if {@code attribute} is not an
-     *     instance of {@code interfaceName}.
+     * @param  attribute attribute value to add to the set
+     * @param  interfaceName the interface of which all members of this
+     *         attribute set must be an instance. It is assumed to be interface
+     *         {@link Attribute Attribute} or a subinterface thereof.
+     * @throws NullPointerException if {@code attribute} or
+     *         {@code interfaceName} are {@code null}
+     * @throws ClassCastException if {@code attribute} is not an instance of
+     *         {@code interfaceName}
      */
     protected HashAttributeSet(Attribute attribute, Class<?> interfaceName) {
         if (interfaceName == null) {
@@ -186,29 +183,22 @@
     }
 
     /**
-     * Construct a new attribute set, where the members of the attribute
-     * set are restricted to the given interface.
-     * The new attribute set is populated
-     * by adding the elements of {@code attributes} array to the set in
-     * sequence, starting at index 0. Thus, later array elements may replace
-     * earlier array elements if the array contains duplicate attribute
-     * values or attribute categories.
+     * Construct a new attribute set, where the members of the attribute set are
+     * restricted to the given interface. The new attribute set is populated by
+     * adding the elements of {@code attributes} array to the set in sequence,
+     * starting at index 0. Thus, later array elements may replace earlier array
+     * elements if the array contains duplicate attribute values or attribute
+     * categories.
      *
-     * @param  attributes Array of attribute values to add to the set. If
-     *                    null, an empty attribute set is constructed.
-     * @param  interfaceName  The interface of which all members of this
-     *                    attribute set must be an instance. It is assumed to
-     *                    be interface {@link Attribute Attribute} or a
-     *                    subinterface thereof.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if any element of
-     * {@code attributes} is null.
-     * @exception NullPointerException if interfaceName is null.
-     * @exception  ClassCastException
-     *     (unchecked exception) Thrown if any element of
-     * {@code attributes} is not an instance of
-     * {@code interfaceName}.
+     * @param  attributes array of attribute values to add to the set. If
+     *         {@code null}, an empty attribute set is constructed.
+     * @param  interfaceName the interface of which all members of this
+     *         attribute set must be an instance. It is assumed to be interface
+     *         {@link Attribute Attribute} or a subinterface thereof.
+     * @throws NullPointerException if {@code interfaceName} is {@code null}, or
+     *         if any element of {@code attributes} is {@code null}
+     * @throws ClassCastException if any element of {@code attributes} is not an
+     *         instance of {@code interfaceName}
      */
     protected HashAttributeSet(Attribute[] attributes, Class<?> interfaceName) {
         if (interfaceName == null) {
@@ -222,21 +212,17 @@
     }
 
     /**
-     * Construct a new attribute set, initially populated with the
-     * values from the  given set where the members of the attribute
-     * set are restricted to the given interface.
+     * Construct a new attribute set, initially populated with the values from
+     * the given set where the members of the attribute set are restricted to
+     * the given interface.
      *
      * @param  attributes set of attribute values to initialise the set. If
-     *                    null, an empty attribute set is constructed.
-     * @param  interfaceName  The interface of which all members of this
-     *                    attribute set must be an instance. It is assumed to
-     *                    be interface {@link Attribute Attribute} or a
-     *                    subinterface thereof.
-     *
-     * @exception  ClassCastException
-     *     (unchecked exception) Thrown if any element of
-     * {@code attributes} is not an instance of
-     * {@code interfaceName}.
+     *         {@code null}, an empty attribute set is constructed.
+     * @param  interfaceName The interface of which all members of this
+     *         attribute set must be an instance. It is assumed to be interface
+     *         {@link Attribute Attribute} or a subinterface thereof.
+     * @throws ClassCastException if any element of {@code attributes} is not an
+     *         instance of {@code interfaceName}
      */
     protected HashAttributeSet(AttributeSet attributes, Class<?> interfaceName) {
       myInterface = interfaceName;
@@ -251,26 +237,19 @@
 
     /**
      * Returns the attribute value which this attribute set contains in the
-     * given attribute category. Returns {@code null} if this attribute set
-     * does not contain any attribute value in the given attribute category.
-     *
-     * @param  category  Attribute category whose associated attribute value
-     *                   is to be returned. It must be a
-     *                   {@link java.lang.Class Class}
-     *                   that implements interface {@link Attribute
-     *                   Attribute}.
+     * given attribute category. Returns {@code null} if this attribute set does
+     * not contain any attribute value in the given attribute category.
      *
-     * @return  The attribute value in the given attribute category contained
-     *          in this attribute set, or {@code null} if this attribute set
-     *          does not contain any attribute value in the given attribute
-     *          category.
-     *
-     * @throws  NullPointerException
-     *     (unchecked exception) Thrown if the {@code category} is null.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if the {@code category} is not a
-     *     {@link java.lang.Class Class} that implements interface {@link
-     *     Attribute Attribute}.
+     * @param  category attribute category whose associated attribute value is
+     *         to be returned. It must be a {@link Class Class} that implements
+     *         interface {@link Attribute Attribute}.
+     * @return the attribute value in the given attribute category contained in
+     *         this attribute set, or {@code null} if this attribute set does
+     *         not contain any attribute value in the given attribute category
+     * @throws NullPointerException if the {@code category} is {@code null}
+     * @throws ClassCastException if the {@code category} is not a
+     *         {@link Class Class} that implements interface
+     *         {@link Attribute Attribute}
      */
     public Attribute get(Class<?> category) {
         return attrMap.get(AttributeSetUtilities.
@@ -279,21 +258,17 @@
     }
 
     /**
-     * Adds the specified attribute to this attribute set if it is not
-     * already present, first removing any existing in the same
-     * attribute category as the specified attribute value.
-     *
-     * @param  attribute  Attribute value to be added to this attribute set.
+     * Adds the specified attribute to this attribute set if it is not already
+     * present, first removing any existing in the same attribute category as
+     * the specified attribute value.
      *
-     * @return  {@code true} if this attribute set changed as a result of the
-     *          call, i.e., the given attribute value was not already a
-     *          member of this attribute set.
-     *
-     * @throws  NullPointerException
-     *    (unchecked exception) Thrown if the {@code attribute} is null.
-     * @throws  UnmodifiableSetException
-     *    (unchecked exception) Thrown if this attribute set does not support
-     *     the {@code add()} operation.
+     * @param  attribute attribute value to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call, i.e., the given attribute value was not already a member of
+     *         this attribute set
+     * @throws NullPointerException if the {@code attribute} is {@code null}
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code add()} operation
      */
     public boolean add(Attribute attribute) {
         Object oldAttribute =
@@ -305,19 +280,15 @@
 
     /**
      * Removes any attribute for this category from this attribute set if
-     * present. If {@code category} is null, then
-     * {@code remove()} does nothing and returns {@code false}.
-     *
-     * @param  category Attribute category to be removed from this
-     *                  attribute set.
+     * present. If {@code category} is {@code null}, then {@code remove()} does
+     * nothing and returns {@code false}.
      *
-     * @return  {@code true} if this attribute set changed as a result of the
+     * @param  category attribute category to be removed from this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
      *         call, i.e., the given attribute category had been a member of
-     *         this attribute set.
-     *
-     * @throws  UnmodifiableSetException
-     *     (unchecked exception) Thrown if this attribute set does not
-     *     support the {@code remove()} operation.
+     *         this attribute set
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code remove()} operation
      */
     public boolean remove(Class<?> category) {
         return
@@ -328,19 +299,16 @@
     }
 
     /**
-     * Removes the specified attribute from this attribute set if
-     * present. If {@code attribute} is null, then
-     * {@code remove()} does nothing and returns {@code false}.
-     *
-     * @param attribute Attribute value to be removed from this attribute set.
+     * Removes the specified attribute from this attribute set if present. If
+     * {@code attribute} is {@code null}, then {@code remove()} does nothing and
+     * returns {@code false}.
      *
-     * @return  {@code true} if this attribute set changed as a result of the
-     *         call, i.e., the given attribute value had been a member of
-     *         this attribute set.
-     *
-     * @throws  UnmodifiableSetException
-     *     (unchecked exception) Thrown if this attribute set does not
-     *     support the {@code remove()} operation.
+     * @param  attribute attribute value to be removed from this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call, i.e., the given attribute value had been a member of this
+     *         attribute set
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code remove()} operation
      */
     public boolean remove(Attribute attribute) {
         return
@@ -349,14 +317,12 @@
     }
 
     /**
-     * Returns {@code true} if this attribute set contains an
-     * attribute for the specified category.
+     * Returns {@code true} if this attribute set contains an attribute for the
+     * specified category.
      *
-     * @param  category whose presence in this attribute set is
-     *            to be tested.
-     *
-     * @return  {@code true} if this attribute set contains an attribute
-     *         value for the specified category.
+     * @param  category whose presence in this attribute set is to be tested
+     * @return {@code true} if this attribute set contains an attribute value
+     *         for the specified category
      */
     public boolean containsKey(Class<?> category) {
         return
@@ -367,14 +333,12 @@
     }
 
     /**
-     * Returns {@code true} if this attribute set contains the given
-     * attribute.
+     * Returns {@code true} if this attribute set contains the given attribute.
      *
-     * @param  attribute  value whose presence in this attribute set is
-     *            to be tested.
-     *
-     * @return  {@code true} if this attribute set contains the given
-     *      attribute    value.
+     * @param  attribute value whose presence in this attribute set is to be
+     *         tested
+     * @return {@code true} if this attribute set contains the given attribute
+     *         value
      */
     public boolean containsValue(Attribute attribute) {
         return
@@ -384,33 +348,25 @@
     }
 
     /**
-     * Adds all of the elements in the specified set to this attribute.
-     * The outcome is the same as if the
-     * {@link #add(Attribute) add(Attribute)}
-     * operation had been applied to this attribute set successively with
-     * each element from the specified set.
-     * The behavior of the {@code addAll(AttributeSet)}
-     * operation is unspecified if the specified set is modified while
-     * the operation is in progress.
-     * <P>
-     * If the {@code addAll(AttributeSet)} operation throws an exception,
-     * the effect on this attribute set's state is implementation dependent;
-     * elements from the specified set before the point of the exception may
-     * or may not have been added to this attribute set.
+     * Adds all of the elements in the specified set to this attribute. The
+     * outcome is the same as if the {@link #add(Attribute) add(Attribute)}
+     * operation had been applied to this attribute set successively with each
+     * element from the specified set. The behavior of the
+     * {@code addAll(AttributeSet)} operation is unspecified if the specified
+     * set is modified while the operation is in progress.
+     * <p>
+     * If the {@code addAll(AttributeSet)} operation throws an exception, the
+     * effect on this attribute set's state is implementation dependent;
+     * elements from the specified set before the point of the exception may or
+     * may not have been added to this attribute set.
      *
-     * @param  attributes  whose elements are to be added to this attribute
-     *            set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of the
-     *          call.
-     *
-     * @throws  UnmodifiableSetException
-     *    (Unchecked exception) Thrown if this attribute set does not
-     *     support the {@code addAll(AttributeSet)} method.
-     * @throws  NullPointerException
-     *     (Unchecked exception) Thrown if some element in the specified
-     *     set is null, or the set is null.
-     *
+     * @param  attributes whose elements are to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code addAll(AttributeSet)} method
+     * @throws NullPointerException if some element in the specified set is
+     *         {@code null}, or the set is {@code null}
      * @see #add(Attribute)
      */
     public boolean addAll(AttributeSet attributes) {
@@ -428,20 +384,21 @@
     }
 
     /**
-     * Returns the number of attributes in this attribute set. If this
-     * attribute set contains more than {@code Integer.MAX_VALUE} elements,
-     * returns  {@code Integer.MAX_VALUE}.
+     * Returns the number of attributes in this attribute set. If this attribute
+     * set contains more than {@code Integer.MAX_VALUE} elements, returns
+     * {@code Integer.MAX_VALUE}.
      *
-     * @return  The number of attributes in this attribute set.
+     * @return the number of attributes in this attribute set
      */
     public int size() {
         return attrMap.size();
     }
 
     /**
+     * Returns an array of the attributes contained in this set.
      *
-     * @return the Attributes contained in this set as an array, zero length
-     * if the AttributeSet is empty.
+     * @return the attributes contained in this set as an array, zero length if
+     *         the {@code AttributeSet} is empty
      */
     public Attribute[] toArray() {
         Attribute []attrs = new Attribute[size()];
@@ -449,22 +406,20 @@
         return attrs;
     }
 
-
     /**
      * Removes all attributes from this attribute set.
      *
-     * @throws  UnmodifiableSetException
-     *   (unchecked exception) Thrown if this attribute set does not support
-     *     the {@code clear()} operation.
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code clear()} operation
      */
     public void clear() {
         attrMap.clear();
     }
 
-   /**
-     * Returns true if this attribute set contains no attributes.
+    /**
+     * Returns {@code true} if this attribute set contains no attributes.
      *
-     * @return true if this attribute set contains no attributes.
+     * @return {@code true} if this attribute set contains no attributes
      */
     public boolean isEmpty() {
         return attrMap.isEmpty();
@@ -472,18 +427,15 @@
 
     /**
      * Compares the specified object with this attribute set for equality.
-     * Returns {@code true} if the given object is also an attribute set and
-     * the two attribute sets contain the same attribute category-attribute
-     * value mappings. This ensures that the
-     * {@code equals()} method works properly across different
-     * implementations of the AttributeSet interface.
+     * Returns {@code true} if the given object is also an attribute set and the
+     * two attribute sets contain the same attribute category-attribute value
+     * mappings. This ensures that the {@code equals()} method works properly
+     * across different implementations of the {@code AttributeSet} interface.
      *
-     * @param  object to be compared for equality with this attribute set.
-     *
-     * @return  {@code true} if the specified object is equal to this
-     *       attribute   set.
+     * @param  object to be compared for equality with this attribute set
+     * @return {@code true} if the specified object is equal to this attribute
+     *         set
      */
-
     public boolean equals(Object object) {
         if (object == null || !(object instanceof AttributeSet)) {
             return false;
@@ -504,15 +456,14 @@
     }
 
     /**
-     * Returns the hash code value for this attribute set.
-     * The hash code of an attribute set is defined to be the sum
-     * of the hash codes of each entry in the AttributeSet.
-     * This ensures that {@code t1.equals(t2)} implies that
-     * {@code t1.hashCode()==t2.hashCode()} for any two attribute sets
+     * Returns the hash code value for this attribute set. The hash code of an
+     * attribute set is defined to be the sum of the hash codes of each entry in
+     * the {@code AttributeSet}. This ensures that {@code t1.equals(t2)} implies
+     * that {@code t1.hashCode()==t2.hashCode()} for any two attribute sets
      * {@code t1} and {@code t2}, as required by the general contract of
-     * {@link java.lang.Object#hashCode() Object.hashCode()}.
+     * {@link Object#hashCode() Object.hashCode()}.
      *
-     * @return  The hash code value for this attribute set.
+     * @return the hash code value for this attribute set
      */
     public int hashCode() {
         int hcode = 0;
@@ -522,5 +473,4 @@
         }
         return hcode;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashDocAttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashDocAttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,22 +23,24 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
 
 /**
- * Class HashDocAttributeSet provides an attribute set which
- * inherits its implementation from class {@link HashAttributeSet
- * HashAttributeSet} and enforces the semantic restrictions of interface {@link
- * DocAttributeSet DocAttributeSet}.
+ * Class {@code HashDocAttributeSet} provides an attribute set which inherits
+ * its implementation from class {@link HashAttributeSet HashAttributeSet} and
+ * enforces the semantic restrictions of interface
+ * {@link DocAttributeSet DocAttributeSet}.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class HashDocAttributeSet extends HashAttributeSet
     implements DocAttributeSet, Serializable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -1128534486061432528L;
 
     /**
@@ -49,53 +51,43 @@
     }
 
     /**
-     * Construct a new hash doc attribute set,
-     * initially populated with the given value.
+     * Construct a new hash doc attribute set, initially populated with the
+     * given value.
      *
-     * @param  attribute  Attribute value to add to the set.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code attribute} is null.
+     * @param  attribute attribute value to add to the set
+     * @throws NullPointerException if {@code attribute} is {@code null}
      */
     public HashDocAttributeSet(DocAttribute attribute) {
         super (attribute, DocAttribute.class);
     }
 
     /**
-     * Construct a new hash doc attribute set,
-     * initially populated with the values from the given array.
-     * The new attribute set is populated by
-     * adding the elements of {@code attributes} array to the set in
-     * sequence, starting at index 0. Thus, later array elements may replace
-     * earlier array elements if the array contains duplicate attribute
-     * values or attribute categories.
+     * Construct a new hash doc attribute set, initially populated with the
+     * values from the given array. The new attribute set is populated by adding
+     * the elements of {@code attributes} array to the set in sequence, starting
+     * at index 0. Thus, later array elements may replace earlier array elements
+     * if the array contains duplicate attribute values or attribute categories.
      *
-     * @param  attributes  Array of attribute values to add to the set.
-     *                     If null, an empty attribute set is constructed.
-     *
-     * @exception  NullPointerException
-     *  (unchecked exception)
-     * Thrown if any element of {@code attributes} is null.
+     * @param  attributes array of attribute values to add to the set. If
+     *         {@code null}, an empty attribute set is constructed.
+     * @throws NullPointerException if any element of {@code attributes} is
+     *         {@code null}
      */
     public HashDocAttributeSet(DocAttribute[] attributes) {
         super (attributes, DocAttribute.class);
     }
 
     /**
-     * Construct a new attribute set, initially populated with the
-     * values from the  given set where the members of the attribute set
-     * are restricted to the {@code DocAttribute} interface.
+     * Construct a new attribute set, initially populated with the values from
+     * the given set where the members of the attribute set are restricted to
+     * the {@code DocAttribute} interface.
      *
      * @param  attributes set of attribute values to initialise the set. If
-     *                    null, an empty attribute set is constructed.
-     *
-     * @exception  ClassCastException
-     *     (unchecked exception) Thrown if any element of
-     * {@code attributes} is not an instance of
-     * {@code DocAttribute}.
+     *         {@code null}, an empty attribute set is constructed.
+     * @throws ClassCastException if any element of {@code attributes} is not an
+     *         instance of {@code DocAttribute}
      */
     public HashDocAttributeSet(DocAttributeSet attributes) {
         super(attributes, DocAttribute.class);
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,22 +23,24 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
 
 /**
- * Class HashPrintJobAttributeSet provides an attribute set
- * which inherits its implementation from class {@link HashAttributeSet
- * HashAttributeSet} and enforces the semantic restrictions of interface
- * {@link PrintJobAttributeSet PrintJobAttributeSet}.
+ * Class {@code HashPrintJobAttributeSet} provides an attribute set which
+ * inherits its implementation from class
+ * {@link HashAttributeSet HashAttributeSet} and enforces the semantic
+ * restrictions of interface {@link PrintJobAttributeSet PrintJobAttributeSet}.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class HashPrintJobAttributeSet extends HashAttributeSet
     implements PrintJobAttributeSet, Serializable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -4204473656070350348L;
 
     /**
@@ -49,49 +51,42 @@
     }
 
     /**
-     * Construct a new hash print job attribute set,
-     * initially populated with the given value.
+     * Construct a new hash print job attribute set, initially populated with
+     * the given value.
      *
-     * @param  attribute  Attribute value to add to the set.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code attribute} is null.
+     * @param  attribute attribute value to add to the set
+     * @throws NullPointerException if {@code attribute} is {@code null}
      */
     public HashPrintJobAttributeSet(PrintJobAttribute attribute) {
         super(attribute, PrintJobAttribute.class);
     }
 
     /**
-     * Construct a new hash print job attribute set,
-     * initially populated with the values from the given array.
-     * The new attribute set is populated
-     * by adding the elements of {@code attributes} array to the set in
-     * sequence, starting at index 0. Thus, later array elements may replace
-     * earlier array elements if the array contains duplicate attribute
-     * values or attribute categories.
+     * Construct a new hash print job attribute set, initially populated with
+     * the values from the given array. The new attribute set is populated by
+     * adding the elements of {@code attributes} array to the set in sequence,
+     * starting at index 0. Thus, later array elements may replace earlier array
+     * elements if the array contains duplicate attribute values or attribute
+     * categories.
      *
-     * @param  attributes Array of attribute values to add to the set.
-     *                    If null, an empty attribute set is constructed.
-     *
-     * @exception  NullPointerException (unchecked exception)
-     * Thrown if any element of {@code attributes}  is null.
+     * @param  attributes array of attribute values to add to the set. If
+     *         {@code null}, an empty attribute set is constructed.
+     * @throws NullPointerException if any element of {@code attributes} is
+     *         {@code null}
      */
     public HashPrintJobAttributeSet(PrintJobAttribute[] attributes) {
         super (attributes, PrintJobAttribute.class);
     }
 
     /**
-     * Construct a new attribute set, initially populated with the
-     * values from the  given set where the members of the attribute set
-     * are restricted to the {@code PrintJobAttribute} interface.
+     * Construct a new attribute set, initially populated with the values from
+     * the given set where the members of the attribute set are restricted to
+     * the {@code PrintJobAttribute} interface.
      *
      * @param  attributes set of attribute values to initialise the set. If
-     *                    null, an empty attribute set is constructed.
-     *
-     * @exception  ClassCastException
-     *     (unchecked exception) Thrown if any element of
-     * {@code attributes} is not an instance of
-     * {@code PrintJobAttribute}.
+     *         {@code null}, an empty attribute set is constructed.
+     * @throws ClassCastException if any element of {@code attributes} is not an
+     *         instance of {@code PrintJobAttribute}
      */
     public HashPrintJobAttributeSet(PrintJobAttributeSet attributes) {
         super(attributes, PrintJobAttribute.class);
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,22 +23,24 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
 
 /**
- * Class HashPrintRequestAttributeSet inherits its implementation from
- * class {@link HashAttributeSet HashAttributeSet} and enforces the
- * semantic restrictions of interface
+ * Class {@code HashPrintRequestAttributeSet} inherits its implementation from
+ * class {@link HashAttributeSet HashAttributeSet} and enforces the semantic
+ * restrictions of interface
  * {@link PrintRequestAttributeSet PrintRequestAttributeSet}.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class HashPrintRequestAttributeSet extends HashAttributeSet
     implements PrintRequestAttributeSet, Serializable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 2364756266107751933L;
 
     /**
@@ -49,55 +51,44 @@
     }
 
     /**
-     * Construct a new print request attribute set,
-     * initially populated with the given value.
+     * Construct a new print request attribute set, initially populated with the
+     * given value.
      *
-     * @param  attribute  Attribute value to add to the set.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code attribute} is null.
+     * @param  attribute attribute value to add to the set
+     * @throws NullPointerException if {@code attribute} is {@code null}
      */
     public HashPrintRequestAttributeSet(PrintRequestAttribute attribute) {
         super (attribute, PrintRequestAttribute.class);
     }
 
     /**
-     * Construct a new print request attribute set, initially populated with
-     * the values from the given array. The new attribute set is populated
-     * by adding the elements of {@code attributes} array to the set in
-     * sequence, starting at index 0. Thus, later array elements may replace
-     * earlier array elements if the array contains duplicate attribute
-     * values or attribute categories.
+     * Construct a new print request attribute set, initially populated with the
+     * values from the given array. The new attribute set is populated by adding
+     * the elements of {@code attributes} array to the set in sequence, starting
+     * at index 0. Thus, later array elements may replace earlier array elements
+     * if the array contains duplicate attribute values or attribute categories.
      *
-     * @param  attributes  Array of attribute values to add to the set.
-     *                     If null, an empty attribute set is constructed.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception)
-     * Thrown if any element of {@code attributes} is null.
+     * @param  attributes array of attribute values to add to the set. If
+     *         {@code null}, an empty attribute set is constructed.
+     * @throws NullPointerException if any element of {@code attributes} is
+     *         {@code null}
      */
     public HashPrintRequestAttributeSet(PrintRequestAttribute[] attributes) {
         super (attributes, PrintRequestAttribute.class);
     }
 
-
     /**
-     * Construct a new attribute set, initially populated with the
-     * values from the  given set where the members of the attribute set
-     * are restricted to the {@code (PrintRequestAttributeSe} interface.
+     * Construct a new attribute set, initially populated with the values from
+     * the given set where the members of the attribute set are restricted to
+     * the {@code (PrintRequestAttributeSe} interface.
      *
      * @param  attributes set of attribute values to initialise the set. If
-     *                    null, an empty attribute set is constructed.
-     *
-     * @exception  ClassCastException
-     *     (unchecked exception) Thrown if any element of
-     * {@code attributes} is not an instance of
-     * {@code (PrintRequestAttributeSe}.
+     *         {@code null}, an empty attribute set is constructed.
+     * @throws ClassCastException if any element of {@code attributes} is not an
+     *         instance of {@code PrintRequestAttributeSe}
      */
     public HashPrintRequestAttributeSet(PrintRequestAttributeSet attributes)
     {
         super(attributes, PrintRequestAttribute.class);
     }
-
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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,16 +28,20 @@
 import java.io.Serializable;
 
 /**
- * Class HashPrintServiceAttributeSet provides an attribute set
- * which inherits its implementation from class {@link HashAttributeSet
- * HashAttributeSet} and enforces the semantic restrictions of interface
+ * Class {@code HashPrintServiceAttributeSet} provides an attribute set which
+ * inherits its implementation from class
+ * {@link HashAttributeSet HashAttributeSet} and enforces the semantic
+ * restrictions of interface
  * {@link PrintServiceAttributeSet PrintServiceAttributeSet}.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class HashPrintServiceAttributeSet extends HashAttributeSet
     implements PrintServiceAttributeSet, Serializable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 6642904616179203070L;
 
     /**
@@ -47,52 +51,42 @@
         super (PrintServiceAttribute.class);
     }
 
-
     /**
-     * Construct a new hash print service attribute set,
-     *  initially populated with the given value.
+     * Construct a new hash print service attribute set, initially populated
+     * with the given value.
      *
-     * @param  attribute  Attribute value to add to the set.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code attribute} is null.
+     * @param  attribute attribute value to add to the set
+     * @throws NullPointerException if {@code attribute} is {@code null}
      */
     public HashPrintServiceAttributeSet(PrintServiceAttribute attribute) {
         super (attribute, PrintServiceAttribute.class);
     }
 
     /**
-     * Construct a new print service attribute set, initially populated with
-     * the values from the given array. The new attribute set is populated
-     * by adding the elements of {@code attributes} array to the set in
-     * sequence, starting at index 0. Thus, later array elements may replace
-     * earlier array elements if the array contains duplicate attribute
-     * values or attribute categories.
+     * Construct a new print service attribute set, initially populated with the
+     * values from the given array. The new attribute set is populated by adding
+     * the elements of {@code attributes} array to the set in sequence, starting
+     * at index 0. Thus, later array elements may replace earlier array elements
+     * if the array contains duplicate attribute values or attribute categories.
      *
-     * @param  attributes  Array of attribute values to add to the set.
-     *                    If null, an empty attribute set is constructed.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception)
-     *      Thrown if any element of {@code attributes} is null.
+     * @param  attributes array of attribute values to add to the set. If
+     *         {@code null}, an empty attribute set is constructed.
+     * @throws NullPointerException if any element of {@code attributes} is
+     *         {@code null}
      */
     public HashPrintServiceAttributeSet(PrintServiceAttribute[] attributes) {
         super (attributes, PrintServiceAttribute.class);
     }
 
-
     /**
-     * Construct a new attribute set, initially populated with the
-     * values from the  given set where the members of the attribute set
-     * are restricted to the {@code PrintServiceAttribute} interface.
+     * Construct a new attribute set, initially populated with the values from
+     * the given set where the members of the attribute set are restricted to
+     * the {@code PrintServiceAttribute} interface.
      *
      * @param  attributes set of attribute values to initialise the set. If
-     *                    null, an empty attribute set is constructed.
-     *
-     * @exception  ClassCastException
-     *     (unchecked exception) Thrown if any element of
-     * {@code attributes} is not an instance of
-     * {@code PrintServiceAttribute}.
+     *         {@code null}, an empty attribute set is constructed.
+     * @throws ClassCastException if any element of {@code attributes} is not an
+     *         instance of {@code PrintServiceAttribute}
      */
     public HashPrintServiceAttributeSet(PrintServiceAttributeSet attributes)
     {
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/IntegerSyntax.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/IntegerSyntax.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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,25 +28,28 @@
 import java.io.Serializable;
 
 /**
- * Class IntegerSyntax is an abstract base class providing the common
+ * Class {@code IntegerSyntax} is an abstract base class providing the common
  * implementation of all attributes with integer values.
- * <P>
+ * <p>
  * Under the hood, an integer attribute is just an integer. You can get an
- * integer attribute's integer value by calling {@link #getValue()
- * getValue()}. An integer attribute's integer value is
- * established when it is constructed (see {@link #IntegerSyntax(int)
- * IntegerSyntax(int)}). Once constructed, an integer attribute's
- * value is immutable.
+ * integer attribute's integer value by calling {@link #getValue() getValue()}.
+ * An integer attribute's integer value is established when it is constructed
+ * (see {@link #IntegerSyntax(int) IntegerSyntax(int)}). Once constructed, an
+ * integer attribute's value is immutable.
  *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
  */
 public abstract class IntegerSyntax implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 3644574816328081943L;
 
     /**
      * This integer attribute's integer value.
+     *
      * @serial
      */
     private int value;
@@ -54,7 +57,7 @@
     /**
      * Construct a new integer attribute with the given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected IntegerSyntax(int value) {
         this.value = value;
@@ -64,14 +67,11 @@
      * Construct a new integer attribute with the given integer value, which
      * must lie within the given range.
      *
-     * @param  value       Integer value.
-     * @param  lowerBound  Lower bound.
-     * @param  upperBound  Upper bound.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if {@code value} is less than
-     *     {@code lowerBound} or greater than
-     *     {@code upperBound}.
+     * @param  value Integer value
+     * @param  lowerBound Lower bound
+     * @param  upperBound Upper bound
+     * @throws IllegalArgumentException if {@code value} is less than
+     *         {@code lowerBound} or greater than {@code upperBound}
      */
     protected IntegerSyntax(int value, int lowerBound, int upperBound) {
         if (lowerBound > value || value > upperBound) {
@@ -84,6 +84,7 @@
 
     /**
      * Returns this integer attribute's integer value.
+     *
      * @return the integer value
      */
     public int getValue() {
@@ -93,20 +94,16 @@
     /**
      * Returns whether this integer attribute is equivalent to the passed in
      * object. To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class IntegerSyntax.
-     * <LI>
-     * This integer attribute's value and {@code object}'s value are
-     * equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code IntegerSyntax}.
+     *   <li>This integer attribute's value and {@code object}'s value are
+     *   equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this integer
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this integer
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
 
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttribute.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttribute.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -26,19 +26,18 @@
 package javax.print.attribute;
 
 /**
- * PrintJobAttribute is a tagging interface which a printing attribute
+ * {@code PrintJobAttribute} is a tagging interface which a printing attribute
  * class implements to indicate the attribute describes the status of a Print
- * Job or some other characteristic of a Print Job. A Print Service
- * instance adds a number of PrintJobAttributes to a Print Job's attribute set
- * to report the Print Job's status. If an attribute implements {@link
- * PrintRequestAttribute PrintRequestAttribute} as well as PrintJobAttribute,
- * the client may include the attribute in a attribute set to
- * specify the attribute's value for the Print Job.
+ * Job or some other characteristic of a Print Job. A Print Service instance
+ * adds a number of {@code PrintJobAttributes} to a Print Job's attribute set to
+ * report the Print Job's status. If an attribute implements
+ * {@link PrintRequestAttribute PrintRequestAttribute} as well as
+ * {@code PrintJobAttribute}, the client may include the attribute in a
+ * attribute set to specify the attribute's value for the Print Job.
  *
+ * @author Alan Kaminsky
  * @see PrintRequestAttributeSet
  * @see PrintJobAttributeSet
- *
- * @author  Alan Kaminsky
  */
 public interface PrintJobAttribute extends Attribute {
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,85 +23,69 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 /**
- * Interface PrintJobAttributeSet specifies the interface for a set of print
- * job attributes, i.e. printing attributes that implement interface {@link
- * PrintJobAttribute PrintJobAttribute}. In the Print Service API, a
- * service uses a PrintJobAttributeSet to report the status of a print job.
- * <P>
- * A PrintJobAttributeSet is just an {@link AttributeSet AttributeSet} whose
- * constructors and mutating operations guarantee an additional invariant,
- * namely that all attribute values in the PrintJobAttributeSet must be
- * instances of interface {@link PrintJobAttribute PrintJobAttribute}.
- * The {@link #add(Attribute) add(Attribute)}, and
- * {@link #addAll(AttributeSet) >addAll(AttributeSet)} operations
- * are respecified below to guarantee this additional invariant.
+ * Interface {@code PrintJobAttributeSet} specifies the interface for a set of
+ * print job attributes, i.e. printing attributes that implement interface
+ * {@link PrintJobAttribute PrintJobAttribute}. In the Print Service API, a
+ * service uses a {@code PrintJobAttributeSet} to report the status of a print
+ * job.
+ * <p>
+ * A {@code PrintJobAttributeSet} is just an {@link AttributeSet AttributeSet}
+ * whose constructors and mutating operations guarantee an additional invariant,
+ * namely that all attribute values in the {@code PrintJobAttributeSet} must be
+ * instances of interface {@link PrintJobAttribute PrintJobAttribute}. The
+ * {@link #add(Attribute) add(Attribute)}, and
+ * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified
+ * below to guarantee this additional invariant.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public interface PrintJobAttributeSet extends AttributeSet {
 
     /**
      * Adds the specified attribute value to this attribute set if it is not
-     * already present, first removing any existing value in the same
-     * attribute category as the specified attribute value (optional
-     * operation).
-     *
-     * @param  attribute  Attribute value to be added to this attribute set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of
-     *          the call, i.e., the given attribute value was not already a
-     *          member of this attribute set.
+     * already present, first removing any existing value in the same attribute
+     * category as the specified attribute value (optional operation).
      *
-     * @throws  UnmodifiableSetException
-     *     (unchecked exception) Thrown if this attribute set does not
-     *     support the {@code add()} operation.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if the {@code attribute} is
-     *     not an instance of interface
-     *     {@link PrintJobAttribute PrintJobAttribute}.
-     * @throws  NullPointerException
-     *    (unchecked exception) Thrown if the {@code attribute} is null.
+     * @param  attribute attribute value to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call, i.e., the given attribute value was not already a member of
+     *         this attribute set
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code add()} operation
+     * @throws ClassCastException if the {@code attribute} is not an instance of
+     *         interface {@link PrintJobAttribute PrintJobAttribute}
+     * @throws NullPointerException if the {@code attribute} is {@code null}
      */
     public boolean add(Attribute attribute);
 
     /**
-     * Adds all of the elements in the specified set to this attribute.
-     * The outcome is  the same as if the
-     * {@link #add(Attribute) add(Attribute)}
-     * operation had been applied to this attribute set successively with
-     * each element from the specified set. If none of the categories in the
-     * specified set  are the same as any categories in this attribute set,
-     * the {@code addAll()} operation effectively modifies this attribute
-     * set so that its value is the <i>union</i> of the two sets.
-     * <P>
-     * The behavior of the {@code addAll()} operation is unspecified if
-     * the specified set is modified while the operation is in progress.
-     * <P>
-     * If the {@code addAll()} operation throws an exception, the effect
-     * on this attribute set's state is implementation dependent; elements
-     * from the specified set before the point of the exception may or
-     * may not have been added to this attribute set.
+     * Adds all of the elements in the specified set to this attribute. The
+     * outcome is the same as if the {@link #add(Attribute) add(Attribute)}
+     * operation had been applied to this attribute set successively with each
+     * element from the specified set. If none of the categories in the
+     * specified set are the same as any categories in this attribute set, the
+     * {@code addAll()} operation effectively modifies this attribute set so
+     * that its value is the <i>union</i> of the two sets.
+     * <p>
+     * The behavior of the {@code addAll()} operation is unspecified if the
+     * specified set is modified while the operation is in progress.
+     * <p>
+     * If the {@code addAll()} operation throws an exception, the effect on this
+     * attribute set's state is implementation dependent; elements from the
+     * specified set before the point of the exception may or may not have been
+     * added to this attribute set.
      *
-     * @param  attributes  whose elements are to be added to this attribute
-     *            set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of
-     *          the call.
-     *
-     * @throws  UnmodifiableSetException
-     *     (Unchecked exception) Thrown if this attribute set does not
-     *     support the {@code addAll()} method.
-     * @throws  ClassCastException
-     *     (Unchecked exception) Thrown if some element in the specified
-     *     set is not an instance of interface {@link PrintJobAttribute
-     *     PrintJobAttribute}.
-     * @throws  NullPointerException
-     *     (Unchecked exception) Thrown if the specified  set is null.
-     *
+     * @param  attributes whose elements are to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code addAll()} method
+     * @throws ClassCastException if some element in the specified set is not an
+     *         instance of interface {@link PrintJobAttribute PrintJobAttribute}
+     * @throws NullPointerException if the specified set is {@code null}
      * @see #add(Attribute)
      */
     public boolean addAll(AttributeSet attributes);
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttribute.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttribute.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,28 +23,25 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 /**
- * Interface PrintRequestAttribute is a tagging interface which a printing
- * attribute class implements to indicate the attribute denotes a
+ * Interface {@code PrintRequestAttribute} is a tagging interface which a
+ * printing attribute class implements to indicate the attribute denotes a
  * requested setting for a print job.
  * <p>
- * Attributes which are tagged with PrintRequestAttribute and are also tagged
- * as PrintJobAttribute, represent the subset of job attributes which
- * can be part of the specification of a job request.
+ * Attributes which are tagged with {@code PrintRequestAttribute} and are also
+ * tagged as {@code PrintJobAttribute}, represent the subset of job attributes
+ * which can be part of the specification of a job request.
  * <p>
- * If an attribute implements {@link DocAttribute  DocAttribute}
- * as well as PrintRequestAttribute, the client may include the
- * attribute in a {@code Doc}'s attribute set to specify
- * a job setting which pertains just to that doc.
+ * If an attribute implements {@link DocAttribute DocAttribute} as well as
+ * {@code PrintRequestAttribute}, the client may include the attribute in a
+ * {@code Doc}'s attribute set to specify a job setting which pertains just to
+ * that doc.
  *
+ * @author Alan Kaminsky
  * @see DocAttributeSet
  * @see PrintRequestAttributeSet
- *
- * @author  Alan Kaminsky
  */
-
 public interface PrintRequestAttribute extends Attribute {
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,88 +23,72 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 /**
- * Interface PrintRequestAttributeSet specifies the interface for a set of
- * print request attributes, i.e. printing attributes that implement interface
- * {@link PrintRequestAttribute PrintRequestAttribute}.
- * The client uses a PrintRequestAttributeSet to specify the settings to be
- * applied to a whole print job and to all the docs in the print job.
- * <P>
- * PrintRequestAttributeSet is just an {@link AttributeSet AttributeSet} whose
- * constructors and mutating operations guarantee an additional invariant,
- * namely that all attribute values in the PrintRequestAttributeSet must be
- * instances of interface {@link PrintRequestAttribute PrintRequestAttribute}.
- * The {@link #add(Attribute) add(Attribute)}, and
- * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations
- * are respecified below to guarantee this additional invariant.
+ * Interface {@code PrintRequestAttributeSet} specifies the interface for a set
+ * of print request attributes, i.e. printing attributes that implement
+ * interface {@link PrintRequestAttribute PrintRequestAttribute}. The client
+ * uses a {@code PrintRequestAttributeSet} to specify the settings to be applied
+ * to a whole print job and to all the docs in the print job.
+ * <p>
+ * {@code PrintRequestAttributeSet} is just an {@link AttributeSet AttributeSet}
+ * whose constructors and mutating operations guarantee an additional invariant,
+ * namely that all attribute values in the {@code PrintRequestAttributeSet} must
+ * be instances of interface
+ * {@link PrintRequestAttribute PrintRequestAttribute}. The
+ * {@link #add(Attribute) add(Attribute)}, and
+ * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified
+ * below to guarantee this additional invariant.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public interface PrintRequestAttributeSet extends AttributeSet {
 
     /**
      * Adds the specified attribute value to this attribute set if it is not
-     * already present, first removing any existing value in the same
-     * attribute category as the specified attribute value (optional
-     * operation).
-     *
-     * @param  attribute  Attribute value to be added to this attribute set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of
-     *          the call, i.e., the given attribute value was not already a
-     *          member of this attribute set.
+     * already present, first removing any existing value in the same attribute
+     * category as the specified attribute value (optional operation).
      *
-     * @throws  UnmodifiableSetException
-     *     (unchecked exception) Thrown if this attribute set does not
-     *     support the {@code add()} operation.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if the {@code attribute} is
-     *     not an instance of interface
-     *     {@link PrintRequestAttribute PrintRequestAttribute}.
-     * @throws  NullPointerException
-     *     (unchecked exception) Thrown if the {@code attribute} is null.
+     * @param  attribute attribute value to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call, i.e., the given attribute value was not already a member of
+     *         this attribute set
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code add()} operation
+     * @throws ClassCastException if the {@code attribute} is not an instance of
+     *         interface {@link PrintRequestAttribute PrintRequestAttribute}
+     * @throws NullPointerException if the {@code attribute} is {@code null}
      */
     public boolean add(Attribute attribute);
 
     /**
-     * Adds all of the elements in the specified set to this attribute.
-     * The outcome is  the same as if the
-     * {@link #add(Attribute) add(Attribute)}
-     * operation had been applied to this attribute set successively with
-     * each element from the specified set. If none of the categories in the
-     * specified set  are the same as any categories in this attribute set,
-     * the {@code addAll()} operation effectively modifies this attribute
-     * set so that its value is the <i>union</i> of the two sets.
-     * <P>
-     * The behavior of the {@code addAll()} operation is unspecified if
-     * the specified set is modified while the operation is in progress.
-     * <P>
-     * If the {@code addAll()} operation throws an exception, the effect
-     * on this attribute set's state is implementation dependent; elements
-     * from the specified set before the point of the exception may or
-     * may not have been added to this attribute set.
+     * Adds all of the elements in the specified set to this attribute. The
+     * outcome is the same as if the {@link #add(Attribute) add(Attribute)}
+     * operation had been applied to this attribute set successively with each
+     * element from the specified set. If none of the categories in the
+     * specified set are the same as any categories in this attribute set, the
+     * {@code addAll()} operation effectively modifies this attribute set so
+     * that its value is the <i>union</i> of the two sets.
+     * <p>
+     * The behavior of the {@code addAll()} operation is unspecified if the
+     * specified set is modified while the operation is in progress.
+     * <p>
+     * If the {@code addAll()} operation throws an exception, the effect on this
+     * attribute set's state is implementation dependent; elements from the
+     * specified set before the point of the exception may or may not have been
+     * added to this attribute set.
      *
-     * @param  attributes  whose elements are to be added to this attribute
-     *            set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of
-     *          the call.
-     *
-     * @throws  UnmodifiableSetException
-     *     (Unchecked exception) Thrown if this attribute set does not
-     *     support the {@code addAll()} method.
-     * @throws  ClassCastException
-     *     (Unchecked exception) Thrown if some element in the specified
-     *     set is not an instance of interface {@link PrintRequestAttribute
-     *     PrintRequestAttribute}.
-     * @throws  NullPointerException
-     *     (Unchecked exception) Thrown if the specified  set is null.
-     *
+     * @param  attributes whose elements are to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code addAll()} method
+     * @throws ClassCastException if some element in the specified set is not an
+     *         instance of interface
+     *         {@link PrintRequestAttribute PrintRequestAttribute}
+     * @throws NullPointerException if the specified set is {@code null}
      * @see #add(Attribute)
      */
     public boolean addAll(AttributeSet attributes);
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttribute.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttribute.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -26,15 +26,14 @@
 package javax.print.attribute;
 
 /**
- * Interface PrintServiceAttribute is a tagging interface which a printing
- * attribute class implements to indicate the attribute describes the status
- * of a Print Service or some other characteristic of a Print Service. A Print
- * Service instance adds a number of PrintServiceAttributes to a Print
- * service's attribute set to report the Print Service's status.
+ * Interface {@code PrintServiceAttribute} is a tagging interface which a
+ * printing attribute class implements to indicate the attribute describes the
+ * status of a Print Service or some other characteristic of a Print Service. A
+ * Print Service instance adds a number of {@code PrintServiceAttributes} to a
+ * Print service's attribute set to report the Print Service's status.
  *
+ * @author Alan Kaminsky
  * @see PrintServiceAttributeSet
- *
- * @author  Alan Kaminsky
  */
 public interface PrintServiceAttribute extends Attribute {
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttributeSet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttributeSet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,90 +23,71 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 /**
- * Interface PrintServiceAttributeSet specifies the interface for a set of
- * print job attributes, i.e. printing attributes that implement interface
- * {@link
- * PrintServiceAttribute PrintServiceAttribute}. In the Print Service API,
- * the Print Service instance uses a PrintServiceAttributeSet to report the
- * status of the print service.
- * <P>
- * A PrintServiceAttributeSet is just an {@link AttributeSet AttributeSet}
- * whose constructors and mutating operations guarantee an additional
- * invariant,
- * namely that all attribute values in the PrintServiceAttributeSet must be
- * instances of interface {@link PrintServiceAttribute PrintServiceAttribute}.
- * The {@link #add(Attribute) add(Attribute)}, and
- * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations
- * are respecified below to guarantee this additional invariant.
+ * Interface {@code PrintServiceAttributeSet} specifies the interface for a set
+ * of print job attributes, i.e. printing attributes that implement interface
+ * {@link PrintServiceAttribute PrintServiceAttribute}. In the Print Service
+ * API, the Print Service instance uses a {@code PrintServiceAttributeSet} to
+ * report the status of the print service.
+ * <p>
+ * A {@code PrintServiceAttributeSet} is just an
+ * {@link AttributeSet AttributeSet} whose constructors and mutating operations
+ * guarantee an additional invariant, namely that all attribute values in the
+ * {@code PrintServiceAttributeSet} must be instances of interface
+ * {@link PrintServiceAttribute PrintServiceAttribute}. The
+ * {@link #add(Attribute) add(Attribute)}, and
+ * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified
+ * below to guarantee this additional invariant.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public interface PrintServiceAttributeSet extends AttributeSet {
 
-
-
     /**
      * Adds the specified attribute value to this attribute set if it is not
-     * already present, first removing any existing value in the same
-     * attribute category as the specified attribute value (optional
-     * operation).
-     *
-     * @param  attribute  Attribute value to be added to this attribute set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of
-     *          the call, i.e., the given attribute value was not already a
-     *          member of this attribute set.
+     * already present, first removing any existing value in the same attribute
+     * category as the specified attribute value (optional operation).
      *
-     * @throws  UnmodifiableSetException
-     *     (unchecked exception) Thrown if this attribute set does not
-     *     support the {@code add()} operation.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if the {@code attribute} is
-     *     not an instance of interface
-     *     {@link PrintServiceAttribute PrintServiceAttribute}.
-     * @throws  NullPointerException
-     *    (unchecked exception) Thrown if the {@code attribute} is null.
+     * @param  attribute attribute value to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call, i.e., the given attribute value was not already a member of
+     *         this attribute set
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code add()} operation
+     * @throws ClassCastException if the {@code attribute} is not an instance of
+     *         interface {@link PrintServiceAttribute PrintServiceAttribute}
+     * @throws NullPointerException if the {@code attribute} is {@code null}
      */
     public boolean add(Attribute attribute);
 
     /**
-     * Adds all of the elements in the specified set to this attribute.
-     * The outcome is  the same as if the
-     * {@link #add(Attribute) add(Attribute)}
-     * operation had been applied to this attribute set successively with
-     * each element from the specified set. If none of the categories in the
-     * specified set  are the same as any categories in this attribute set,
-     * the {@code addAll()} operation effectively modifies this attribute
-     * set so that its value is the <i>union</i> of the two sets.
-     * <P>
-     * The behavior of the {@code addAll()} operation is unspecified if
-     * the specified set is modified while the operation is in progress.
-     * <P>
-     * If the {@code addAll()} operation throws an exception, the effect
-     * on this attribute set's state is implementation dependent; elements
-     * from the specified set before the point of the exception may or
-     * may not have been added to this attribute set.
+     * Adds all of the elements in the specified set to this attribute. The
+     * outcome is the same as if the {@link #add(Attribute) add(Attribute)}
+     * operation had been applied to this attribute set successively with each
+     * element from the specified set. If none of the categories in the
+     * specified set are the same as any categories in this attribute set, the
+     * {@code addAll()} operation effectively modifies this attribute set so
+     * that its value is the <i>union</i> of the two sets.
+     * <p>
+     * The behavior of the {@code addAll()} operation is unspecified if the
+     * specified set is modified while the operation is in progress.
+     * <p>
+     * If the {@code addAll()} operation throws an exception, the effect on this
+     * attribute set's state is implementation dependent; elements from the
+     * specified set before the point of the exception may or may not have been
+     * added to this attribute set.
      *
-     * @param  attributes  whose elements are to be added to this attribute
-     *            set.
-     *
-     * @return  {@code true} if this attribute set changed as a result of
-     *          the call.
-     *
-     * @throws  UnmodifiableSetException
-     *     (Unchecked exception) Thrown if this attribute set does not
-     *     support the {@code addAll()} method.
-     * @throws  ClassCastException
-     *     (Unchecked exception) Thrown if some element in the specified
-     *     set is not an instance of interface {@link PrintServiceAttribute
-     *     PrintServiceAttribute}.
-     * @throws  NullPointerException
-     *     (Unchecked exception) Thrown if the specified  set is null.
-     *
+     * @param  attributes whose elements are to be added to this attribute set
+     * @return {@code true} if this attribute set changed as a result of the
+     *         call
+     * @throws UnmodifiableSetException if this attribute set does not support
+     *         the {@code addAll()} method
+     * @throws ClassCastException if some element in the specified set is not an
+     *         instance of interface
+     *         {@link PrintServiceAttribute PrintServiceAttribute}
+     * @throws NullPointerException if the specified set is {@code null}
      * @see #add(Attribute)
      */
     public boolean addAll(AttributeSet attributes);
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/ResolutionSyntax.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/ResolutionSyntax.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,29 +23,27 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
 
 /**
- * Class ResolutionSyntax is an abstract base class providing the common
+ * Class {@code ResolutionSyntax} is an abstract base class providing the common
  * implementation of all attributes denoting a printer resolution.
- * <P>
+ * <p>
  * A resolution attribute's value consists of two items, the cross feed
  * direction resolution and the feed direction resolution. A resolution
  * attribute may be constructed by supplying the two values and indicating the
  * units in which the values are measured. Methods are provided to return a
  * resolution attribute's values, indicating the units in which the values are
  * to be returned. The two most common resolution units are dots per inch (dpi)
- * and dots per centimeter (dpcm), and exported constants {@link #DPI
- * DPI} and {@link #DPCM DPCM} are provided for
- * indicating those units.
- * <P>
+ * and dots per centimeter (dpcm), and exported constants {@link #DPI DPI} and
+ * {@link #DPCM DPCM} are provided for indicating those units.
+ * <p>
  * Once constructed, a resolution attribute's value is immutable.
- * <P>
- * <B>Design</B>
- * <P>
+ * <p>
+ * <b>Design</b>
+ * <p>
  * A resolution attribute's cross feed direction resolution and feed direction
  * resolution values are stored internally using units of dots per 100 inches
  * (dphi). Storing the values in dphi rather than, say, metric units allows
@@ -57,43 +55,47 @@
  * resolution attribute's values are created in one units and retrieved in
  * different units; for example, 600 dpi will be rounded to 236 dpcm, whereas
  * the true value (to five figures) is 236.22 dpcm.
- * <P>
+ * <p>
  * Storing the values internally in common units of dphi lets two resolution
  * attributes be compared without regard to the units in which they were
  * created; for example, 300 dpcm will compare equal to 762 dpi, as they both
- * are stored as 76200 dphi. In particular, a lookup service can
- * match resolution attributes based on equality of their serialized
- * representations regardless of the units in which they were created. Again,
- * using integers for internal storage allows precise equality comparisons to be
- * done, which would not be guaranteed if a floating point representation were
- * used.
- * <P>
- * The exported constant {@link #DPI DPI} is actually the
- * conversion factor by which to multiply a value in dpi to get the value in
- * dphi. Likewise, the exported constant {@link #DPCM DPCM} is the
- * conversion factor by which to multiply a value in dpcm to get the value in
- * dphi. A client can specify a resolution value in units other than dpi or dpcm
- * by supplying its own conversion factor. However, since the internal units of
- * dphi was chosen with supporting only the external units of dpi and dpcm in
- * mind, there is no guarantee that the conversion factor for the client's units
- * will be an exact integer. If the conversion factor isn't an exact integer,
- * resolution values in the client's units won't be stored precisely.
+ * are stored as 76200 dphi. In particular, a lookup service can match
+ * resolution attributes based on equality of their serialized representations
+ * regardless of the units in which they were created. Again, using integers for
+ * internal storage allows precise equality comparisons to be done, which would
+ * not be guaranteed if a floating point representation were used.
+ * <p>
+ * The exported constant {@link #DPI DPI} is actually the conversion factor by
+ * which to multiply a value in dpi to get the value in dphi. Likewise, the
+ * exported constant {@link #DPCM DPCM} is the conversion factor by which to
+ * multiply a value in dpcm to get the value in dphi. A client can specify a
+ * resolution value in units other than dpi or dpcm by supplying its own
+ * conversion factor. However, since the internal units of dphi was chosen with
+ * supporting only the external units of dpi and dpcm in mind, there is no
+ * guarantee that the conversion factor for the client's units will be an exact
+ * integer. If the conversion factor isn't an exact integer, resolution values
+ * in the client's units won't be stored precisely.
  *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
  */
 public abstract class ResolutionSyntax implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 2706743076526672017L;
 
     /**
      * Cross feed direction resolution in units of dots per 100 inches (dphi).
+     *
      * @serial
      */
     private int crossFeedResolution;
 
     /**
      * Feed direction resolution in units of dots per 100 inches (dphi).
+     *
      * @serial
      */
     private int feedResolution;
@@ -105,26 +107,20 @@
     public static final int DPI = 100;
 
     /**
-     * Value to indicate units of dots per centimeter (dpcm). It is actually
-     * the conversion factor by which to multiply dpcm to yield dphi (254).
+     * Value to indicate units of dots per centimeter (dpcm). It is actually the
+     * conversion factor by which to multiply dpcm to yield dphi (254).
      */
     public static final int DPCM = 254;
 
-
     /**
      * Construct a new resolution attribute from the given items.
      *
-     * @param  crossFeedResolution
-     *     Cross feed direction resolution.
-     * @param  feedResolution
-     *     Feed direction resolution.
-     * @param units
-     *     Unit conversion factor, e.g. {@link #DPI DPI} or
-     * {@link    #DPCM DPCM}.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code crossFeedResolution < 1}
-     *     or {@code feedResolution < 1} or {@code units < 1}.
+     * @param  crossFeedResolution cross feed direction resolution
+     * @param  feedResolution feed direction resolution
+     * @param  units unit conversion factor, e.g. {@link #DPI DPI} or
+     *         {@link #DPCM DPCM}
+     * @throws IllegalArgumentException if {@code crossFeedResolution < 1} or
+     *         {@code feedResolution < 1} or {@code units < 1}
      */
     public ResolutionSyntax(int crossFeedResolution, int feedResolution,
                             int units) {
@@ -147,16 +143,11 @@
      * Convert a value from dphi to some other units. The result is rounded to
      * the nearest integer.
      *
-     * @param  dphi
-     *     Value (dphi) to convert.
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #DPI DPI} or
-     *     {@link #DPCM DPCM}.
-     *
-     * @return  The value of {@code dphi} converted to the desired units.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units} < 1.
+     * @param  dphi value (dphi) to convert
+     * @param  units unit conversion factor, e.g. {@link #DPI DPI} or
+     *        {@link #DPCM DPCM}
+     * @return the value of {@code dphi} converted to the desired units
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     private static int convertFromDphi(int dphi, int units) {
         if (units < 1) {
@@ -167,18 +158,14 @@
     }
 
     /**
-     * Get this resolution attribute's resolution values in the given units.
-     * The values are rounded to the nearest integer.
+     * Get this resolution attribute's resolution values in the given units. The
+     * values are rounded to the nearest integer.
      *
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #DPI DPI} or
-     * {@link   #DPCM DPCM}.
-     *
-     * @return  A two-element array with the cross feed direction resolution
-     *          at index 0 and the feed direction resolution at index 1.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #DPI DPI} or
+     *         {@link #DPCM DPCM}
+     * @return a two-element array with the cross feed direction resolution at
+     *         index 0 and the feed direction resolution at index 1
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public int[] getResolution(int units) {
         return new int[] { getCrossFeedResolution(units),
@@ -190,14 +177,10 @@
      * Returns this resolution attribute's cross feed direction resolution in
      * the given units. The value is rounded to the nearest integer.
      *
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #DPI DPI} or
-     * {@link  #DPCM DPCM}.
-     *
-     * @return  Cross feed direction resolution.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #DPI DPI} or
+     *         {@link #DPCM DPCM}
+     * @return cross feed direction resolution
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public int getCrossFeedResolution(int units) {
         return convertFromDphi (crossFeedResolution, units);
@@ -207,14 +190,10 @@
      * Returns this resolution attribute's feed direction resolution in the
      * given units. The value is rounded to the nearest integer.
      *
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #DPI DPI} or {@link
-     *     #DPCM DPCM}.
-     *
-     * @return  Feed direction resolution.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #DPI DPI} or
+     *         {@link #DPCM DPCM}
+     * @return feed direction resolution
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public int getFeedResolution(int units) {
         return convertFromDphi (feedResolution, units);
@@ -222,22 +201,18 @@
 
     /**
      * Returns a string version of this resolution attribute in the given units.
-     * The string takes the form <code>"<I>C</I>x<I>F</I> <I>U</I>"</code>,
-     * where <I>C</I> is the cross feed direction resolution, <I>F</I> is the
-     * feed direction resolution, and <I>U</I> is the units name. The values are
+     * The string takes the form <code>"<i>C</i>x<i>F</i> <i>U</i>"</code>,
+     * where <i>C</i> is the cross feed direction resolution, <i>F</i> is the
+     * feed direction resolution, and <i>U</i> is the units name. The values are
      * rounded to the nearest integer.
      *
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #DPI CODE>DPI} or {@link
-     *     #DPCM DPCM}.
-     * @param  unitsName
-     *     Units name string, e.g. {@code "dpi"} or {@code "dpcm"}. If
-     *     null, no units name is appended to the result.
-     *
-     * @return  String version of this resolution attribute.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #DPI CODE>DPI} or
+     *         {@link #DPCM DPCM}
+     * @param  unitsName units name string, e.g. {@code "dpi"} or
+     *         {@code "dpcm"}. If {@code null}, no units name is appended to the
+     *         result.
+     * @return string version of this resolution attribute
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public String toString(int units, String unitsName) {
         StringBuilder result = new StringBuilder();
@@ -251,54 +226,43 @@
         return result.toString();
     }
 
-
     /**
-     * Determine whether this resolution attribute's value is less than or
-     * equal to the given resolution attribute's value. This is true if all
-     * of the following conditions are true:
-     * <UL>
-     * <LI>
-     * This attribute's cross feed direction resolution is less than or equal to
-     * the {@code other} attribute's cross feed direction resolution.
-     * <LI>
-     * This attribute's feed direction resolution is less than or equal to the
-     * {@code other} attribute's feed direction resolution.
-     * </UL>
+     * Determine whether this resolution attribute's value is less than or equal
+     * to the given resolution attribute's value. This is true if all of the
+     * following conditions are true:
+     * <ul>
+     *   <li>This attribute's cross feed direction resolution is less than or
+     *   equal to the {@code other} attribute's cross feed direction resolution.
+     *   <li>This attribute's feed direction resolution is less than or equal to
+     *   the {@code other} attribute's feed direction resolution.
+     * </ul>
      *
-     * @param  other  Resolution attribute to compare with.
-     *
-     * @return  True if this resolution attribute is less than or equal to the
-     *          {@code other} resolution attribute, false otherwise.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code other} is null.
+     * @param  other resolution attribute to compare with
+     * @return {@code true} if this resolution attribute is less than or equal
+     *         to the {@code other} resolution attribute, {@code false}
+     *         otherwise
+     * @throws NullPointerException if {@code other} is {@code null}
      */
     public boolean lessThanOrEquals(ResolutionSyntax other) {
         return (this.crossFeedResolution <= other.crossFeedResolution &&
                 this.feedResolution <= other.feedResolution);
     }
 
-
     /**
      * Returns whether this resolution attribute is equivalent to the passed in
      * object. To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class ResolutionSyntax.
-     * <LI>
-     * This attribute's cross feed direction resolution is equal to
-     * {@code object}'s cross feed direction resolution.
-     * <LI>
-     * This attribute's feed direction resolution is equal to
-     * {@code object}'s feed direction resolution.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code ResolutionSyntax}.
+     *   <li>This attribute's cross feed direction resolution is equal to
+     *   {@code object}'s cross feed direction resolution.
+     *   <li>This attribute's feed direction resolution is equal to
+     *   {@code object}'s feed direction resolution.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this resolution
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this resolution
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
 
@@ -320,8 +284,8 @@
 
     /**
      * Returns a string version of this resolution attribute. The string takes
-     * the form <code>"<I>C</I>x<I>F</I> dphi"</code>, where <I>C</I> is the
-     * cross feed direction resolution and <I>F</I> is the feed direction
+     * the form <code>"<i>C</i>x<i>F</i> dphi"</code>, where <i>C</i> is the
+     * cross feed direction resolution and <i>F</i> is the feed direction
      * resolution. The values are reported in the internal units of dphi.
      */
     public String toString() {
@@ -333,25 +297,23 @@
         return result.toString();
     }
 
-
     /**
      * Returns this resolution attribute's cross feed direction resolution in
      * units of dphi. (For use in a subclass.)
      *
-     * @return  Cross feed direction resolution.
+     * @return cross feed direction resolution
      */
     protected int getCrossFeedResolutionDphi() {
         return crossFeedResolution;
     }
 
     /**
-     * Returns this resolution attribute's feed direction resolution in units
-     * of dphi. (For use in a subclass.)
+     * Returns this resolution attribute's feed direction resolution in units of
+     * dphi. (For use in a subclass.)
      *
-     * @return  Feed direction resolution.
+     * @return feed direction resolution
      */
     protected int getFeedResolutionDphi() {
         return feedResolution;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/SetOfIntegerSyntax.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/SetOfIntegerSyntax.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,82 +23,82 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
 import java.util.Vector;
 
 /**
- * Class SetOfIntegerSyntax is an abstract base class providing the common
- * implementation of all attributes whose value is a set of nonnegative
+ * Class {@code SetOfIntegerSyntax} is an abstract base class providing the
+ * common implementation of all attributes whose value is a set of nonnegative
  * integers. This includes attributes whose value is a single range of integers
  * and attributes whose value is a set of ranges of integers.
- * <P>
- * You can construct an instance of SetOfIntegerSyntax by giving it in "string
- * form." The string consists of zero or more comma-separated integer groups.
- * Each integer group consists of either one integer, two integers separated by
- * a hyphen ({@code -}), or two integers separated by a colon
- * ({@code :}). Each integer consists of one or more decimal digits
- * ({@code 0} through {@code 9}). Whitespace characters cannot
- * appear within an integer but are otherwise ignored. For example:
- * {@code ""}, {@code "1"}, {@code "5-10"}, {@code "1:2, 4"}.
- * <P>
- * You can also construct an instance of SetOfIntegerSyntax by giving it in
- * "array form." Array form consists of an array of zero or more integer groups
- * where each integer group is a length-1 or length-2 array of
- * {@code int}s; for example, {@code int[0][]},
- * {@code int[][]{{1}}}, {@code int[][]{{5,10}}},
- * {@code int[][]{{1,2},{4}}}.
- * <P>
+ * <p>
+ * You can construct an instance of {@code SetOfIntegerSyntax} by giving it in
+ * "string form." The string consists of zero or more comma-separated integer
+ * groups. Each integer group consists of either one integer, two integers
+ * separated by a hyphen ({@code -}), or two integers separated by a colon
+ * ({@code :}). Each integer consists of one or more decimal digits ({@code 0}
+ * through {@code 9}). Whitespace characters cannot appear within an integer but
+ * are otherwise ignored. For example: {@code ""}, {@code "1"}, {@code "5-10"},
+ * {@code "1:2, 4"}.
+ * <p>
+ * You can also construct an instance of {@code SetOfIntegerSyntax} by giving it
+ * in "array form." Array form consists of an array of zero or more integer
+ * groups where each integer group is a length-1 or length-2 array of
+ * {@code int}s; for example, {@code int[0][]}, {@code int[][]{{1}}},
+ * {@code int[][]{{5,10}}}, {@code int[][]{{1,2},{4}}}.
+ * <p>
  * In both string form and array form, each successive integer group gives a
  * range of integers to be included in the set. The first integer in each group
  * gives the lower bound of the range; the second integer in each group gives
  * the upper bound of the range; if there is only one integer in the group, the
  * upper bound is the same as the lower bound. If the upper bound is less than
- * the lower bound, it denotes a null range (no values). If the upper bound is
- * equal to the lower bound, it denotes a range consisting of a single value. If
- * the upper bound is greater than the lower bound, it denotes a range
+ * the lower bound, it denotes a {@code null} range (no values). If the upper
+ * bound is equal to the lower bound, it denotes a range consisting of a single
+ * value. If the upper bound is greater than the lower bound, it denotes a range
  * consisting of more than one value. The ranges may appear in any order and are
  * allowed to overlap. The union of all the ranges gives the set's contents.
- * Once a SetOfIntegerSyntax instance is constructed, its value is immutable.
- * <P>
- * The SetOfIntegerSyntax object's value is actually stored in "<I>canonical</I>
- * array form." This is the same as array form, except there are no null ranges;
- * the members of the set are represented in as few ranges as possible (i.e.,
- * overlapping ranges are coalesced); the ranges appear in ascending order; and
- * each range is always represented as a length-two array of {@code int}s
- * in the form {lower bound, upper bound}. An empty set is represented as a
- * zero-length array.
- * <P>
- * Class SetOfIntegerSyntax has operations to return the set's members in
- * canonical array form, to test whether a given integer is a member of the
+ * Once a {@code SetOfIntegerSyntax} instance is constructed, its value is
+ * immutable.
+ * <p>
+ * The {@code SetOfIntegerSyntax} object's value is actually stored in
+ * "<i>canonical</i> array form." This is the same as array form, except there
+ * are no {@code null} ranges; the members of the set are represented in as few
+ * ranges as possible (i.e., overlapping ranges are coalesced); the ranges
+ * appear in ascending order; and each range is always represented as a
+ * length-two array of {@code int}s in the form {lower bound, upper bound}. An
+ * empty set is represented as a zero-length array.
+ * <p>
+ * Class {@code SetOfIntegerSyntax} has operations to return the set's members
+ * in canonical array form, to test whether a given integer is a member of the
  * set, and to iterate through the members of the set.
  *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
  */
 public abstract class SetOfIntegerSyntax implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 3666874174847632203L;
 
     /**
      * This set's members in canonical array form.
+     *
      * @serial
      */
     private int[][] members;
 
-
     /**
-     * Construct a new set-of-integer attribute with the given members in
-     * string form.
+     * Construct a new set-of-integer attribute with the given members in string
+     * form.
      *
-     * @param  members  Set members in string form. If null, an empty set is
-     *                     constructed.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if {@code members} does not
-     *    obey  the proper syntax.
+     * @param  members set members in string form. If {@code null}, an empty set
+     *         is constructed.
+     * @throws IllegalArgumentException if {@code members} does not obey the
+     *         proper syntax
      */
     protected SetOfIntegerSyntax(String members) {
         this.members = parse (members);
@@ -106,6 +106,9 @@
 
     /**
      * Parse the given string, returning canonical array form.
+     *
+     * @param  members the string
+     * @return the canonical array form
      */
     private static int[][] parse(String members) {
         // Create vector to hold int[] elements, each element being one range
@@ -238,8 +241,8 @@
     }
 
     /**
-     * Accumulate the given range (lb .. ub) into the canonical array form
-     * into the given vector of int[] objects.
+     * Accumulate the given range (lb .. ub) into the canonical array form into
+     * the given vector of int[] objects.
      */
     private static void accumulate(Vector<int[]> ranges, int lb,int ub) {
         // Make sure range is non-null.
@@ -257,12 +260,12 @@
                 int[] rangeb = ranges.elementAt (j+1);
                 int lbb = rangeb[0];
                 int ubb = rangeb[1];
-
-                /* If the two ranges overlap or are adjacent, coalesce them.
-                 * The two ranges overlap if the larger lower bound is less
-                 * than or equal to the smaller upper bound. The two ranges
-                 * are adjacent if the larger lower bound is one greater
-                 * than the smaller upper bound.
+                /*
+                 * If the two ranges overlap or are adjacent, coalesce them. The
+                 * two ranges overlap if the larger lower bound is less than or
+                 * equal to the smaller upper bound. The two ranges are adjacent
+                 * if the larger lower bound is one greater than the smaller
+                 * upper bound.
                  */
                 if (Math.max(lba, lbb) - Math.min(uba, ubb) <= 1) {
                     // The coalesced range is from the smaller lower bound to
@@ -279,9 +282,10 @@
                     ranges.setElementAt (rangeb, j);
                     ranges.setElementAt (rangea, j+1);
                 } else {
-                /* If the two ranges don't overlap and aren't adjacent and
-                 * aren't out of order, we're done early.
-                 */
+                    /*
+                     * If the two ranges don't overlap and aren't adjacent and
+                     * aren't out of order, we're done early.
+                     */
                     break;
                 }
             }
@@ -296,20 +300,16 @@
     }
 
     /**
-     * Construct a new set-of-integer attribute with the given members in
-     * array form.
-     *
-     * @param  members  Set members in array form. If null, an empty set is
-     *                     constructed.
+     * Construct a new set-of-integer attribute with the given members in array
+     * form.
      *
-     * @exception  NullPointerException
-     *     (Unchecked exception) Thrown if any element of
-     *     {@code members} is null.
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if any element of
-     *     {@code members} is not a length-one or length-two array or if
-     *     any non-null range in {@code members} has a lower bound less
-     *     than zero.
+     * @param  members set members in array form. If {@code null}, an empty set
+     *         is constructed.
+     * @throws NullPointerException if any element of {@code members} is
+     *         {@code null}
+     * @throws IllegalArgumentException if any element of {@code members} is not
+     *         a length-one or length-two array or if any {@code non-null} range
+     *         in {@code members} has a lower bound less than zero
      */
     protected SetOfIntegerSyntax(int[][] members) {
         this.members = parse (members);
@@ -353,11 +353,8 @@
     /**
      * Construct a new set-of-integer attribute containing a single integer.
      *
-     * @param  member  Set member.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if {@code member} is less than
-     *     zero.
+     * @param  member set member
+     * @throws IllegalArgumentException if {@code member} is negative
      */
     protected SetOfIntegerSyntax(int member) {
         if (member < 0) {
@@ -371,12 +368,10 @@
      * integers. If the lower bound is greater than the upper bound (a null
      * range), an empty set is constructed.
      *
-     * @param  lowerBound  Lower bound of the range.
-     * @param  upperBound  Upper bound of the range.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if the range is non-null and
-     *     {@code lowerBound} is less than zero.
+     * @param  lowerBound Lower bound of the range
+     * @param  upperBound Upper bound of the range
+     * @throws IllegalArgumentException if the range is {@code non-null} and
+     *         {@code lowerBound} is less than zero
      */
     protected SetOfIntegerSyntax(int lowerBound, int upperBound) {
         if (lowerBound <= upperBound && lowerBound < 0) {
@@ -387,13 +382,12 @@
             new int[0][];
     }
 
-
     /**
      * Obtain this set-of-integer attribute's members in canonical array form.
      * The returned array is "safe;" the client may alter it without affecting
      * this set-of-integer attribute.
      *
-     * @return  This set-of-integer attribute's members in canonical array form.
+     * @return this set-of-integer attribute's members in canonical array form
      */
     public int[][] getMembers() {
         int n = members.length;
@@ -407,10 +401,9 @@
     /**
      * Determine if this set-of-integer attribute contains the given value.
      *
-     * @param  x  Integer value.
-     *
-     * @return  True if this set-of-integer attribute contains the value
-     *          {@code x}, false otherwise.
+     * @param  x the Integer value
+     * @return {@code true} if this set-of-integer attribute contains the value
+     *         {@code x}, {@code false} otherwise
      */
     public boolean contains(int x) {
         // Do a linear search to find the range that contains x, if any.
@@ -429,10 +422,9 @@
      * Determine if this set-of-integer attribute contains the given integer
      * attribute's value.
      *
-     * @param  attribute  Integer attribute.
-     *
-     * @return  True if this set-of-integer attribute contains
-     *          {@code theAttribute}'s value, false otherwise.
+     * @param  attribute the Integer attribute
+     * @return {@code true} if this set-of-integer attribute contains
+     *         {@code attribute}'s value, {@code false} otherwise
      */
     public boolean contains(IntegerSyntax attribute) {
         return contains (attribute.getValue());
@@ -446,20 +438,19 @@
      * values, {@code -1} will never appear in the set.) You can use the
      * {@code next()} method to iterate through the integer values in a
      * set-of-integer attribute in ascending order, like this:
-     * <PRE>
+     * <pre>
      *     SetOfIntegerSyntax attribute = . . .;
      *     int i = -1;
      *     while ((i = attribute.next (i)) != -1)
      *         {
      *         foo (i);
      *         }
-     * </PRE>
-     *
-     * @param  x  Integer value.
+     * </pre>
      *
-     * @return  The smallest integer in this set-of-integer attribute that is
-     *          greater than {@code x}, or {@code -1} if no integer in
-     *          this set-of-integer attribute is greater than {@code x}.
+     * @param  x the Integer value
+     * @return the smallest integer in this set-of-integer attribute that is
+     *         greater than {@code x}, or {@code -1} if no integer in this
+     *         set-of-integer attribute is greater than {@code x}.
      */
     public int next(int x) {
         // Do a linear search to find the range that contains x, if any.
@@ -478,20 +469,16 @@
      * Returns whether this set-of-integer attribute is equivalent to the passed
      * in object. To be equivalent, all of the following conditions must be
      * true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class SetOfIntegerSyntax.
-     * <LI>
-     * This set-of-integer attribute's members and {@code object}'s
-     * members are the same.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code SetOfIntegerSyntax}.
+     *   <li>This set-of-integer attribute's members and {@code object}'s
+     *   members are the same.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this
-     *          set-of-integer attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this
+     *         set-of-integer attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         if (object != null && object instanceof SetOfIntegerSyntax) {
@@ -533,9 +520,9 @@
      * Returns a string value corresponding to this set-of-integer attribute.
      * The string value is a zero-length string if this set is empty. Otherwise,
      * the string value is a comma-separated list of the ranges in the canonical
-     * array form, where each range is represented as <code>"<I>i</I>"</code> if
+     * array form, where each range is represented as <code>"<i>i</i>"</code> if
      * the lower bound equals the upper bound or
-     * <code>"<I>i</I>-<I>j</I>"</code> otherwise.
+     * <code>"<i>i</i>-<i>j</i>"</code> otherwise.
      */
     public String toString() {
         StringBuilder result = new StringBuilder();
@@ -552,5 +539,4 @@
         }
         return result.toString();
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/Size2DSyntax.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/Size2DSyntax.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,75 +23,78 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
 
 /**
- * Class Size2DSyntax is an abstract base class providing the common
+ * Class {@code Size2DSyntax} is an abstract base class providing the common
  * implementation of all attributes denoting a size in two dimensions.
- * <P>
- * A two-dimensional size attribute's value consists of two items, the X
- * dimension and the Y dimension. A two-dimensional size attribute may be
- * constructed by supplying the two values and indicating the units in which the
- * values are measured. Methods are provided to return a two-dimensional size
- * attribute's values, indicating the units in which the values are to be
+ * <p>
+ * A two-dimensional size attribute's value consists of two items, the {@code X}
+ * dimension and the {@code Y} dimension. A two-dimensional size attribute may
+ * be constructed by supplying the two values and indicating the units in which
+ * the values are measured. Methods are provided to return a two-dimensional
+ * size attribute's values, indicating the units in which the values are to be
  * returned. The two most common size units are inches (in) and millimeters
- * (mm), and exported constants {@link #INCH INCH} and {@link #MM
- * MM} are provided for indicating those units.
- * <P>
+ * (mm), and exported constants {@link #INCH INCH} and {@link #MM MM} are
+ * provided for indicating those units.
+ * <p>
  * Once constructed, a two-dimensional size attribute's value is immutable.
- * <P>
- * <B>Design</B>
- * <P>
- * A two-dimensional size attribute's X and Y dimension values are stored
- * internally as integers in units of micrometers (&#181;m), where 1 micrometer
- * = 10<SUP>-6</SUP> meter = 1/1000 millimeter = 1/25400 inch. This permits
- * dimensions to be represented exactly to a precision of 1/1000 mm (= 1
+ * <p>
+ * <b>Design</b>
+ * <p>
+ * A two-dimensional size attribute's {@code X} and {@code Y} dimension values
+ * are stored internally as integers in units of micrometers (&#181;m), where 1
+ * micrometer = 10<SUP>-6</SUP> meter = 1/1000 millimeter = 1/25400 inch. This
+ * permits dimensions to be represented exactly to a precision of 1/1000 mm (= 1
  * &#181;m) or 1/100 inch (= 254 &#181;m). If fractional inches are expressed in
  * negative powers of two, this permits dimensions to be represented exactly to
  * a precision of 1/8 inch (= 3175 &#181;m) but not 1/16 inch (because 1/16 inch
  * does not equal an integral number of &#181;m).
- * <P>
+ * <p>
  * Storing the dimensions internally in common units of &#181;m lets two size
  * attributes be compared without regard to the units in which they were
  * created; for example, 8.5 in will compare equal to 215.9 mm, as they both are
- * stored as 215900 &#181;m. For example, a lookup service can
- * match resolution attributes based on equality of their serialized
- * representations regardless of the units in which they were created. Using
- * integers for internal storage allows precise equality comparisons to be done,
- * which would not be guaranteed if an internal floating point representation
- * were used. Note that if you're looking for U.S. letter sized media in metric
- * units, you have to search for a media size of 215.9 x 279.4 mm; rounding off
- * to an integral 216 x 279 mm will not match.
- * <P>
- * The exported constant {@link #INCH INCH} is actually the
- * conversion factor by which to multiply a value in inches to get the value in
- * &#181;m. Likewise, the exported constant {@link #MM MM} is the
- * conversion factor by which to multiply a value in mm to get the value in
- * &#181;m. A client can specify a resolution value in units other than inches
- * or mm by supplying its own conversion factor. However, since the internal
- * units of &#181;m was chosen with supporting only the external units of inch
- * and mm in mind, there is no guarantee that the conversion factor for the
- * client's units will be an exact integer. If the conversion factor isn't an
- * exact integer, resolution values in the client's units won't be stored
- * precisely.
+ * stored as 215900 &#181;m. For example, a lookup service can match resolution
+ * attributes based on equality of their serialized representations regardless
+ * of the units in which they were created. Using integers for internal storage
+ * allows precise equality comparisons to be done, which would not be guaranteed
+ * if an internal floating point representation were used. Note that if you're
+ * looking for {@code U.S. letter} sized media in metric units, you have to
+ * search for a media size of 215.9 x 279.4 mm; rounding off to an integral
+ * 216 x 279 mm will not match.
+ * <p>
+ * The exported constant {@link #INCH INCH} is actually the conversion factor by
+ * which to multiply a value in inches to get the value in &#181;m. Likewise,
+ * the exported constant {@link #MM MM} is the conversion factor by which to
+ * multiply a value in mm to get the value in &#181;m. A client can specify a
+ * resolution value in units other than inches or mm by supplying its own
+ * conversion factor. However, since the internal units of &#181;m was chosen
+ * with supporting only the external units of inch and mm in mind, there is no
+ * guarantee that the conversion factor for the client's units will be an exact
+ * integer. If the conversion factor isn't an exact integer, resolution values
+ * in the client's units won't be stored precisely.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public abstract class Size2DSyntax implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 5584439964938660530L;
 
     /**
-     * X dimension in units of micrometers (&#181;m).
+     * {@code X} dimension in units of micrometers (&#181;m).
+     *
      * @serial
      */
     private int x;
 
     /**
-     * Y dimension in units of micrometers (&#181;m).
+     * {@code Y} dimension in units of micrometers (&#181;m).
+     *
      * @serial
      */
     private int y;
@@ -108,20 +111,16 @@
      */
     public static final int MM = 1000;
 
-
     /**
      * Construct a new two-dimensional size attribute from the given
      * floating-point values.
      *
-     * @param  x  X dimension.
-     * @param  y  Y dimension.
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or
-     *     {@link #MM MM}.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or
-     *     {@code units < 1}.
+     * @param  x {@code X} dimension
+     * @param  y {@code Y} dimension
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or
+     *         {@code units < 1}
      */
     protected Size2DSyntax(float x, float y, int units) {
         if (x < 0.0f) {
@@ -141,15 +140,12 @@
      * Construct a new two-dimensional size attribute from the given integer
      * values.
      *
-     * @param  x  X dimension.
-     * @param  y  Y dimension.
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or
-     *     {@link #MM MM}.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0}
-     *    or {@code units < 1}.
+     * @param  x {@code X} dimension
+     * @param  y {@code Y} dimension
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or
+     *         {@code units < 1}
      */
     protected Size2DSyntax(int x, int y, int units) {
         if (x < 0) {
@@ -169,16 +165,11 @@
      * Convert a value from micrometers to some other units. The result is
      * returned as a floating-point number.
      *
-     * @param  x
-     *     Value (micrometers) to convert.
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or
-     *     {@link #MM MM}.
-     *
-     * @return  The value of {@code x} converted to the desired units.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units} < 1.
+     * @param  x value (micrometers) to convert
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @return the value of {@code x} converted to the desired units
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     private static float convertFromMicrometers(int x, int units) {
         if (units < 1) {
@@ -191,46 +182,37 @@
      * Get this two-dimensional size attribute's dimensions in the given units
      * as floating-point values.
      *
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}.
-     *
-     * @return  A two-element array with the X dimension at index 0 and the Y
-     *          dimension at index 1.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @return a two-element array with the {@code X} dimension at index 0 and
+     *         the {@code Y} dimension at index 1
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public float[] getSize(int units) {
         return new float[] {getX(units), getY(units)};
     }
 
     /**
-     * Returns this two-dimensional size attribute's X dimension in the given
-     * units as a floating-point value.
+     * Returns this two-dimensional size attribute's {@code X} dimension in the
+     * given units as a floating-point value.
      *
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}.
-     *
-     * @return  X dimension.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @return {@code X} dimension
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public float getX(int units) {
         return convertFromMicrometers(x, units);
     }
 
     /**
-     * Returns this two-dimensional size attribute's Y dimension in the given
-     * units as a floating-point value.
+     * Returns this two-dimensional size attribute's {@code Y} dimension in the
+     * given units as a floating-point value.
      *
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}.
-     *
-     * @return  Y dimension.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @return {@code Y} dimension
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public float getY(int units) {
         return convertFromMicrometers(y, units);
@@ -238,22 +220,17 @@
 
     /**
      * Returns a string version of this two-dimensional size attribute in the
-     * given units. The string takes the form <code>"<I>X</I>x<I>Y</I>
-     * <I>U</I>"</code>, where <I>X</I> is the X dimension, <I>Y</I> is the Y
-     * dimension, and <I>U</I> is the units name. The values are displayed in
-     * floating point.
-     *
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}.
+     * given units. The string takes the form <code>"<i>X</i>x<i>Y</i>
+     * <i>U</i>"</code>, where <i>X</i> is the {@code X} dimension, <i>Y</i> is
+     * the {@code Y} dimension, and <i>U</i> is the units name. The values are
+     * displayed in floating point.
      *
-     * @param  unitsName
-     *     Units name string, e.g. {@code in} or {@code mm}. If
-     *     null, no units name is appended to the result.
-     *
-     * @return  String version of this two-dimensional size attribute.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @param  unitsName units name string, e.g. {@code in} or {@code mm}. If
+     *         {@code null}, no units name is appended to the result
+     * @return {@code String} version of this two-dimensional size attribute
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public String toString(int units, String unitsName) {
         StringBuilder result = new StringBuilder();
@@ -271,23 +248,18 @@
      * Returns whether this two-dimensional size attribute is equivalent to the
      * passed in object. To be equivalent, all of the following conditions must
      * be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class Size2DSyntax.
-     * <LI>
-     * This attribute's X dimension is equal to {@code object}'s X
-     * dimension.
-     * <LI>
-     * This attribute's Y dimension is equal to {@code object}'s Y
-     * dimension.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code Size2DSyntax}
+     *   <li>This attribute's {@code X} dimension is equal to {@code object}'s
+     *   {@code X} dimension.
+     *   <li>This attribute's {@code Y} dimension is equal to {@code object}'s
+     *   {@code Y} dimension.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this
-     *          two-dimensional size attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this
+     *         two-dimensional size attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return(object != null &&
@@ -306,9 +278,9 @@
 
     /**
      * Returns a string version of this two-dimensional size attribute. The
-     * string takes the form <code>"<I>X</I>x<I>Y</I> um"</code>, where
-     * <I>X</I> is the X dimension and <I>Y</I> is the Y dimension.
-     * The values are reported in the internal units of micrometers.
+     * string takes the form <code>"<i>X</i>x<i>Y</i> um"</code>, where <i>X</i>
+     * is the {@code X} dimension and <i>Y</i> is the {@code Y} dimension. The
+     * values are reported in the internal units of micrometers.
      */
     public String toString() {
         StringBuilder result = new StringBuilder();
@@ -320,23 +292,22 @@
     }
 
     /**
-     * Returns this two-dimensional size attribute's X dimension in units of
-     * micrometers (&#181;m). (For use in a subclass.)
+     * Returns this two-dimensional size attribute's {@code X} dimension in
+     * units of micrometers (&#181;m). (For use in a subclass.)
      *
-     * @return  X dimension (&#181;m).
+     * @return {@code X} dimension (&#181;m)
      */
     protected int getXMicrometers(){
         return x;
     }
 
     /**
-     * Returns this two-dimensional size attribute's Y dimension in units of
-     * micrometers (&#181;m). (For use in a subclass.)
+     * Returns this two-dimensional size attribute's {@code Y} dimension in
+     * units of micrometers (&#181;m). (For use in a subclass.)
      *
-     * @return  Y dimension (&#181;m).
+     * @return {@code Y} dimension (&#181;m)
      */
     protected int getYMicrometers() {
         return y;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/SupportedValuesAttribute.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/SupportedValuesAttribute.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,21 +23,20 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 /**
- * Interface SupportedValuesAttribute is a tagging interface which a printing
- * attribute class implements to indicate the attribute describes the supported
- * values for another attribute. For example, if a Print Service instance
- * supports the {@link javax.print.attribute.standard.Copies Copies}
- * attribute, the Print Service instance will have a {@link
- * javax.print.attribute.standard.CopiesSupported CopiesSupported} attribute,
- * which is a SupportedValuesAttribute giving the legal values a client may
- * specify for the {@link javax.print.attribute.standard.Copies Copies}
- * attribute.
+ * Interface {@code SupportedValuesAttribute} is a tagging interface which a
+ * printing attribute class implements to indicate the attribute describes the
+ * supported values for another attribute. For example, if a Print Service
+ * instance supports the {@link javax.print.attribute.standard.Copies Copies}
+ * attribute, the Print Service instance will have a
+ * {@link javax.print.attribute.standard.CopiesSupported CopiesSupported}
+ * attribute, which is a {@code SupportedValuesAttribute} giving the legal
+ * values a client may specify for the
+ * {@link javax.print.attribute.standard.Copies Copies} attribute.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public interface SupportedValuesAttribute extends Attribute {
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/TextSyntax.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/TextSyntax.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,48 +23,50 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
 import java.util.Locale;
 
 /**
- * Class TextSyntax is an abstract base class providing the common
+ * Class {@code TextSyntax} is an abstract base class providing the common
  * implementation of all attributes whose value is a string. The text attribute
  * includes a locale to indicate the natural language. Thus, a text attribute
  * always represents a localized string. Once constructed, a text attribute's
  * value is immutable.
  *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
  */
 public abstract class TextSyntax implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -8130648736378144102L;
 
     /**
      * String value of this text attribute.
+     *
      * @serial
      */
     private String value;
 
     /**
      * Locale of this text attribute.
+     *
      * @serial
      */
     private Locale locale;
 
     /**
-     * Constructs a TextAttribute with the specified string and locale.
+     * Constructs a {@code TextAttribute} with the specified string and locale.
      *
-     * @param  value   Text string.
-     * @param  locale  Natural language of the text string. null
-     * is interpreted to mean the default locale for as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code value} is null.
+     * @param  value text string
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale for as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code value} is {@code null}
      */
     protected TextSyntax(String value, Locale locale) {
         this.value = verify (value);
@@ -87,7 +89,8 @@
 
     /**
      * Returns this text attribute's text string.
-     * @return the text string.
+     *
+     * @return the text string
      */
     public String getValue() {
         return value;
@@ -95,6 +98,7 @@
 
     /**
      * Returns this text attribute's text string's natural language (locale).
+     *
      * @return the locale
      */
     public Locale getLocale() {
@@ -104,7 +108,7 @@
     /**
      * Returns a hashcode for this text attribute.
      *
-     * @return  A hashcode value for this object.
+     * @return a hashcode value for this object
      */
     public int hashCode() {
         return value.hashCode() ^ locale.hashCode();
@@ -113,23 +117,17 @@
     /**
      * Returns whether this text attribute is equivalent to the passed in
      * object. To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class TextSyntax.
-     * <LI>
-     * This text attribute's underlying string and {@code object}'s
-     * underlying string are equal.
-     * <LI>
-     * This text attribute's locale and {@code object}'s locale are
-     * equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code TextSyntax}.
+     *   <li>This text attribute's underlying string and {@code object}'s
+     *   underlying string are equal.
+     *   <li>This text attribute's locale and {@code object}'s locale are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this text
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this text
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return(object != null &&
@@ -139,13 +137,12 @@
     }
 
     /**
-     * Returns a String identifying this text attribute. The String is
-     * the attribute's underlying text string.
+     * Returns a {@code String} identifying this text attribute. The
+     * {@code String} is the attribute's underlying text string.
      *
-     * @return  A String identifying this object.
+     * @return a {@code String} identifying this object
      */
     public String toString(){
         return value;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/URISyntax.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/URISyntax.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -23,36 +23,37 @@
  * questions.
  */
 
-
 package javax.print.attribute;
 
 import java.io.Serializable;
 import java.net.URI;
 
 /**
- * Class URISyntax is an abstract base class providing the common
- * implementation of all attributes whose value is a Uniform Resource
- * Identifier (URI). Once constructed, a URI attribute's value is immutable.
+ * Class {@code URISyntax} is an abstract base class providing the common
+ * implementation of all attributes whose value is a Uniform Resource Identifier
+ * (URI). Once constructed, a {@code URI} attribute's value is immutable.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public abstract class URISyntax implements Serializable, Cloneable {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -7842661210486401678L;
 
     /**
-     * URI value of this URI attribute.
+     * {@code URI} value of this {@code URI} attribute.
+     *
      * @serial
      */
     private URI uri;
 
     /**
-     * Constructs a URI attribute with the specified URI.
+     * Constructs a {@code URI} attribute with the specified {@code URI}.
      *
-     * @param  uri  URI.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code uri} is null.
+     * @param  uri the {@code URI}
+     * @throws NullPointerException if {@code uri} is {@code null}
      */
     protected URISyntax(URI uri) {
         this.uri = verify (uri);
@@ -66,40 +67,36 @@
     }
 
     /**
-     * Returns this URI attribute's URI value.
-     * @return the URI.
+     * Returns this {@code URI} attribute's {@code URI} value.
+     *
+     * @return the {@code URI}
      */
     public URI getURI()  {
         return uri;
     }
 
     /**
-     * Returns a hashcode for this URI attribute.
+     * Returns a hashcode for this {@code URI} attribute.
      *
-     * @return  A hashcode value for this object.
+     * @return a hashcode value for this object
      */
     public int hashCode() {
         return uri.hashCode();
     }
 
     /**
-     * Returns whether this URI attribute is equivalent to the passed in
-     * object.
-     * To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class URISyntax.
-     * <LI>
-     * This URI attribute's underlying URI and {@code object}'s
-     * underlying URI are equal.
-     * </OL>
+     * Returns whether this {@code URI} attribute is equivalent to the passed in
+     * object. To be equivalent, all of the following conditions must be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code URISyntax}.
+     *   <li>This {@code URI} attribute's underlying {@code URI} and
+     *   {@code object}'s underlying {@code URI} are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this URI
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this {@code URI}
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return(object != null &&
@@ -108,13 +105,13 @@
     }
 
     /**
-     * Returns a String identifying this URI attribute. The String is the
-     * string representation of the attribute's underlying URI.
+     * Returns a {@code String} identifying this {@code URI} attribute. The
+     * {@code String} is the string representation of the attribute's underlying
+     * {@code URI}.
      *
-     * @return  A String identifying this object.
+     * @return a {@code String} identifying this object
      */
     public String toString() {
         return uri.toString();
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/UnmodifiableSetException.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/UnmodifiableSetException.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, 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
@@ -26,26 +26,31 @@
 package javax.print.attribute;
 
 /**
- * Thrown to indicate that the requested operation cannot be performed
- * because the set is unmodifiable.
+ * Thrown to indicate that the requested operation cannot be performed because
+ * the set is unmodifiable.
  *
- * @author  Phil Race
- * @since   1.4
+ * @author Phil Race
+ * @since 1.4
  */
 public class UnmodifiableSetException extends RuntimeException {
+
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 2255250308571511731L;
 
     /**
-     * Constructs an UnsupportedOperationException with no detail message.
+     * Constructs an {@code UnsupportedOperationException} with no detail
+     * message.
      */
     public UnmodifiableSetException() {
     }
 
     /**
-     * Constructs an UnmodifiableSetException with the specified
-     * detail message.
+     * Constructs an {@code UnmodifiableSetException} with the specified detail
+     * message.
      *
-     * @param message the detail message
+     * @param  message the detail message
      */
     public UnmodifiableSetException(String message) {
         super(message);
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -39,19 +39,20 @@
  * The print data and the processing instructions are separate entities. This
  * means that:
  * <ul>
- *     <li>You can print the same print data at different times using different
- *     processing instructions.<br>For example, you can print a slide
- *     presentation on US letter-sized white paper, double-sided, stapled, 20
- *     copies to make handouts for a talk; and you could print the same slide
- *     presentation on US letter-sized transparencies, single-sided, one copy to
- *     make the actual slides for the talk.</li>
- *     <li>You can use the same processing instructions at different times to
- *     print different data. For example, you could set your default processing
- *     instructions to: US letter-sized paper, double sided, stapled. Whenever
- *     you print a job, it prints with these settings, unless you explicitly
- *     override them.</li>
+ *   <li>You can print the same print data at different times using different
+ *   processing instructions.
+ *   <br>
+ *   For example, you can print a slide presentation on US letter-sized white
+ *   paper, double-sided, stapled, 20 copies to make handouts for a talk; and
+ *   you could print the same slide presentation on US letter-sized
+ *   transparencies, single-sided, one copy to make the actual slides for the
+ *   talk.
+ *   <li>You can use the same processing instructions at different times to
+ *   print different data. For example, you could set your default processing
+ *   instructions to: US letter-sized paper, double sided, stapled. Whenever you
+ *   print a job, it prints with these settings, unless you explicitly override
+ *   them.
  * </ul>
- * <p>
  * The processing instruction does not specify how the print job processes the
  * request; each processing instruction is only a description of the results of
  * a print job. The print job determines the manner in which it achieves the
@@ -97,18 +98,18 @@
  * The Java Print Service API defines these different kinds of attributes with
  * five subinterfaces of {@code Attribute}:
  * <ul>
- *     <li><a href="DocAttribute.html">DocAttribute</a> specifies a
- *     characteristic of an individual document and the print job settings to be
- *     applied to an individual document.</li>
- *     <li><a href="PrintRequestAttribute.html">PrintRequestAttribute</a>
- *     specifies a setting applied to a whole print job and to all the documents
- *     in the print job.</li>
- *     <li><a href="PrintJobAttribute.html">PrintJobAttribute</a> reports the
- *     status of a print job.</li>
- *     <li><a href="PrintServiceAttribute.html">PrintServiceAttribute</a>
- *     reports the status of a print service.</li>
- *     <li><a href="SupportedValuesAttribute.html">SupportedValuesAttribute</a>
- *     gives the supported values for another attribute.</li>
+ *   <li><a href="DocAttribute.html">DocAttribute</a> specifies a characteristic
+ *   of an individual document and the print job settings to be applied to an
+ *   individual document.
+ *   <li><a href="PrintRequestAttribute.html">PrintRequestAttribute</a>
+ *   specifies a setting applied to a whole print job and to all the documents
+ *   in the print job.
+ *   <li><a href="PrintJobAttribute.html">PrintJobAttribute</a> reports the
+ *   status of a print job.
+ *   <li><a href="PrintServiceAttribute.html">PrintServiceAttribute</a> reports
+ *   the status of a print service.
+ *   <li><a href="SupportedValuesAttribute.html">SupportedValuesAttribute</a>
+ *   gives the supported values for another attribute.
  * </ul>
  * Each attribute class implements one or more of these tagging subinterfaces to
  * indicate where the attribute can be used in the API. If an attribute class
@@ -123,40 +124,39 @@
  * The Java Print Service API defines a group of standard attribute classes
  * modeled upon the attributes in the Internet Printing Protocol (IPP) version
  * 1.1. The standard attribute classes are in the subpackage
- * javax.print.attribute.standard to keep the actual attribute classes
+ * {@code javax.print.attribute.standard} to keep the actual attribute classes
  * conceptually separate from the generic apparatus defined in package
- * javax.print.attribute.
+ * {@code javax.print.attribute}.
  *
  * <h3>Attribute Sets</h3>
  * A client usually needs to provide more than one processing instruction when
- * submitting a print job. For example, the client might need to specify a
- * media size of A4 and a landscape orientation. To send more than one
- * processing instruction, the client collects the attributes into an attribute
- * set, which the Java Print Service API represents with the
+ * submitting a print job. For example, the client might need to specify a media
+ * size of A4 and a landscape orientation. To send more than one processing
+ * instruction, the client collects the attributes into an attribute set, which
+ * the Java Print Service API represents with the
  * <a href="AttributeSet.html">AttributeSet</a> interface.
  * <p>
  * The {@code AttributeSet} interface is similar to the
  * <a href="../../../java/util/Map.html">Map</a> interface: it provides a map of
  * key to values, in which each key is unique and can contain no more than one
  * value. However, the {@code AttributeSet} interface is designed to
- * specifically support the needs of the Java Print Service API. An {@code
- * AttributeSet} requires that:
+ * specifically support the needs of the Java Print Service API. An
+ * {@code AttributeSet} requires that:
  * <ol type=1>
- *     <li>Each key in an {@code AttributeSet} corresponds to a category, and
- *     the value of the key can only be  one of the attribute values that belong
- *     to the category represented by the key. Thus, unlike a {@code Map}, an
- *     {@code AttributeSet} restricts the possible values of a key: an attribute
- *     category cannot be set to an attribute value that does not belong to that
- *     category.</li>
- *     <li>No two attributes from the same category can exist in the same set.
- *     For example, an attribute collection must not contain both a "one-sided"
- *     attribute and a "two-sided" attribute because these two attributes give
- *     the printer conflicting instructions.</li>
- *     <li>Only attributes implementing the {@code Attribute} interface can be
- *     added to the set.</li>
+ *   <li>Each key in an {@code AttributeSet} corresponds to a category, and the
+ *   value of the key can only be one of the attribute values that belong to the
+ *   category represented by the key. Thus, unlike a {@code Map}, an
+ *   {@code AttributeSet} restricts the possible values of a key: an attribute
+ *   category cannot be set to an attribute value that does not belong to that
+ *   category.
+ *   <li>No two attributes from the same category can exist in the same set. For
+ *   example, an attribute collection must not contain both a "one-sided"
+ *   attribute and a "two-sided" attribute because these two attributes give the
+ *   printer conflicting instructions.
+ *   <li>Only attributes implementing the {@code Attribute} interface can be
+ *   added to the set.
  * </ol>
- * <p>
- * The javax.print.attribute package includes
+ * The {@code javax.print.attribute} package includes
  * <a href="HashAttributeSet.html">HashAttributeSet</a> as a concrete
  * implementation of the attribute set interface. {@code HashAttributeSet}
  * provides an attribute set based on a hash map. You can use this
@@ -167,18 +167,15 @@
  * that are restricted to contain just one of the four kinds of attributes, as
  * discussed in the <a href="#role">Attribute Roles</a> section:
  * <ul>
- *     <li><a href="DocAttributeSet.html">DocAttributeSet</a></li>
- *     <li><a href="PrintRequestAttributeSet.html">
- *         PrintRequestAttributeSet</a></li>
- *     <li><a href="PrintJobAttributeSet.html">
- *         PrintJobAttributeSet</a></li>
- *     <li><a href="PrintServiceAttributeSet.html">
- *         PrintServiceAttributeSet</a></li>
+ *   <li><a href="DocAttributeSet.html">DocAttributeSet</a>
+ *   <li><a href="PrintRequestAttributeSet.html">PrintRequestAttributeSet</a>
+ *   <li><a href="PrintJobAttributeSet.html"> PrintJobAttributeSet</a>
+ *   <li><a href="PrintServiceAttributeSet.html">PrintServiceAttributeSet</a>
  * </ul>
  * Notice that only four kinds of attribute sets are listed here, but there are
  * five kinds of attributes. Interface
- * <a href="SupportedValuesAttribute.html">SupportedValuesAttribute</a>
- * denotes an attribute that gives the supported values for another attribute.
+ * <a href="SupportedValuesAttribute.html">SupportedValuesAttribute</a> denotes
+ * an attribute that gives the supported values for another attribute.
  * Supported-values attributes are never aggregated into attribute sets, so
  * there is no attribute set subinterface defined for them.
  * <p>
@@ -189,17 +186,15 @@
  * For a read-only attribute set, calling a mutating operation throws an
  * {@code UnmodifiableSetException}.
  * <p>
- * Package javax.print.attribute includes one concrete implementation of each of
- * the attribute set subinterfaces:
+ * Package {@code javax.print.attribute} includes one concrete implementation of
+ * each of the attribute set subinterfaces:
  * <ul>
- *     <li><a href="HashDocAttributeSet.html">
- *         HashDocAttributeSet</a></li>
- *     <li><a href="HashPrintRequestAttributeSet.html">
- *         HashPrintRequestAttributeSet</a>,</li>
- *     <li><a href="HashPrintJobAttributeSet.html">
- *         HashPrintJobAttributeSet</a>,</li>
- *     <li><a href="HashPrintServiceAttributeSet.html">
- *         HashPrintServiceAttributeSet</a>.</li>
+ *   <li><a href="HashDocAttributeSet.html"> HashDocAttributeSet</a>
+ *   <li><a href="HashPrintRequestAttributeSet.html">
+ *   HashPrintRequestAttributeSet</a>,
+ *   <li><a href="HashPrintJobAttributeSet.html">HashPrintJobAttributeSet</a>,
+ *   <li><a href="HashPrintServiceAttributeSet.html">
+ *   HashPrintServiceAttributeSet</a>.
  * </ul>
  * All of these classes extend
  * <a href="HashAttributeSet.html">HashAttributeSet</a> and enforce the
@@ -211,12 +206,11 @@
  * enumerated value. The Java Print Service API does not use primitive data
  * types, such as int, to represent attribute values for these reasons:
  * <ul>
- *     <li>Primitive data types are not type-safe. For example, a compiler
- *     should not allow a "copies" attribute value to be used for a "sides"
- *     attribute.</li>
- *     <li>Some attributes must be represented as a record of several values.
- *     One example is printer resolution, which requires two numbers, such as
- *     600 and 300 representing 600 x 300 dpi.</li>
+ *   <li>Primitive data types are not type-safe. For example, a compiler should
+ *   not allow a "copies" attribute value to be used for a "sides" attribute.
+ *   <li>Some attributes must be represented as a record of several values. One
+ *   example is printer resolution, which requires two numbers, such as 600 and
+ *   300 representing 600 x 300 dpi.
  * </ul>
  * For type-safety and to represent all attributes uniformly, the Java Print
  * Service API defines each attribute category as a class, such as class
@@ -240,27 +234,27 @@
  * represent each abstract syntax, and these classes are used as the parent of
  * standard attributes whenever possible. The abstract syntax classes are:
  * <ul>
- *     <li><a href="EnumSyntax.html">EnumSyntax</a> provides a type-safe
- *     enumeration in which enumerated values are represented as singleton
- *     objects. Each enumeration singleton is an instance of the enumeration
- *     class that wraps a hidden int value.</li>
- *     <li><a href="IntegerSyntax.html">IntegerSyntax</a> is the abstract syntax
- *     for integer-valued attributes.</li>
- *     <li><a href="TextSyntax.html">TextSyntax</a> is the abstract syntax for
- *     text-valued attributes, and includes a locale giving the text string's
- *     natural language.</li>
- *     <li><a href="SetOfIntegerSyntax.html">SetOfIntegerSyntax</a> is the
- *     abstract syntax for attributes representing a range or set of integers
- *     <li><a href="ResolutionSyntax.html">ResolutionSyntax</a> is the abstract
- *     syntax for attributes representing resolution values, such as 600x300
- *     dpi.</li>
- *     <li><a href="Size2DSyntax.html">Size2DSyntax</a> is the abstract syntax
- *     for attributes representing a two-dimensional size, such as a paper size
- *     of 8.5 x 11 inches.</li>
- *     <li><a href="DateTimeSyntax.html">DateTimeSyntax</a> is the abstract
- *     syntax for attributes whose value is a date and time.</li>
- *     <li><a href="URISyntax.html">URISyntax</a> is the abstract syntax for
- *     attributes whose value is a Uniform Resource Indicator.</li>
+ *   <li><a href="EnumSyntax.html">EnumSyntax</a> provides a type-safe
+ *   enumeration in which enumerated values are represented as singleton
+ *   objects. Each enumeration singleton is an instance of the enumeration class
+ *   that wraps a hidden int value.
+ *   <li><a href="IntegerSyntax.html">IntegerSyntax</a> is the abstract syntax
+ *   for integer-valued attributes.
+ *   <li><a href="TextSyntax.html">TextSyntax</a> is the abstract syntax for
+ *   text-valued attributes, and includes a locale giving the text string's
+ *   natural language.
+ *   <li><a href="SetOfIntegerSyntax.html">SetOfIntegerSyntax</a> is the
+ *   abstract syntax for attributes representing a range or set of integers
+ *   <li><a href="ResolutionSyntax.html">ResolutionSyntax</a> is the abstract
+ *   syntax for attributes representing resolution values, such as 600x300
+ *   dpi.
+ *   <li><a href="Size2DSyntax.html">Size2DSyntax</a> is the abstract syntax for
+ *   attributes representing a two-dimensional size, such as a paper size of
+ *   8.5 x 11 inches.
+ *   <li><a href="DateTimeSyntax.html">DateTimeSyntax</a> is the abstract syntax
+ *   for attributes whose value is a date and time.
+ *   <li><a href="URISyntax.html">URISyntax</a> is the abstract syntax for
+ *   attributes whose value is a Uniform Resource Indicator.
  * </ul>
  * The abstract syntax classes are independent of the attributes that use them.
  * In fact, applications that have nothing to do with printing can use the
@@ -304,12 +298,10 @@
  * <h3>Attribute Vendors</h3>
  * The Java Print Service API is designed so that vendors can:
  * <ul>
- *     <li>define new vendor-specific values for any standard attribute defined
- *     in <a href="standard/package-summary.html">javax.print.attribute.standard
- *     </a>.</li>
- *     <li>define new attribute categories representing the vendor printer's
- *     proprietary capabilities not already supported by the standard
- *     attributes.</li>
+ *   <li>define new vendor-specific values for any standard attribute defined in
+ *   <a href="standard/package-summary.html">javax.print.attribute.standard</a>.
+ *   <li>define new attribute categories representing the vendor printer's
+ *   proprietary capabilities not already supported by the standard attributes.
  * </ul>
  * To define a new value for an attribute, a client can construct instances of
  * such attributes with arbitrary values at runtime. However, an enumerated
@@ -364,12 +356,12 @@
  * }</pre>
  * </blockquote>
  * <p>
- * Please note: In the javax.print APIs, a null reference parameter to methods
- * is incorrect unless explicitly documented on the method as having a
- * meaningful interpretation. Usage to the contrary is incorrect coding and may
- * result in a run time exception either immediately or at some later time.
- * IllegalArgumentException and NullPointerException are examples of typical and
- * acceptable run time exceptions for such cases.
+ * Please note: In the {@code javax.print} APIs, a {@code null} reference
+ * parameter to methods is incorrect unless explicitly documented on the method
+ * as having a meaningful interpretation. Usage to the contrary is incorrect
+ * coding and may result in a run time exception either immediately or at some
+ * later time. {@code IllegalArgumentException} and {@code NullPointerException}
+ * are examples of typical and acceptable run time exceptions for such cases.
  *
  * @since 1.4
  */
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Chromaticity.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Chromaticity.java	Sat Sep 09 14:36:45 2017 +0200
@@ -22,75 +22,57 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.DocAttribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class Chromaticity is a printing attribute class, an enumeration, that
- * specifies monochrome or color printing. This is used by a print client
+ * Class {@code Chromaticity} is a printing attribute class, an enumeration,
+ * that specifies monochrome or color printing. This is used by a print client
  * to specify how the print data should be generated or processed. It is not
  * descriptive of the color capabilities of the device. Query the service's
  * {@link ColorSupported ColorSupported} attribute to determine if the device
  * can be verified to support color printing.
- * <P>
+ * <p>
  * The table below shows the effects of specifying a Chromaticity attribute of
- * {@link #MONOCHROME MONOCHROME} or {@link #COLOR COLOR}
- * for a monochrome or color document.
- *
+ * {@link #MONOCHROME MONOCHROME} or {@link #COLOR COLOR} for a monochrome or
+ * color document.
  * <table class="striped">
- * <caption>Shows effects of specifying MONOCHROME or COLOR Chromaticity
- * attributes</caption>
+ * <caption>Shows effects of specifying {@code MONOCHROME} or {@code COLOR}
+ * Chromaticity attributes</caption>
  * <thead>
- * <TR>
- * <TH>
- * Chromaticity<BR>Attribute
- * </TH>
- * <TH>
- * Effect on<BR>Monochrome Document
- * </TH>
- * <TH>
- * Effect on<BR>Color Document
- * </TH>
- * </TR>
+ *   <tr>
+ *     <th>Chromaticity<br>Attribute
+ *     <th>Effect on<br>Monochrome Document
+ *     <th>Effect on<br>Color Document
  * </thead>
  * <tbody>
- * <TR>
- * <TD>
- * {@link #MONOCHROME MONOCHROME}
- * </TD>
- * <TD>
- * Printed as is, in monochrome
- * </TD>
- * <TD>
- * Printed in monochrome, with colors converted to shades of gray
- * </TD>
- * </TR>
- * <TR>
- * <TD>
- * {@link #COLOR COLOR}
- * </TD>
- * <TD>
- * Printed as is, in monochrome
- * </TD>
- * <TD>
- * Printed as is, in color
- * </TD>
- * </TR>
+ *   <tr>
+ *     <td>{@link #MONOCHROME MONOCHROME}
+ *     <td>Printed as is, in monochrome
+ *     <td>Printed in monochrome, with colors converted to shades of gray
+ *   <tr>
+ *     <td>{@link #COLOR COLOR}
+ *     <td>Printed as is, in monochrome
+ *     <td>Printed as is, in color
  * </tbody>
- * </TABLE>
- * <P>
- * <B>IPP Compatibility:</B> Chromaticity is not an IPP attribute at present.
+ * </table>
+ * <p>
+ * <b>IPP Compatibility:</b> Chromaticity is not an IPP attribute at present.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class Chromaticity extends EnumSyntax
     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 4660543931355214012L;
 
     /**
@@ -103,32 +85,37 @@
      */
     public static final Chromaticity COLOR = new Chromaticity(1);
 
-
     /**
      * Construct a new chromaticity enumeration value with the given integer
      * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected Chromaticity(int value) {
         super(value);
     }
 
+    /**
+     * The string table for class {@code Chromaticity}.
+     */
     private static final String[] myStringTable = {"monochrome",
                                                    "color"};
 
+    /**
+     * The enumeration value table for class {@code Chromaticity}.
+     */
     private static final Chromaticity[] myEnumValueTable = {MONOCHROME,
                                                             COLOR};
 
     /**
-     * Returns the string table for class Chromaticity.
+     * Returns the string table for class {@code Chromaticity}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class Chromaticity.
+     * Returns the enumeration value table for class {@code Chromaticity}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
@@ -137,11 +124,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class Chromaticity, the category is the class Chromaticity itself.
+     * <p>
+     * For class {@code Chromaticity}, the category is the class
+     * {@code Chromaticity} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return Chromaticity.class;
@@ -150,13 +138,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class Chromaticity, the category name is {@code "chromaticity"}.
+     * <p>
+     * For class {@code Chromaticity}, the category name is
+     * {@code "chromaticity"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
-        public final String getName() {
-            return "chromaticity";
-        }
-
-        }
+    public final String getName() {
+        return "chromaticity";
+    }
+}
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ColorSupported.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ColorSupported.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,35 +30,39 @@
 import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class ColorSupported is a printing attribute class, an enumeration, that
- * identifies whether the device is capable of any type of color printing at
- * all, including highlight color as well as full process color. All document
+ * Class {@code ColorSupported} is a printing attribute class, an enumeration,
+ * that identifies whether the device is capable of any type of color printing
+ * at all, including highlight color as well as full process color. All document
  * instructions having to do with color are embedded within the print data (none
  * are attributes attached to the job outside the print data).
- * <P>
+ * <p>
  * Note: End users are able to determine the nature and details of the color
- * support by querying the {@link PrinterMoreInfoManufacturer
- * PrinterMoreInfoManufacturer} attribute.
- * <P>
- * Don't confuse the ColorSupported attribute with the {@link Chromaticity
- * Chromaticity} attribute. {@link Chromaticity Chromaticity} is an attribute
- * the client can specify for a job to tell the printer whether to print a
- * document in monochrome or color, possibly causing the printer to print a
- * color document in monochrome. ColorSupported is a printer description
- * attribute that tells whether the printer can print in color regardless of how
- * the client specifies to print any particular document.
- * <P>
- * <B>IPP Compatibility:</B> The IPP boolean value is "true" for SUPPORTED and
- * "false" for NOT_SUPPORTED. The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * support by querying the
+ * {@link PrinterMoreInfoManufacturer PrinterMoreInfoManufacturer} attribute.
+ * <p>
+ * Don't confuse the {@code ColorSupported} attribute with the
+ * {@link Chromaticity Chromaticity} attribute.
+ * {@link Chromaticity Chromaticity} is an attribute the client can specify for
+ * a job to tell the printer whether to print a document in monochrome or color,
+ * possibly causing the printer to print a color document in monochrome.
+ * {@code ColorSupported} is a printer description attribute that tells whether
+ * the printer can print in color regardless of how the client specifies to
+ * print any particular document.
+ * <p>
+ * <b>IPP Compatibility:</b> The IPP boolean value is "true" for SUPPORTED and
+ * "false" for NOT_SUPPORTED. The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class ColorSupported extends EnumSyntax
     implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -2700555589688535545L;
 
     /**
@@ -66,36 +71,42 @@
     public static final ColorSupported NOT_SUPPORTED = new ColorSupported(0);
 
     /**
-     * The printer is capable of some type of color printing, such as
-     * highlight color or full process color.
+     * The printer is capable of some type of color printing, such as highlight
+     * color or full process color.
      */
     public static final ColorSupported SUPPORTED = new ColorSupported(1);
 
     /**
-     * Construct a new color supported enumeration value with the given
-     * integer value.
+     * Construct a new color supported enumeration value with the given integer
+     * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected ColorSupported(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code ColorSupported}.
+     */
     private static final String[] myStringTable = {"not-supported",
                                                    "supported"};
 
+    /**
+     * The enumeration value table for class {@code ColorSupported}.
+     */
     private static final ColorSupported[] myEnumValueTable = {NOT_SUPPORTED,
                                                               SUPPORTED};
 
     /**
-     * Returns the string table for class ColorSupported.
+     * Returns the string table for class {@code ColorSupported}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class ColorSupported.
+     * Returns the enumeration value table for class {@code ColorSupported}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
@@ -104,11 +115,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class ColorSupported, the category is class ColorSupported itself.
+     * <p>
+     * For class {@code ColorSupported}, the category is class
+     * {@code ColorSupported} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return ColorSupported.class;
@@ -117,13 +129,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class ColorSupported, the category name is {@code "color-supported"}.
+     * <p>
+     * For class {@code ColorSupported}, the category name is
+     * {@code "color-supported"}
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "color-supported";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Compression.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Compression.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,29 +22,33 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.DocAttribute;
 
 /**
- * Class Compression is a printing attribute class, an enumeration, that
- * specifies how print data is compressed. Compression is an attribute of the
- * print data (the doc), not of the Print Job. If a Compression attribute is not
- * specified for a doc, the printer assumes the doc's print data is uncompressed
- * (i.e., the default Compression value is always {@link #NONE
- * NONE}).
- * <P>
- * <B>IPP Compatibility:</B> The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * Class {@code Compression} is a printing attribute class, an enumeration, that
+ * specifies how print data is compressed. {@code Compression} is an attribute
+ * of the print data (the doc), not of the Print Job. If a {@code Compression}
+ * attribute is not specified for a doc, the printer assumes the doc's print
+ * data is uncompressed (i.e., the default Compression value is always
+ * {@link #NONE NONE}).
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class Compression extends EnumSyntax implements DocAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -5716748913324997674L;
 
     /**
@@ -59,7 +63,7 @@
 
     /**
      * GNU zip compression technology described in
-     * <A HREF="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</A>.
+     * <a href="http://www.ietf.org/rfc/rfc1952.txt">RFC 1952</a>.
      */
     public static final Compression GZIP = new Compression(2);
 
@@ -72,32 +76,37 @@
      * Construct a new compression enumeration value with the given integer
      * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected Compression(int value) {
         super(value);
     }
 
-
+    /**
+     * The string table for class {@code Compression}.
+     */
     private static final String[] myStringTable = {"none",
                                                    "deflate",
                                                    "gzip",
                                                    "compress"};
 
+    /**
+     * The enumeration value table for class {@code Compression}.
+     */
     private static final Compression[] myEnumValueTable = {NONE,
                                                            DEFLATE,
                                                            GZIP,
                                                            COMPRESS};
 
     /**
-     * Returns the string table for class Compression.
+     * Returns the string table for class {@code Compression}.
      */
     protected String[] getStringTable() {
         return myStringTable.clone();
     }
 
     /**
-     * Returns the enumeration value table for class Compression.
+     * Returns the enumeration value table for class {@code Compression}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
@@ -106,12 +115,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class Compression and any vendor-defined subclasses, the category is
-     * class Compression itself.
+     * <p>
+     * For class {@code Compression} and any vendor-defined subclasses, the
+     * category is class {@code Compression} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return Compression.class;
@@ -120,14 +129,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class Compression and any vendor-defined subclasses, the category
-     * name is {@code "compression"}.
+     * <p>
+     * For class {@code Compression} and any vendor-defined subclasses, the
+     * category name is {@code "compression"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "compression";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Copies.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Copies.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -22,64 +22,60 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
 import javax.print.attribute.IntegerSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class Copies is an integer valued printing attribute class that specifies the
- * number of copies to be printed.
- * <P>
+ * Class {@code Copies} is an integer valued printing attribute class that
+ * specifies the number of copies to be printed.
+ * <p>
  * On many devices the supported number of collated copies will be limited by
  * the number of physical output bins on the device, and may be different from
  * the number of uncollated copies which can be supported.
- * <P>
- * The effect of a Copies attribute with a value of <I>n</I> on a multidoc print
- * job (a job with multiple documents) depends on the (perhaps defaulted) value
- * of the {@link MultipleDocumentHandling MultipleDocumentHandling} attribute:
- * <UL>
- * <LI>
- * SINGLE_DOCUMENT -- The result will be <I>n</I> copies of a single output
- * document comprising all the input docs.
- *
- * <LI>
- * SINGLE_DOCUMENT_NEW_SHEET -- The result will be <I>n</I> copies of a single
- * output document comprising all the input docs, and the first impression of
- * each input doc will always start on a new media sheet.
+ * <p>
+ * The effect of a {@code Copies} attribute with a value of <i>n</i> on a
+ * multidoc print job (a job with multiple documents) depends on the (perhaps
+ * defaulted) value of the
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute:
+ * <ul>
+ *   <li>{@code SINGLE_DOCUMENT} -- The result will be <i>n</i> copies of a
+ *   single output document comprising all the input docs.
+ *   <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- The result will be <i>n</i> copies
+ *   of a single output document comprising all the input docs, and the first
+ *   impression of each input doc will always start on a new media sheet.
+ *   <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The result will be
+ *   <i>n</i> copies of the first input document, followed by <i>n</i> copies of
+ *   the second input document, . . . followed by <i>n</i> copies of the last
+ *   input document.
+ *   <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The result will be the
+ *   first input document, the second input document, . . . the last input
+ *   document, the group of documents being repeated <i>n</i> times.
+ * </ul>
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * <LI>
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The result will be <I>n</I> copies of
- * the first input document, followed by <I>n</I> copies of the second input
- * document, . . . followed by <I>n</I> copies of the last input document.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The result will be the first input
- * document, the second input document, . . . the last input document, the group
- * of documents being repeated <I>n</I> times.
- * </UL>
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
- *
- * @author  David Mendenhall
- * @author  Alan Kamihensky
+ * @author David Mendenhall
+ * @author Alan Kamihensky
  */
 public final class Copies extends IntegerSyntax
         implements PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -6426631521680023833L;
 
     /**
      * Construct a new copies attribute with the given integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *  (Unchecked exception) Thrown if {@code value} is less than 1.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value < 1}
      */
     public Copies(int value) {
         super (value, 1, Integer.MAX_VALUE);
@@ -88,20 +84,15 @@
     /**
      * Returns whether this copies attribute is equivalent to the passed in
      * object. To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class Copies.
-     * <LI>
-     * This copies attribute's value and {@code object}'s value are
-     * equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code Copies}.
+     *   <li>This copies attribute's value and {@code object}'s value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this copies
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this copies
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return super.equals (object) && object instanceof Copies;
@@ -110,11 +101,11 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class Copies, the category is class Copies itself.
+     * <p>
+     * For class {@code Copies}, the category is class {@code Copies} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return Copies.class;
@@ -123,13 +114,12 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class Copies, the category name is {@code "copies"}.
+     * <p>
+     * For class {@code Copies}, the category name is {@code "copies"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "copies";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/CopiesSupported.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/CopiesSupported.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,33 +30,34 @@
 import javax.print.attribute.SupportedValuesAttribute;
 
 /**
- * Class CopiesSupported is a printing attribute class, a set of integers, that
- * gives the supported values for a {@link Copies Copies} attribute. It is
- * restricted to a single contiguous range of integers; multiple non-overlapping
- * ranges are not allowed.
- * <P>
- * <B>IPP Compatibility:</B> The CopiesSupported attribute's canonical array
+ * Class {@code CopiesSupported} is a printing attribute class, a set of
+ * integers, that gives the supported values for a {@link Copies Copies}
+ * attribute. It is restricted to a single contiguous range of integers;
+ * multiple non-overlapping ranges are not allowed.
+ * <p>
+ * <b>IPP Compatibility:</b> The CopiesSupported attribute's canonical array
  * form gives the lower and upper bound for the range of copies to be included
- * in an IPP "copies-supported" attribute. See class {@link
- * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
- * explanation of canonical array form. The category name returned by
- * {@code getName()} gives the IPP attribute name.
+ * in an IPP "copies-supported" attribute. See class
+ * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical
+ * array form. The category name returned by {@code getName()} gives the IPP
+ * attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class CopiesSupported extends SetOfIntegerSyntax
         implements SupportedValuesAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 6927711687034846001L;
 
     /**
      * Construct a new copies supported attribute containing a single integer.
-     * That is, only the one value of Copies is supported.
+     * That is, only the one value of {@code Copies} is supported.
      *
-     * @param  member  Set member.
-     *
-     * @exception  IllegalArgumentException
-     *  (Unchecked exception) Thrown if {@code member} is less than 1.
+     * @param  member set member
+     * @throws IllegalArgumentException if {@code member < 1}
      */
     public CopiesSupported(int member) {
         super (member);
@@ -66,16 +68,14 @@
 
     /**
      * Construct a new copies supported attribute containing a single range of
-     * integers. That is, only those values of Copies in the one range are
-     * supported.
+     * integers. That is, only those values of {@code Copies} in the one range
+     * are supported.
      *
-     * @param  lowerBound  Lower bound of the range.
-     * @param  upperBound  Upper bound of the range.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if a null range is specified or if a
-     *     non-null range is specified with {@code lowerBound} less than
-     *     1.
+     * @param  lowerBound Lower bound of the range
+     * @param  upperBound Upper bound of the range
+     * @throws IllegalArgumentException if a {@code null} range is specified or
+     *         if a {@code non-null} range is specified with {@code lowerBound}
+     *         less than 1
      */
     public CopiesSupported(int lowerBound, int upperBound) {
         super(lowerBound, upperBound);
@@ -91,20 +91,16 @@
      * Returns whether this copies supported attribute is equivalent to the
      * passed in object. To be equivalent, all of the following conditions must
      * be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class CopiesSupported.
-     * <LI>
-     * This copies supported attribute's members and {@code object}'s
-     * members are the same.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code CopiesSupported}.
+     *   <li>This copies supported attribute's members and {@code object}'s
+     *   members are the same.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this copies
-     *          supported attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this copies
+     *         supported attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return super.equals (object) && object instanceof CopiesSupported;
@@ -113,12 +109,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class CopiesSupported, the category
-     * is class CopiesSupported itself.
+     * <p>
+     * For class {@code CopiesSupported}, the category is class
+     * {@code CopiesSupported} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return CopiesSupported.class;
@@ -127,14 +123,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class CopiesSupported, the category
-     * name is {@code "copies-supported"}.
+     * <p>
+     * For class {@code CopiesSupported}, the category name is
+     * {@code "copies-supported"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "copies-supported";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCompleted.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCompleted.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,47 +22,50 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
+import java.util.Calendar;
 import java.util.Date;
+
 import javax.print.attribute.Attribute;
 import javax.print.attribute.DateTimeSyntax;
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class DateTimeAtCompleted is a printing attribute class, a date-time
+ * Class {@code DateTimeAtCompleted} is a printing attribute class, a date-time
  * attribute, that indicates the date and time at which the Print Job completed
  * (or was canceled or aborted).
- * <P>
- * To construct a DateTimeAtCompleted attribute from separate values of the
- * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar
- * Calendar} object to construct a {@link java.util.Date Date} object, then use
- * the {@link java.util.Date Date} object to construct the DateTimeAtCompleted
- * attribute. To convert a DateTimeAtCompleted attribute to separate values of
- * the year, month, day, hour, minute, and so on, create a {@link
- * java.util.Calendar Calendar} object and set it to the {@link java.util.Date
- * Date} from the DateTimeAtCompleted attribute.
- * <P>
- * <B>IPP Compatibility:</B> The information needed to construct an IPP
+ * <p>
+ * To construct a {@code DateTimeAtCompleted} attribute from separate values of
+ * the year, month, day, hour, minute, and so on, use a
+ * {@link Calendar Calendar} object to construct a {@link Date Date} object,
+ * then use the {@link Date Date} object to construct the DateTimeAtCompleted
+ * attribute. To convert a {@code DateTimeAtCompleted} attribute to separate
+ * values of the year, month, day, hour, minute, and so on, create a
+ * {@link Calendar Calendar} object and set it to the {@link Date Date} from the
+ * {@code DateTimeAtCompleted} attribute.
+ * <p>
+ * <b>IPP Compatibility:</b> The information needed to construct an IPP
  * "date-time-at-completed" attribute can be obtained as described above. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class DateTimeAtCompleted extends DateTimeSyntax
     implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 6497399708058490000L;
 
     /**
-     * Construct a new date-time at completed attribute with the given {@link
-     * java.util.Date Date} value.
+     * Construct a new date-time at completed attribute with the given
+     * {@link Date Date} value.
      *
-     * @param  dateTime  {@link java.util.Date Date} value.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code dateTime} is null.
+     * @param  dateTime {@link Date Date} value
+     * @throws NullPointerException if {@code dateTime} is {@code null}
      */
     public DateTimeAtCompleted(Date dateTime) {
         super (dateTime);
@@ -72,38 +75,34 @@
      * Returns whether this date-time at completed attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class DateTimeAtCompleted.
-     * <LI>
-     * This date-time at completed attribute's {@link java.util.Date Date} value
-     * and {@code object}'s {@link java.util.Date Date} value are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code DateTimeAtCompleted}.
+     *   <li>This date-time at completed attribute's {@link Date Date}
+     *   value and {@code object}'s {@link Date Date} value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this date-time
-     *          at completed attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this date-time at
+     *         completed attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return(super.equals (object) &&
                object instanceof DateTimeAtCompleted);
     }
 
-// Exported operations inherited and implemented from interface Attribute.
+    // Exported operations inherited and implemented from interface Attribute.
 
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-         * <P>
-         * For class DateTimeAtCompleted, the category is class
-         * DateTimeAtCompleted itself.
-         *
-         * @return  Printing attribute class (category), an instance of class
-         *          {@link java.lang.Class java.lang.Class}.
-         */
+     * <p>
+     * For class {@code DateTimeAtCompleted}, the category is class
+     * {@code DateTimeAtCompleted} itself.
+     *
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
+     */
     public final Class<? extends Attribute> getCategory() {
         return DateTimeAtCompleted.class;
     }
@@ -111,14 +110,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class DateTimeAtCompleted, the category name is
+     * <p>
+     * For class {@code DateTimeAtCompleted}, the category name is
      * {@code "date-time-at-completed"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "date-time-at-completed";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCreation.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCreation.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,70 +22,69 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
+import java.util.Calendar;
 import java.util.Date;
+
 import javax.print.attribute.Attribute;
 import javax.print.attribute.DateTimeSyntax;
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class DateTimeAtCreation is a printing attribute class, a date-time
+ * Class {@code DateTimeAtCreation} is a printing attribute class, a date-time
  * attribute, that indicates the date and time at which the Print Job was
  * created.
- * <P>
- * To construct a DateTimeAtCreation attribute from separate values of the year,
- * month, day, hour, minute, and so on, use a {@link java.util.Calendar
- * Calendar} object to construct a {@link java.util.Date Date} object, then use
- * the {@link java.util.Date Date} object to construct the DateTimeAtCreation
- * attribute. To convert a DateTimeAtCreation attribute to separate values of
- * the year, month, day, hour, minute, and so on, create a {@link
- * java.util.Calendar Calendar} object and set it to the {@link java.util.Date
- * Date} from the DateTimeAtCreation attribute.
- * <P>
- * <B>IPP Compatibility:</B> The information needed to construct an IPP
+ * <p>
+ * To construct a {@code DateTimeAtCreation} attribute from separate values of
+ * the year, month, day, hour, minute, and so on, use a
+ * {@link Calendar Calendar} object to construct a {@link Date Date} object,
+ * then use the {@link Date Date} object to construct the DateTimeAtCreation
+ * attribute. To convert a {@code DateTimeAtCreation} attribute to separate
+ * values of the year, month, day, hour, minute, and so on, create a
+ * {@link Calendar Calendar} object and set it to the {@link Date Date} from the
+ * {@code DateTimeAtCreation} attribute.
+ * <p>
+ * <b>IPP Compatibility:</b> The information needed to construct an IPP
  * "date-time-at-creation" attribute can be obtained as described above. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class DateTimeAtCreation   extends DateTimeSyntax
         implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -2923732231056647903L;
 
     /**
-     * Construct a new date-time at creation attribute with the given {@link
-     * java.util.Date Date} value.
+     * Construct a new date-time at creation attribute with the given
+     * {@link Date Date} value.
      *
-     * @param  dateTime  {@link java.util.Date Date} value.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code dateTime} is null.
+     * @param  dateTime {@link Date Date} value
+     * @throws NullPointerException if {@code dateTime} is {@code null}
      */
     public DateTimeAtCreation(Date dateTime) {
         super (dateTime);
     }
 
     /**
-     * Returns whether this date-time at creation attribute is equivalent to
-     * the passed in object. To be equivalent, all of the following conditions
-     * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class DateTimeAtCreation.
-     * <LI>
-     * This date-time at creation attribute's {@link java.util.Date Date} value
-     * and {@code object}'s {@link java.util.Date Date} value are equal.
-     * </OL>
+     * Returns whether this date-time at creation attribute is equivalent to the
+     * passed in object. To be equivalent, all of the following conditions must
+     * be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code DateTimeAtCreation}.
+     *   <li>This date-time at creation attribute's {@link Date Date}
+     *   value and {@code object}'s {@link Date Date} value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this date-time
-     *          at creation attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this date-time at
+     *         creation attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return(super.equals (object) &&
@@ -95,12 +94,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class DateTimeAtCreation, the category is class
-     * DateTimeAtCreation itself.
+     * <p>
+     * For class {@code DateTimeAtCreation}, the category is class
+     * {@code DateTimeAtCreation} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return DateTimeAtCreation.class;
@@ -109,14 +108,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class DateTimeAtCreation, the category name is
+     * <p>
+     * For class {@code DateTimeAtCreation}, the category name is
      * {@code "date-time-at-creation"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "date-time-at-creation";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtProcessing.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtProcessing.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,47 +22,50 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
+import java.util.Calendar;
 import java.util.Date;
+
 import javax.print.attribute.Attribute;
 import javax.print.attribute.DateTimeSyntax;
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class DateTimeAtProcessing is a printing attribute class, a date-time
+ * Class {@code DateTimeAtProcessing} is a printing attribute class, a date-time
  * attribute, that indicates the date and time at which the Print Job first
  * began processing.
- * <P>
- * To construct a DateTimeAtProcessing attribute from separate values of the
- * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar
- * Calendar} object to construct a {@link java.util.Date Date} object, then use
- * the {@link java.util.Date Date} object to construct the DateTimeAtProcessing
- * attribute. To convert a DateTimeAtProcessing attribute to separate values of
- * the year, month, day, hour, minute, and so on, create a {@link
- * java.util.Calendar Calendar} object and set it to the {@link java.util.Date
- * Date} from the DateTimeAtProcessing attribute.
- * <P>
- * <B>IPP Compatibility:</B> The information needed to construct an IPP
+ * <p>
+ * To construct a {@code DateTimeAtProcessing} attribute from separate values of
+ * the year, month, day, hour, minute, and so on, use a
+ * {@link Calendar Calendar} object to construct a {@link Date Date} object,
+ * then use the {@link Date Date} object to construct the DateTimeAtProcessing
+ * attribute. To convert a {@code DateTimeAtProcessing} attribute to separate
+ * values of the year, month, day, hour, minute, and so on, create a
+ * {@link Calendar Calendar} object and set it to the {@link Date Date} from the
+ * {@code DateTimeAtProcessing} attribute.
+ * <p>
+ * <b>IPP Compatibility:</b> The information needed to construct an IPP
  * "date-time-at-processing" attribute can be obtained as described above. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class DateTimeAtProcessing extends DateTimeSyntax
         implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -3710068197278263244L;
 
     /**
-     * Construct a new date-time at processing attribute with the given {@link
-     * java.util.Date Date} value.
+     * Construct a new date-time at processing attribute with the given
+     * {@link Date Date} value.
      *
-     * @param  dateTime  {@link java.util.Date Date} value.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code dateTime} is null.
+     * @param  dateTime {@link Date Date} value
+     * @throws NullPointerException if {@code dateTime} is {@code null}
      */
     public DateTimeAtProcessing(Date dateTime) {
         super (dateTime);
@@ -72,21 +75,17 @@
      * Returns whether this date-time at processing attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class DateTimeAtProcessing.
-     * <LI>
-     * This date-time at processing attribute's {@link java.util.Date Date}
-     * value and {@code object}'s {@link java.util.Date Date} value
-     * are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code DateTimeAtProcessing}.
+     *   <li>This date-time at processing attribute's {@link Date Date}
+     *   value and {@code object}'s {@link Date Date} value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this date-time
-     *          at processing attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this date-time at
+     *         processing attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return(super.equals (object) &&
@@ -96,12 +95,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class DateTimeAtProcessing, the category is class
-     * DateTimeAtProcessing itself.
+     * <p>
+     * For class {@code DateTimeAtProcessing}, the category is class
+     * {@code DateTimeAtProcessing} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return DateTimeAtProcessing.class;
@@ -110,14 +109,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class DateTimeAtProcessing, the category name is
+     * <p>
+     * For class {@code DateTimeAtProcessing}, the category name is
      * {@code "date-time-at-processing"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "date-time-at-processing";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Destination.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Destination.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,72 +22,70 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
+import java.io.File;
 import java.net.URI;
 
 import javax.print.attribute.Attribute;
-import javax.print.attribute.URISyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
+import javax.print.attribute.URISyntax;
 
 /**
- * Class Destination is a printing attribute class, a URI, that is used to
- * indicate an alternate destination for the spooled printer formatted
- * data. Many PrintServices will not support the notion of a destination
- * other than the printer device, and so will not support this attribute.
+ * Class {@code Destination} is a printing attribute class, a {@code URI}, that
+ * is used to indicate an alternate destination for the spooled printer
+ * formatted data. Many {@code PrintServices} will not support the notion of a
+ * destination other than the printer device, and so will not support this
+ * attribute.
  * <p>
- * A common use for this attribute will be applications which want
- * to redirect output to a local disk file : eg."file:out.prn".
- * Note that proper construction of "file:" scheme URI instances should
- * be performed using the {@code toURI()} method of class
- * {@link java.io.File File}.
- * See the documentation on that class for more information.
+ * A common use for this attribute will be applications which want to redirect
+ * output to a local disk file : eg."file:out.prn". Note that proper
+ * construction of "file:" scheme {@code URI} instances should be performed
+ * using the {@code toURI()} method of class {@link File File}. See the
+ * documentation on that class for more information.
  * <p>
- * If a destination URI is specified in a PrintRequest and it is not
- * accessible for output by the PrintService, a PrintException will be thrown.
- * The PrintException may implement URIException to provide a more specific
- * cause.
- * <P>
- * <B>IPP Compatibility:</B> Destination is not an IPP attribute.
+ * If a destination {@code URI} is specified in a PrintRequest and it is not
+ * accessible for output by the {@code PrintService}, a {@code PrintException}
+ * will be thrown. The {@code PrintException} may implement {@code URIException}
+ * to provide a more specific cause.
+ * <p>
+ * <b>IPP Compatibility:</b> Destination is not an IPP attribute.
  *
- * @author  Phil Race.
+ * @author Phil Race
  */
 public final class Destination extends URISyntax
         implements PrintJobAttribute, PrintRequestAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 6776739171700415321L;
 
     /**
-     * Constructs a new destination attribute with the specified URI.
+     * Constructs a new destination attribute with the specified {@code URI}.
      *
-     * @param  uri  URI.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code uri} is null.
+     * @param  uri {@code URI}
+     * @throws NullPointerException if {@code uri} is {@code null}
      */
     public Destination(URI uri) {
         super (uri);
     }
 
     /**
-     * Returns whether this destination attribute is equivalent to the
-     * passed in object. To be equivalent, all of the following conditions
-     * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class Destination.
-     * <LI>
-     * This destination attribute's URI and {@code object}'s URI
-     * are equal.
-     * </OL>
+     * Returns whether this destination attribute is equivalent to the passed in
+     * object. To be equivalent, all of the following conditions must be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code Destination}.
+     *   <li>This destination attribute's {@code URI} and {@code object}'s
+     *   {@code URI} are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this destination
-     *         attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this destination
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) &&
@@ -97,11 +95,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class Destination, the category is class Destination itself.
+     * <p>
+     * For class {@code Destination}, the category is class {@code Destination}
+     * itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return Destination.class;
@@ -110,13 +109,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class Destination, the category name is {@code "spool-data-destination"}.
+     * <p>
+     * For class {@code Destination}, the category name is
+     * {@code "spool-data-destination"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "spool-data-destination";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DialogTypeSelection.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DialogTypeSelection.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,107 +25,112 @@
 
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintRequestAttribute;
 
 /**
- * Class DialogTypeSelection is a printing attribute class, an enumeration,
- * that indicates the user dialog type to be used for specifying
- * printing options.
- * If {@code NATIVE} is specified, then where available, a native
- * platform dialog is displayed.
- * If {@code COMMON} is specified, a cross-platform print dialog is displayed.
- *
- * This option to specify a native dialog for use with an IPP attribute
- * set provides a standard way to reflect back of the setting and option
- * changes made by a user to the calling application, and integrates
- * the native dialog into the Java printing APIs.
- * But note that some options and settings in a native dialog may not
- * necessarily map to IPP attributes as they may be non-standard platform,
- * or even printer specific options.
- * <P>
- * <B>IPP Compatibility:</B> This is not an IPP attribute.
+ * Class {@code DialogTypeSelection} is a printing attribute class, an
+ * enumeration, that indicates the user dialog type to be used for specifying
+ * printing options. If {@code NATIVE} is specified, then where available, a
+ * native platform dialog is displayed. If {@code COMMON} is specified, a
+ * cross-platform print dialog is displayed.
+ * <p>
+ * This option to specify a native dialog for use with an IPP attribute set
+ * provides a standard way to reflect back of the setting and option changes
+ * made by a user to the calling application, and integrates the native dialog
+ * into the Java printing APIs. But note that some options and settings in a
+ * native dialog may not necessarily map to IPP attributes as they may be
+ * non-standard platform, or even printer specific options.
+ * <p>
+ * <b>IPP Compatibility:</b> This is not an IPP attribute.
  *
  * @since 1.7
  */
 public final class DialogTypeSelection extends EnumSyntax
         implements PrintRequestAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.7 for interoperability.
+     */
     private static final long serialVersionUID = 7518682952133256029L;
 
     /**
-     *
+     * The native platform print dialog should be used.
      */
     public static final DialogTypeSelection
         NATIVE = new DialogTypeSelection(0);
 
     /**
-     *
+     * The cross-platform print dialog should be used.
      */
     public static final DialogTypeSelection
         COMMON = new DialogTypeSelection(1);
 
     /**
-     * Constructs a new dialog type selection enumeration value with the
-     * given integer value.
+     * Constructs a new dialog type selection enumeration value with the given
+     * integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected DialogTypeSelection(int value) {
                 super(value);
     }
 
+    /**
+     * The string table for class {@code DialogTypeSelection}.
+     */
     private static final String[] myStringTable = {
         "native", "common"};
 
-
+    /**
+     * The enumeration value table for class
+     * {@code DialogTypeSelection}.
+     */
     private static final DialogTypeSelection[] myEnumValueTable = {
         NATIVE,
         COMMON
     };
 
     /**
-     * Returns the string table for class DialogTypeSelection.
+     * Returns the string table for class {@code DialogTypeSelection}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class DialogTypeSelection.
+     * Returns the enumeration value table for class
+     * {@code DialogTypeSelection}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
     }
 
-
-   /**
+    /**
      * Gets the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class DialogTypeSelection the category is class
-     * DialogTypeSelection itself.
+     * <p>
+     * For class {@code DialogTypeSelection} the category is class
+     * {@code DialogTypeSelection} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return DialogTypeSelection.class;
     }
 
-
     /**
      * Gets the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class DialogTypeSelection the category name is
+     * <p>
+     * For class {@code DialogTypeSelection} the category name is
      * {@code "dialog-type-selection"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "dialog-type-selection";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DocumentName.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DocumentName.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,71 +22,67 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.DocAttribute;
 
 /**
- * Class DocumentName is a printing attribute class, a text attribute, that
- * specifies the name of a document. DocumentName is an attribute of the print
- * data (the doc), not of the Print Job. A document's name is an arbitrary
- * string defined by the client.
- * However if a JobName is not specified, the DocumentName should be used
- * instead, which implies that supporting specification of DocumentName
- * requires reporting of JobName and vice versa.
- * See {@link JobName JobName} for more information.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * Class {@code DocumentName} is a printing attribute class, a text attribute,
+ * that specifies the name of a document. {@code DocumentName} is an attribute
+ * of the print data (the doc), not of the Print Job. A document's name is an
+ * arbitrary string defined by the client. However if a JobName is not
+ * specified, the {@code DocumentName} should be used instead, which implies
+ * that supporting specification of {@code DocumentName} requires reporting of
+ * JobName and vice versa. See {@link JobName JobName} for more information.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class DocumentName extends TextSyntax implements DocAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 7883105848533280430L;
 
     /**
-     * Constructs a new document name attribute with the given document name
-     * and locale.
+     * Constructs a new document name attribute with the given document name and
+     * locale.
      *
-     * @param  documentName  Document name.
-     * @param  locale        Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *   (unchecked exception) Thrown if {@code documentName} is null.
+     * @param  documentName document name
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code documentName} is {@code null}
      */
     public DocumentName(String documentName, Locale locale) {
         super (documentName, locale);
     }
 
     /**
-     * Returns whether this document name attribute is equivalent to the
-     * passed in object.
-     * To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class DocumentName.
-     * <LI>
-     * This document name attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This document name attribute's locale and {@code object}'s locale
-     * are equal.
-     * </OL>
+     * Returns whether this document name attribute is equivalent to the passed
+     * in object. To be equivalent, all of the following conditions must be
+     * true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code DocumentName}.
+     *   <li>This document name attribute's underlying string and
+     *   {@code object}'s underlying string are equal.
+     *   <li>This document name attribute's locale and {@code object}'s locale
+     *   are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this document
-     *          name attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this document
+     *         name attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) && object instanceof DocumentName);
@@ -95,11 +91,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class DocumentName, the category is class DocumentName itself.
+     * <p>
+     * For class {@code DocumentName}, the category is class
+     * {@code DocumentName} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return DocumentName.class;
@@ -108,13 +105,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class DocumentName, the category name is {@code "document-name"}.
+     * <p>
+     * For class {@code DocumentName}, the category name is
+     * {@code "document-name"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "document-name";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Fidelity.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Fidelity.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -30,27 +31,27 @@
 import javax.print.attribute.PrintRequestAttribute;
 
 /**
- * Class Fidelity is a printing attribute class, an enumeration,
- * that indicates whether total fidelity to client supplied print request
- * attributes is required.
- * If FIDELITY_TRUE is specified and a service cannot print the job exactly
- * as specified it must reject the job.
- * If FIDELITY_FALSE is specified a reasonable attempt to print the job is
- * acceptable. If not supplied the default is FIDELITY_FALSE.
- *
- * <P>
- * <B>IPP Compatibility:</B> The IPP boolean value is "true" for FIDELITY_TRUE
- * and "false" for FIDELITY_FALSE. The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
- * See <a href="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911</a> Section 15.1 for
- * a fuller description of the IPP fidelity attribute.
- *
+ * Class {@code Fidelity} is a printing attribute class, an enumeration, that
+ * indicates whether total fidelity to client supplied print request attributes
+ * is required. If {@code FIDELITY_TRUE} is specified and a service cannot print
+ * the job exactly as specified it must reject the job. If
+ * {@code FIDELITY_FALSE} is specified a reasonable attempt to print the job is
+ * acceptable. If not supplied the default is {@code FIDELITY_FALSE}.
+ * <p>
+ * <b>IPP Compatibility:</b> The IPP boolean value is "true" for
+ * {@code FIDELITY_TRUE} and "false" for {@code FIDELITY_FALSE}. The category
+ * name returned by {@code getName()} is the IPP attribute name. The
+ * enumeration's integer value is the IPP enum value. The {@code toString()}
+ * method returns the IPP string representation of the attribute value. See
+ * <a href="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911</a> Section 15.1 for a
+ * fuller description of the IPP fidelity attribute.
  */
 public final class Fidelity extends EnumSyntax
         implements PrintJobAttribute, PrintRequestAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 6320827847329172308L;
 
     /**
@@ -60,53 +61,60 @@
         FIDELITY_TRUE = new Fidelity(0);
 
     /**
-     * The printer should make reasonable attempts to print the job,
-     * even if it cannot print it exactly as specified.
+     * The printer should make reasonable attempts to print the job, even if it
+     * cannot print it exactly as specified.
      */
     public static final Fidelity
         FIDELITY_FALSE = new Fidelity(1);
 
     /**
-     * Construct a new fidelity enumeration value with the
-     * given integer value.
+     * Construct a new fidelity enumeration value with the given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected Fidelity(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code Fidelity}.
+     */
     private static final String[] myStringTable = {
         "true",
         "false"
     };
 
-
+    /**
+     * The enumeration value table for class {@code Fidelity}.
+     */
     private static final Fidelity[] myEnumValueTable = {
         FIDELITY_TRUE,
         FIDELITY_FALSE
     };
 
     /**
-     * Returns the string table for class Fidelity.
+     * Returns the string table for class {@code Fidelity}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class Fidelity.
+     * Returns the enumeration value table for class {@code Fidelity}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
-    }   /**
+    }
+
+    /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class Fidelity the category is class Fidelity itself.
+     * <p>
+     * For class {@code Fidelity} the category is class
+     * {@code Fidelity} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return Fidelity.class;
@@ -115,14 +123,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class Fidelity the category name is
+     * <p>
+     * For class {@code Fidelity} the category name is
      * {@code "ipp-attribute-fidelity"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "ipp-attribute-fidelity";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java	Sat Sep 09 14:36:45 2017 +0200
@@ -22,209 +22,134 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.DocAttribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class Finishings is a printing attribute class, an enumeration, that
- * identifies whether the printer applies a finishing operation of some kind
- * of binding to each copy of each printed document in the job. For multidoc
- * print jobs (jobs with multiple documents), the
- * {@link MultipleDocumentHandling
- * MultipleDocumentHandling} attribute determines what constitutes a "copy"
- * for purposes of finishing.
- * <P>
+ * Class {@code Finishings} is a printing attribute class, an enumeration, that
+ * identifies whether the printer applies a finishing operation of some kind of
+ * binding to each copy of each printed document in the job. For multidoc print
+ * jobs (jobs with multiple documents), the
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute
+ * determines what constitutes a "copy" for purposes of finishing.
+ * <p>
  * Standard Finishings values are:
  * <table class="borderless" style="width:100%;margin: 0px auto">
  * <caption>Standard Finishings values</caption>
- * <TR>
- * <TD STYLE="WIDTH:10%">
- * &nbsp;
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #NONE NONE}
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #STAPLE STAPLE}
- * </TD>
- * <TD STYLE="WIDTH:36%">
- * {@link #EDGE_STITCH EDGE_STITCH}
- * </TD>
- * </TR>
- * <TR>
- * <TD>
- * &nbsp;
- * </TD>
- * <TD>
- * {@link #BIND BIND}
- * </TD>
- * <TD>
- * {@link #SADDLE_STITCH SADDLE_STITCH}
- * </TD>
- * <TD>
- * {@link #COVER COVER}
- * </TD>
- * <TD>
- * &nbsp;
- * </TD>
- * </TR>
- * </TABLE>
- * <P>
- * The following Finishings values are more specific; they indicate a
+ *   <tr>
+ *     <td style="width:10%">&nbsp;
+ *     <td style="width:27%">{@link #NONE NONE}
+ *     <td style="width:27%">{@link #STAPLE STAPLE}
+ *     <td style="width:36%">{@link #EDGE_STITCH EDGE_STITCH}
+ *   <tr>
+ *     <td>&nbsp;
+ *     <td>{@link #BIND BIND}
+ *     <td>{@link #SADDLE_STITCH SADDLE_STITCH}
+ *     <td>{@link #COVER COVER}
+ *     <td>&nbsp;
+ * </table>
+ * <p>
+ * The following {@code Finishings} values are more specific; they indicate a
  * corner or an edge as if the document were a portrait document:
  * <table class="borderless" style="width:100%;margin: 0px auto">
  * <caption>Specific Finishings values</caption>
- * <TR>
- * <TD STYLE="WIDTH:10%">
- * &nbsp;
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #STAPLE_TOP_LEFT STAPLE_TOP_LEFT}
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #EDGE_STITCH_LEFT EDGE_STITCH_LEFT}
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #STAPLE_DUAL_LEFT STAPLE_DUAL_LEFT}
- * </TD>
- * <TD STYLE="WIDTH:9%">
- * &nbsp;
- * </TD>
- * </TR>
- * <TR>
- * <TD STYLE="WIDTH:10%">
- * &nbsp;
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #STAPLE_BOTTOM_LEFT STAPLE_BOTTOM_LEFT}
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #EDGE_STITCH_TOP EDGE_STITCH_TOP}
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #STAPLE_DUAL_TOP STAPLE_DUAL_TOP}
- * </TD>
- * <TD STYLE="WIDTH:9%">
- * &nbsp;
- * </TD>
- * </TR>
- * <TR>
- * <TD STYLE="WIDTH:10%">
- * &nbsp;
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #STAPLE_TOP_RIGHT STAPLE_TOP_RIGHT}
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #EDGE_STITCH_RIGHT EDGE_STITCH_RIGHT}
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #STAPLE_DUAL_RIGHT STAPLE_DUAL_RIGHT}
- * </TD>
- * <TD STYLE="WIDTH:9%">
- * &nbsp;
- * </TD>
- * </TR>
- * <TR>
- * <TD STYLE="WIDTH:10%">
- * &nbsp;
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #STAPLE_BOTTOM_RIGHT STAPLE_BOTTOM_RIGHT}
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #EDGE_STITCH_BOTTOM EDGE_STITCH_BOTTOM}
- * </TD>
- * <TD STYLE="WIDTH:27%">
- * {@link #STAPLE_DUAL_BOTTOM STAPLE_DUAL_BOTTOM}
- * </TD>
- * <TD STYLE="WIDTH:9%">
- * &nbsp;
- * </TD>
- * </TR>
- * </TABLE>
- * <P>
- * The STAPLE_<I>XXX</I> values are specified with respect to the
- * document as if the document were a portrait document. If the document is
- * actually a landscape or a reverse-landscape document, the client supplies the
+ *   <tr>
+ *     <td style="width:10%">&nbsp;
+ *     <td style="width:27%">{@link #STAPLE_TOP_LEFT STAPLE_TOP_LEFT}
+ *     <td style="width:27%">{@link #EDGE_STITCH_LEFT EDGE_STITCH_LEFT}
+ *     <td style="width:27%">{@link #STAPLE_DUAL_LEFT STAPLE_DUAL_LEFT}
+ *     <td style="width:9%">&nbsp;
+ *   <tr>
+ *     <td style="width:10%">&nbsp;
+ *     <td style="width:27%">{@link #STAPLE_BOTTOM_LEFT STAPLE_BOTTOM_LEFT}
+ *     <td style="width:27%">{@link #EDGE_STITCH_TOP EDGE_STITCH_TOP}
+ *     <td style="width:27%">{@link #STAPLE_DUAL_TOP STAPLE_DUAL_TOP}
+ *     <td style="width:9%">&nbsp;
+ *   <tr>
+ *     <td style="width:10%">&nbsp;
+ *     <td style="width:27%">{@link #STAPLE_TOP_RIGHT STAPLE_TOP_RIGHT}
+ *     <td style="width:27%">{@link #EDGE_STITCH_RIGHT EDGE_STITCH_RIGHT}
+ *     <td style="width:27%">{@link #STAPLE_DUAL_RIGHT STAPLE_DUAL_RIGHT}
+ *     <td style="width:9%">&nbsp;
+ *   <tr>
+ *     <td style="width:10%">&nbsp;
+ *     <td style="width:27%">{@link #STAPLE_BOTTOM_RIGHT STAPLE_BOTTOM_RIGHT}
+ *     <td style="width:27%">{@link #EDGE_STITCH_BOTTOM EDGE_STITCH_BOTTOM}
+ *     <td style="width:27%">{@link #STAPLE_DUAL_BOTTOM STAPLE_DUAL_BOTTOM}
+ *     <td style="width:9%">&nbsp;
+ * </table>
+ * <p>
+ * The STAPLE_<i>XXX</i> values are specified with respect to the document as if
+ * the document were a portrait document. If the document is actually a
+ * landscape or a reverse-landscape document, the client supplies the
  * appropriate transformed value. For example, to position a staple in the upper
  * left hand corner of a landscape document when held for reading, the client
- * supplies the STAPLE_BOTTOM_LEFT value (since landscape is
- * defined as a +90 degree rotation from portrait, i.e., anti-clockwise). On the
- * other hand, to position a staple in the upper left hand corner of a
+ * supplies the {@code STAPLE_BOTTOM_LEFT} value (since landscape is defined as
+ * a +90 degree rotation from portrait, i.e., anti-clockwise). On the other
+ * hand, to position a staple in the upper left hand corner of a
  * reverse-landscape document when held for reading, the client supplies the
- * STAPLE_TOP_RIGHT value (since reverse-landscape is defined as a
- * -90 degree rotation from portrait, i.e., clockwise).
- * <P>
+ * {@code STAPLE_TOP_RIGHT} value (since reverse-landscape is defined as a -90
+ * degree rotation from portrait, i.e., clockwise).
+ * <p>
  * The angle (vertical, horizontal, angled) of each staple with respect to the
  * document depends on the implementation which may in turn depend on the value
  * of the attribute.
- * <P>
- * The effect of a Finishings attribute on a multidoc print job (a job
+ * <p>
+ * The effect of a {@code Finishings} attribute on a multidoc print job (a job
  * with multiple documents) depends on whether all the docs have the same
  * binding specified or whether different docs have different bindings
- * specified, and on the (perhaps defaulted) value of the {@link
- * MultipleDocumentHandling MultipleDocumentHandling} attribute.
- * <UL>
- * <LI>
- * If all the docs have the same binding specified, then any value of {@link
- * MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the
- * printer's processing depends on the {@link MultipleDocumentHandling
- * MultipleDocumentHandling} value:
- * <UL>
- * <LI>
- * SINGLE_DOCUMENT -- All the input docs will be bound together as one output
- * document with the specified binding.
- *
- * <LI>
- * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be bound together as one
- * output document with the specified binding, and the first impression of each
- * input doc will always start on a new media sheet.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound
- * separately with the specified binding.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately
- * with the specified binding.
- * </UL>
+ * specified, and on the (perhaps defaulted) value of the
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute.
+ * <ul>
+ *   <li>If all the docs have the same binding specified, then any value of
+ *   {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense, and
+ *   the printer's processing depends on the
+ *   {@link MultipleDocumentHandling MultipleDocumentHandling} value:
+ *   <ul>
+ *     <li>{@code SINGLE_DOCUMENT} -- All the input docs will be bound together
+ *     as one output document with the specified binding.
+ *     <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be bound
+ *     together as one output document with the specified binding, and the first
+ *     impression of each input doc will always start on a new media sheet.
+ *     <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- Each input doc will
+ *     be bound separately with the specified binding.
+ *     <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- Each input doc will be
+ *     bound separately with the specified binding.
+ *   </ul>
+ *   <li>If different docs have different bindings specified, then only two
+ *   values of {@link MultipleDocumentHandling MultipleDocumentHandling} make
+ *   sense, and the printer reports an error when the job is submitted if any
+ *   other value is specified:
+ *   <ul>
+ *     <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- Each input doc will
+ *     be bound separately with its own specified binding.
+ *     <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- Each input doc will be
+ *     bound separately with its own specified binding.
+ *   </ul>
+ * </ul>
+ * <p>
+ * <b>IPP Compatibility:</b> Class Finishings encapsulates some of the IPP enum
+ * values that can be included in an IPP "finishings" attribute, which is a set
+ * of enums. The category name returned by {@code getName()} is the IPP
+ * attribute name. The enumeration's integer value is the IPP enum value. The
+ * {@code toString()} method returns the IPP string representation of the
+ * attribute value. In IPP Finishings is a multi-value attribute, this API
+ * currently allows only one binding to be specified.
  *
- * <LI>
- * If different docs have different bindings specified, then only two values of
- * {@link MultipleDocumentHandling MultipleDocumentHandling} make sense, and the
- * printer reports an error when the job is submitted if any other value is
- * specified:
- * <UL>
- * <LI>
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound
- * separately with its own specified binding.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately
- * with its own specified binding.
- * </UL>
- * </UL>
- * <P>
- * <B>IPP Compatibility:</B> Class Finishings encapsulates some of the
- * IPP enum values that can be included in an IPP "finishings" attribute, which
- * is a set of enums. The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
- * In IPP Finishings is a multi-value attribute, this API currently allows
- * only one binding to be specified.
- *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class Finishings extends EnumSyntax
     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -627840419548391754L;
 
     /**
@@ -241,21 +166,21 @@
     /**
      * This value is specified when it is desired to select a non-printed (or
      * pre-printed) cover for the document. This does not supplant the
-     * specification of a printed cover (on cover stock medium) by the
-     * document  itself.
+     * specification of a printed cover (on cover stock medium) by the document
+     * itself.
      */
     public static final Finishings COVER = new Finishings(6);
 
     /**
-     * This value indicates that a binding is to be applied to the document;
-     * the type and placement of the binding is site-defined.
+     * This value indicates that a binding is to be applied to the document; the
+     * type and placement of the binding is site-defined.
      */
     public static final Finishings BIND = new Finishings(7);
 
     /**
      * Bind the document(s) with one or more staples (wire stitches) along the
-     * middle fold. The exact number and placement of the staples and the
-     * middle fold is implementation- and/or site-defined.
+     * middle fold. The exact number and placement of the staples and the middle
+     * fold is implementation- and/or site-defined.
      */
     public static final Finishings SADDLE_STITCH =
         new Finishings(8);
@@ -275,8 +200,7 @@
         new Finishings(20);
 
     /**
-     * Bind the document(s) with one or more staples in the bottom left
-     * corner.
+     * Bind the document(s) with one or more staples in the bottom left corner.
      */
     public static final Finishings STAPLE_BOTTOM_LEFT =
         new Finishings(21);
@@ -288,8 +212,7 @@
         new Finishings(22);
 
     /**
-     * Bind the document(s) with one or more staples in the bottom right
-     * corner.
+     * Bind the document(s) with one or more staples in the bottom right corner.
      */
     public static final Finishings STAPLE_BOTTOM_RIGHT =
         new Finishings(23);
@@ -327,15 +250,15 @@
         new Finishings(27);
 
     /**
-     * Bind the document(s) with two staples (wire stitches) along the left
-     * edge assuming a portrait document (see above).
+     * Bind the document(s) with two staples (wire stitches) along the left edge
+     * assuming a portrait document (see above).
      */
     public static final Finishings STAPLE_DUAL_LEFT =
         new Finishings(28);
 
     /**
-     * Bind the document(s) with two staples (wire stitches) along the top
-     * edge assuming a portrait document (see above).
+     * Bind the document(s) with two staples (wire stitches) along the top edge
+     * assuming a portrait document (see above).
      */
     public static final Finishings STAPLE_DUAL_TOP =
         new Finishings(29);
@@ -358,12 +281,15 @@
      * Construct a new finishings binding enumeration value with the given
      * integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected Finishings(int value) {
         super(value);
     }
 
+    /**
+     * The string table for class {@code Finishings}.
+     */
     private static final String[] myStringTable =
                 {"none",
                  "staple",
@@ -396,6 +322,9 @@
                  "staple-dual-bottom"
                 };
 
+    /**
+     * The enumeration value table for class {@code Finishings}.
+     */
     private static final Finishings[] myEnumValueTable =
                 {NONE,
                  STAPLE,
@@ -429,21 +358,21 @@
                 };
 
     /**
-     * Returns the string table for class Finishings.
+     * Returns the string table for class {@code Finishings}.
      */
     protected String[] getStringTable() {
         return myStringTable.clone();
     }
 
     /**
-     * Returns the enumeration value table for class Finishings.
+     * Returns the enumeration value table for class {@code Finishings}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
     }
 
     /**
-     * Returns the lowest integer value used by class Finishings.
+     * Returns the lowest integer value used by class {@code Finishings}.
      */
     protected int getOffset() {
         return 3;
@@ -452,12 +381,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class Finishings and any vendor-defined subclasses, the
-     * category is class Finishings itself.
+     * <p>
+     * For class {@code Finishings} and any vendor-defined subclasses, the
+     * category is class {@code Finishings} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return Finishings.class;
@@ -466,14 +395,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class Finishings and any vendor-defined subclasses, the
+     * <p>
+     * For class {@code Finishings} and any vendor-defined subclasses, the
      * category name is {@code "finishings"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "finishings";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobHoldUntil.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobHoldUntil.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,116 +22,118 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
+import java.util.Calendar;
 import java.util.Date;
+
 import javax.print.attribute.Attribute;
 import javax.print.attribute.DateTimeSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobHoldUntil is a printing attribute class, a date-time attribute, that
- * specifies the exact date and time at which the job must become a candidate
- * for printing.
- * <P>
+ * Class {@code JobHoldUntil} is a printing attribute class, a date-time
+ * attribute, that specifies the exact date and time at which the job must
+ * become a candidate for printing.
+ * <p>
  * If the value of this attribute specifies a date-time that is in the future,
  * the printer should add the {@link JobStateReason JobStateReason} value of
- * JOB_HOLD_UNTIL_SPECIFIED to the job's {@link JobStateReasons JobStateReasons}
- * attribute, must move the job to the PENDING_HELD state, and must not schedule
- * the job for printing until the specified date-time arrives.
- * <P>
- * When the specified date-time arrives, the printer must remove the {@link
- * JobStateReason JobStateReason} value of JOB_HOLD_UNTIL_SPECIFIED from the
- * job's {@link JobStateReasons JobStateReasons} attribute, if present. If there
- * are no other job state reasons that keep the job in the PENDING_HELD state,
- * the printer must consider the job as a candidate for processing by moving the
- * job to the PENDING state.
- * <P>
+ * {@code JOB_HOLD_UNTIL_SPECIFIED} to the job's
+ * {@link JobStateReasons JobStateReasons} attribute, must move the job to the
+ * {@code PENDING_HELD} state, and must not schedule the job for printing until
+ * the specified date-time arrives.
+ * <p>
+ * When the specified date-time arrives, the printer must remove the
+ * {@link JobStateReason JobStateReason} value of
+ * {@code JOB_HOLD_UNTIL_SPECIFIED} from the job's
+ * {@link JobStateReasons JobStateReasons} attribute, if present. If there are
+ * no other job state reasons that keep the job in the {@code PENDING_HELD}
+ * state, the printer must consider the job as a candidate for processing by
+ * moving the job to the PENDING state.
+ * <p>
  * If the specified date-time has already passed, the job must be a candidate
  * for processing immediately. Thus, one way to make the job immediately become
- * a candidate for processing is to specify a JobHoldUntil attribute constructed
- * like this (denoting a date-time of January 1, 1970, 00:00:00 GMT):
- * <PRE>
+ * a candidate for processing is to specify a {@code JobHoldUntil} attribute
+ * constructed like this
+ * (denoting a date-time of January 1, 1970, 00:00:00 GMT):
+ * <pre>
  *     JobHoldUntil immediately = new JobHoldUntil (new Date (0L));
- * </PRE>
- * <P>
+ * </pre>
+ * <p>
  * If the client does not supply this attribute in a Print Request and the
  * printer supports this attribute, the printer must use its
- * (implementation-dependent) default JobHoldUntil value at job submission time
- * (unlike most job template attributes that are used if necessary at job
- * processing time).
- * <P>
- * To construct a JobHoldUntil attribute from separate values of the year,
- * month, day, hour, minute, and so on, use a {@link java.util.Calendar
- * Calendar} object to construct a {@link java.util.Date Date} object, then use
- * the {@link java.util.Date Date} object to construct the JobHoldUntil
- * attribute. To convert a JobHoldUntil attribute to separate values of the
- * year, month, day, hour, minute, and so on, create a {@link java.util.Calendar
- * Calendar} object and set it to the {@link java.util.Date Date} from the
- * JobHoldUntil attribute.
- * <P>
- * <B>IPP Compatibility:</B> Although IPP supports a "job-hold-until" attribute
+ * (implementation-dependent) default {@code JobHoldUntil} value at job
+ * submission time (unlike most job template attributes that are used if
+ * necessary at job processing time).
+ * <p>
+ * To construct a {@code JobHoldUntil} attribute from separate values of the
+ * year, month, day, hour, minute, and so on, use a {@link Calendar Calendar}
+ * object to construct a {@link Date Date} object, then use the
+ * {@link Date Date} object to construct the {@code JobHoldUntil} attribute. To
+ * convert a {@code JobHoldUntil} attribute to separate values of the year,
+ * month, day, hour, minute, and so on, create a {@link Calendar Calendar}
+ * object and set it to the {@link Date Date} from the {@code JobHoldUntil}
+ * attribute.
+ * <p>
+ * <b>IPP Compatibility:</b> Although IPP supports a "job-hold-until" attribute
  * specified as a keyword, IPP does not at this time support a "job-hold-until"
  * attribute specified as a date and time. However, the date and time can be
  * converted to one of the standard IPP keywords with some loss of precision;
- * for example, a JobHoldUntil value with today's date and 9:00pm local time
- * might be converted to the standard IPP keyword "night". The category name
- * returned by {@code getName()} gives the IPP attribute name.
+ * for example, a {@code JobHoldUntil} value with today's date and 9:00pm local
+ * time might be converted to the standard IPP keyword "night". The category
+ * name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobHoldUntil extends DateTimeSyntax
         implements PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -1664471048860415024L;
 
-
     /**
      * Construct a new job hold until date-time attribute with the given
-     * {@link java.util.Date Date} value.
+     * {@link Date Date} value.
      *
-     * @param  dateTime  {@link java.util.Date Date} value.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code dateTime} is null.
+     * @param  dateTime {@link Date Date} value
+     * @throws NullPointerException if {@code dateTime} is {@code null}
      */
     public JobHoldUntil(Date dateTime) {
         super (dateTime);
     }
 
     /**
-     * Returns whether this job hold until attribute is equivalent to the
-     * passed in object. To be equivalent, all of the following conditions
-     * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobHoldUntil.
-     * <LI>
-     * This job hold until attribute's {@link java.util.Date Date} value and
-     * {@code object}'s {@link java.util.Date Date} value are equal.
-     * </OL>
+     * Returns whether this job hold until attribute is equivalent to the passed
+     * in object. To be equivalent, all of the following conditions must be
+     * true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code JobHoldUntil}.
+     *   <li>This job hold until attribute's {@link Date Date} value and
+     *   {@code object}'s {@link Date Date} value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job hold
-     *          until attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job hold
+     *         until attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) && object instanceof JobHoldUntil);
     }
 
-
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobHoldUntil, the category is class JobHoldUntil itself.
+     * <p>
+     * For class {@code JobHoldUntil}, the category is class
+     * {@code JobHoldUntil} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobHoldUntil.class;
@@ -140,13 +142,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobHoldUntil, the category name is {@code "job-hold-until"}.
+     * <p>
+     * For class {@code JobHoldUntil}, the category name is
+     * {@code "job-hold-until"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-hold-until";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressions.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressions.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,70 +22,71 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
 import javax.print.attribute.IntegerSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobImpressions is an integer valued printing attribute class that
- * specifies the total size in number of impressions of the document(s) being
- * submitted. An "impression" is the image (possibly many print-stream pages in
- * different configurations) imposed onto a single media page.
- * <P>
- * The JobImpressions attribute describes the size of the job. This attribute is
- * not intended to be a counter; it is intended to be useful routing and
- * scheduling information if known. The printer may try to compute the
- * JobImpressions attribute's value if it is not supplied in the Print Request.
- * Even if the client does supply a value for the JobImpressions attribute in
- * the Print Request, the printer may choose to change the value if the printer
- * is able to compute a value which is more accurate than the client supplied
- * value. The printer may be able to determine the correct value for the
- * JobImpressions attribute either right at job submission time or at any later
- * point in time.
- * <P>
- * As with {@link JobKOctets JobKOctets}, the JobImpressions value must not
- * include the multiplicative factors contributed by the number of copies
+ * Class {@code JobImpressions} is an integer valued printing attribute class
+ * that specifies the total size in number of impressions of the document(s)
+ * being submitted. An "impression" is the image (possibly many print-stream
+ * pages in different configurations) imposed onto a single media page.
+ * <p>
+ * The {@code JobImpressions} attribute describes the size of the job. This
+ * attribute is not intended to be a counter; it is intended to be useful
+ * routing and scheduling information if known. The printer may try to compute
+ * the {@code JobImpressions} attribute's value if it is not supplied in the
+ * Print Request. Even if the client does supply a value for the
+ * {@code JobImpressions} attribute in the Print Request, the printer may choose
+ * to change the value if the printer is able to compute a value which is more
+ * accurate than the client supplied value. The printer may be able to determine
+ * the correct value for the {@code JobImpressions} attribute either right at
+ * job submission time or at any later point in time.
+ * <p>
+ * As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must
+ * not include the multiplicative factors contributed by the number of copies
  * specified by the {@link Copies Copies} attribute, independent of whether the
  * device can process multiple copies without making multiple passes over the
  * job or document data and independent of whether the output is collated or
  * not. Thus the value is independent of the implementation and reflects the
  * size of the document(s) measured in impressions independent of the number of
  * copies.
- * <P>
- * As with {@link JobKOctets JobKOctets}, the JobImpressions value must also not
- * include the multiplicative factor due to a copies instruction embedded in the
- * document data. If the document data actually includes replications of the
- * document data, this value will include such replication. In other words, this
- * value is always the number of impressions in the source document data, rather
- * than a measure of the number of impressions to be produced by the job.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * <p>
+ * As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must
+ * also not include the multiplicative factor due to a copies instruction
+ * embedded in the document data. If the document data actually includes
+ * replications of the document data, this value will include such replication.
+ * In other words, this value is always the number of impressions in the source
+ * document data, rather than a measure of the number of impressions to be
+ * produced by the job.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
+ * @author Alan Kaminsky
  * @see JobImpressionsSupported
  * @see JobImpressionsCompleted
  * @see JobKOctets
  * @see JobMediaSheets
- *
- * @author  Alan Kaminsky
  */
 public final class JobImpressions extends IntegerSyntax
     implements PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 8225537206784322464L;
 
-
     /**
      * Construct a new job impressions attribute with the given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      *
-     * @exception  IllegalArgumentException
-     *  (Unchecked exception) Thrown if {@code value} is less than 0.
      */
     public JobImpressions(int value) {
         super(value, 0, Integer.MAX_VALUE);
@@ -95,20 +96,16 @@
      * Returns whether this job impressions attribute is equivalent to the
      * passed in object. To be equivalent, all of the following conditions must
      * be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobImpressions.
-     * <LI>
-     * This job impressions attribute's value and {@code object}'s value
-     * are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code JobImpressions}.
+     *   <li>This job impressions attribute's value and {@code object}'s value
+     *   are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job
-     *          impressions attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job
+     *         impressions attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return super.equals (object) && object instanceof JobImpressions;
@@ -117,11 +114,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobImpressions, the category is class JobImpressions itself.
+     * <p>
+     * For class {@code JobImpressions}, the category is class
+     * {@code JobImpressions} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobImpressions.class;
@@ -130,14 +128,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobImpressions, the category name is
+     * <p>
+     * For class {@code JobImpressions}, the category name is
      * {@code "job-impressions"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-impressions";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsCompleted.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsCompleted.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,68 +30,66 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobImpressionsCompleted is an integer valued printing attribute class
- * that specifies the number of impressions completed for the job so far. For
- * printing devices, the impressions completed includes interpreting, marking,
- * and stacking the output.
- * <P>
- * The JobImpressionsCompleted attribute describes the progress of the job. This
- * attribute is intended to be a counter. That is, the JobImpressionsCompleted
- * value for a job that has not started processing must be 0. When the job's
- * {@link JobState JobState} is PROCESSING or PROCESSING_STOPPED, the
- * JobImpressionsCompleted value is intended to increase as the job is
+ * Class {@code JobImpressionsCompleted} is an integer valued printing attribute
+ * class that specifies the number of impressions completed for the job so far.
+ * For printing devices, the impressions completed includes interpreting,
+ * marking, and stacking the output.
+ * <p>
+ * The {@code JobImpressionsCompleted} attribute describes the progress of the
+ * job. This attribute is intended to be a counter. That is, the
+ * {@code JobImpressionsCompleted} value for a job that has not started
+ * processing must be 0. When the job's {@link JobState JobState} is
+ * {@code PROCESSING} or {@code PROCESSING_STOPPED}, the
+ * {@code JobImpressionsCompleted} value is intended to increase as the job is
  * processed; it indicates the amount of the job that has been processed at the
  * time the Print Job's attribute set is queried or at the time a print job
- * event is reported. When the job enters the COMPLETED, CANCELED, or ABORTED
- * states, the JobImpressionsCompleted value is the final value for the job.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * event is reported. When the job enters the {@code COMPLETED},
+ * {@code CANCELED}, or {@code ABORTED} states, the
+ * {@code JobImpressionsCompleted} value is the final value for the job.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
+ * @author Alan Kaminsky
  * @see JobImpressions
  * @see JobImpressionsSupported
  * @see JobKOctetsProcessed
  * @see JobMediaSheetsCompleted
- *
- * @author  Alan Kaminsky
  */
 public final class JobImpressionsCompleted extends IntegerSyntax
         implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 6722648442432393294L;
 
     /**
      * Construct a new job impressions completed attribute with the given
      * integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *  (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public JobImpressionsCompleted(int value) {
         super (value, 0, Integer.MAX_VALUE);
     }
 
     /**
-     * Returns whether this job impressions completed attribute is equivalent
-     * tp the passed in object. To be equivalent, all of the following
-     * conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobImpressionsCompleted.
-     * <LI>
-     * This job impressions completed attribute's value and
-     * {@code object}'s value are equal.
-     * </OL>
+     * Returns whether this job impressions completed attribute is equivalent tp
+     * the passed in object. To be equivalent, all of the following conditions
+     * must be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code JobImpressionsCompleted}.
+     *   <li>This job impressions completed attribute's value and
+     *   {@code object}'s value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job
-     *          impressions completed attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job
+     *         impressions completed attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return(super.equals (object) &&
@@ -100,12 +99,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobImpressionsCompleted, the category is class
-     * JobImpressionsCompleted itself.
+     * <p>
+     * For class {@code JobImpressionsCompleted}, the category is class
+     * {@code JobImpressionsCompleted} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobImpressionsCompleted.class;
@@ -114,14 +113,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobImpressionsCompleted, the category name is
+     * <p>
+     * For class {@code JobImpressionsCompleted}, the category name is
      * {@code "job-impressions-completed"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-impressions-completed";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsSupported.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsSupported.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,40 +30,40 @@
 import javax.print.attribute.SupportedValuesAttribute;
 
 /**
- * Class JobImpressionsSupported is a printing attribute class, a set of
- * integers, that gives the supported values for a {@link JobImpressions
- * JobImpressions} attribute. It is restricted to a single contiguous range of
- * integers; multiple non-overlapping ranges are not allowed. This gives the
- * lower and upper bounds of the total sizes of print jobs in number of
- * impressions that the printer will accept.
- * <P>
- * <B>IPP Compatibility:</B> The JobImpressionsSupported attribute's canonical
- * array form gives the lower and upper bound for the range of values to be
- * included in an IPP "job-impressions-supported" attribute. See class {@link
- * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
- * explanation of canonical array form. The category name returned by
- * {@code getName()} gives the IPP attribute name.
+ * Class {@code JobImpressionsSupported} is a printing attribute class, a set of
+ * integers, that gives the supported values for a
+ * {@link JobImpressions JobImpressions} attribute. It is restricted to a single
+ * contiguous range of integers; multiple non-overlapping ranges are not
+ * allowed. This gives the lower and upper bounds of the total sizes of print
+ * jobs in number of impressions that the printer will accept.
+ * <p>
+ * <b>IPP Compatibility:</b> The {@code JobImpressionsSupported} attribute's
+ * canonical array form gives the lower and upper bound for the range of values
+ * to be included in an IPP "job-impressions-supported" attribute. See class
+ * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical
+ * array form. The category name returned by {@code getName()} gives the IPP
+ * attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobImpressionsSupported extends SetOfIntegerSyntax
         implements SupportedValuesAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -4887354803843173692L;
 
-
     /**
      * Construct a new job impressions supported attribute containing a single
-     * range of integers. That is, only those values of JobImpressions in the
-     * one range are supported.
+     * range of integers. That is, only those values of {@code JobImpressions}
+     * in the one range are supported.
      *
-     * @param  lowerBound  Lower bound of the range.
-     * @param  upperBound  Upper bound of the range.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if a null range is specified or if a
-     *     non-null range is specified with {@code lowerBound} less than
-     *     0.
+     * @param  lowerBound lower bound of the range
+     * @param  upperBound upper bound of the range
+     * @throws IllegalArgumentException if a {@code null} range is specified or
+     *         if a {@code non-null} range is specified with {@code lowerBound}
+     *         less than zero
      */
     public JobImpressionsSupported(int lowerBound, int upperBound) {
         super (lowerBound, upperBound);
@@ -74,25 +75,21 @@
         }
     }
 
-
     /**
-     * Returns whether this job impressions supported attribute is equivalent
-     * to the passed in object. To be equivalent, all of the following
-     * conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobImpressionsSupported.
-     * <LI>
-     * This job impressions supported attribute's members and
-     * {@code object}'s members are the same.
-     * </OL>
+     * Returns whether this job impressions supported attribute is equivalent to
+     * the passed in object. To be equivalent, all of the following conditions
+     * must be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code JobImpressionsSupported}.
+     *   <li>This job impressions supported attribute's members and
+     *   {@code object}'s members are the same.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job
-     *          impressions supported attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job
+     *         impressions supported attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -102,12 +99,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobImpressionsSupported, the category is class
-     * JobImpressionsSupported itself.
+     * <p>
+     * For class {@code JobImpressionsSupported}, the category is class
+     * {@code JobImpressionsSupported} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobImpressionsSupported.class;
@@ -116,14 +113,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobImpressionsSupported, the category name is
+     * <p>
+     * For class {@code JobImpressionsSupported}, the category name is
      * {@code "job-impressions-supported"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-impressions-supported";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctets.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctets.java	Sat Sep 09 14:36:45 2017 +0200
@@ -22,126 +22,119 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
 import javax.print.attribute.IntegerSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobKOctets is an integer valued printing attribute class that specifies
- * the total size of the document(s) in K octets, i.e., in units of 1024 octets
- * requested to be processed in the job. The value must be rounded up, so that a
- * job between 1 and 1024 octets must be indicated as being 1K octets, 1025 to
- * 2048 must be 2K octets, etc. For a multidoc print job (a job with multiple
- * documents), the JobKOctets value is computed by adding up the individual
- * documents' sizes in octets, then rounding up to the next K octets value.
- * <P>
- * The JobKOctets attribute describes the size of the job. This attribute is not
- * intended to be a counter; it is intended to be useful routing and scheduling
- * information if known. The printer may try to compute the JobKOctets
- * attribute's value if it is not supplied in the Print Request. Even if the
- * client does supply a value for the JobKOctets attribute in the Print Request,
- * the printer may choose to change the value if the printer is able to compute
- * a value which is more accurate than the client supplied value. The printer
- * may be able to determine the correct value for the JobKOctets attribute
- * either right at job submission time or at any later point in time.
- * <P>
- * The JobKOctets value must not include the multiplicative factors contributed
- * by the number of copies specified by the {@link Copies Copies} attribute,
- * independent of whether the device can process multiple copies without making
- * multiple passes over the job or document data and independent of whether the
- * output is collated or not. Thus the value is independent of the
- * implementation and indicates the size of the document(s) measured in K octets
- * independent of the number of copies.
- * <P>
- * The JobKOctets value must also not include the multiplicative factor due to a
- * copies instruction embedded in the document data. If the document data
- * actually includes replications of the document data, this value will include
- * such replication. In other words, this value is always the size of the source
- * document data, rather than a measure of the hardcopy output to be produced.
- * <P>
+ * Class {@code JobKOctets} is an integer valued printing attribute class that
+ * specifies the total size of the document(s) in K octets, i.e., in units of
+ * 1024 octets requested to be processed in the job. The value must be rounded
+ * up, so that a job between 1 and 1024 octets must be indicated as being 1K
+ * octets, 1025 to 2048 must be 2K octets, etc. For a multidoc print job (a job
+ * with multiple documents), the {@code JobKOctets} value is computed by adding
+ * up the individual documents' sizes in octets, then rounding up to the next K
+ * octets value.
+ * <p>
+ * The {@code JobKOctets} attribute describes the size of the job. This
+ * attribute is not intended to be a counter; it is intended to be useful
+ * routing and scheduling information if known. The printer may try to compute
+ * the {@code JobKOctets} attribute's value if it is not supplied in the Print
+ * Request. Even if the client does supply a value for the {@code JobKOctets}
+ * attribute in the Print Request, the printer may choose to change the value if
+ * the printer is able to compute a value which is more accurate than the client
+ * supplied value. The printer may be able to determine the correct value for
+ * the {@code JobKOctets} attribute either right at job submission time or at
+ * any later point in time.
+ * <p>
+ * The {@code JobKOctets} value must not include the multiplicative factors
+ * contributed by the number of copies specified by the {@link Copies Copies}
+ * attribute, independent of whether the device can process multiple copies
+ * without making multiple passes over the job or document data and independent
+ * of whether the output is collated or not. Thus the value is independent of
+ * the implementation and indicates the size of the document(s) measured in K
+ * octets independent of the number of copies.
+ * <p>
+ * The {@code JobKOctets} value must also not include the multiplicative factor
+ * due to a copies instruction embedded in the document data. If the document
+ * data actually includes replications of the document data, this value will
+ * include such replication. In other words, this value is always the size of
+ * the source document data, rather than a measure of the hardcopy output to be
+ * produced.
+ * <p>
  * The size of a doc is computed based on the print data representation class as
- * specified by the doc's {@link javax.print.DocFlavor DocFlavor}, as
- * shown in the table below.
- *
+ * specified by the doc's {@link javax.print.DocFlavor DocFlavor}, as shown in
+ * the table below.
  * <table class="striped">
  * <caption>Table showing computation of doc sizes</caption>
  * <thead>
- * <TR>
- * <TH>Representation Class</TH>
- * <TH>Document Size</TH>
- * </TR>
+ *   <tr>
+ *     <th>Representation Class
+ *     <th>Document Size
  * </thead>
  * <tbody>
- * <TR>
- * <TD>byte[]</TD>
- * <TD>Length of the byte array</TD>
- * </TR>
- * <TR>
- * <TD>java.io.InputStream</TD>
- * <TD>Number of bytes read from the stream</TD>
- * </TR>
- * <TR>
- * <TD>char[]</TD>
- * <TD>Length of the character array x 2</TD>
- * </TR>
- * <TR>
- * <TD>java.lang.String</TD>
- * <TD>Length of the string x 2</TD>
- * </TR>
- * <TR>
- * <TD>java.io.Reader</TD>
- * <TD>Number of characters read from the stream x 2</TD>
- * </TR>
- * <TR>
- * <TD>java.net.URL</TD>
- * <TD>Number of bytes read from the file at the given URL address</TD>
- * </TR>
- * <TR>
- * <TD>java.awt.image.renderable.RenderableImage</TD>
- * <TD>Implementation dependent&#42;</TD>
- * </TR>
- * <TR>
- * <TD>java.awt.print.Printable</TD>
- * <TD>Implementation dependent&#42;</TD>
- * </TR>
- * <TR>
- * <TD>java.awt.print.Pageable</TD>
- * <TD>Implementation dependent&#42;</TD>
- * </TR>
+ *   <tr>
+ *     <td>{@code byte[]}
+ *     <td>Length of the byte array
+ *   <tr>
+ *     <td>{@code java.io.InputStream}
+ *     <td>Number of bytes read from the stream
+ *   <tr>
+ *     <td>{@code char[]}
+ *     <td>Length of the character array x 2
+ *   <tr>
+ *     <td>{@code java.lang.String}
+ *     <td>Length of the string x 2
+ *   <tr>
+ *     <td>{@code java.io.Reader}
+ *     <td>Number of characters read from the stream x 2
+ *   <tr>
+ *     <td>{@code java.net.URL}
+ *     <td>Number of bytes read from the file at the given {@code URL} address
+ *   <tr>
+ *     <td>{@code java.awt.image.renderable.RenderableImage}
+ *     <td>Implementation dependent&#42;
+ *   <tr>
+ *     <td>{@code java.awt.print.Printable}
+ *     <td>Implementation dependent&#42;
+ *   <tr>
+ *     <td>{@code java.awt.print.Pageable}
+ *     <td>Implementation dependent&#42;
  * </tbody>
- * </TABLE>
- * <P>
+ * </table>
+ * <p>
  * &#42; In these cases the Print Service itself generates the print data sent
- * to the printer. If the Print Service supports the JobKOctets attribute, for
- * these cases the Print Service itself must calculate the size of the print
- * data, replacing any JobKOctets value the client specified.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * to the printer. If the Print Service supports the {@code JobKOctets}
+ * attribute, for these cases the Print Service itself must calculate the size
+ * of the print data, replacing any {@code JobKOctets} value the client
+ * specified.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
+ * @author Alan Kaminsky
  * @see JobKOctetsSupported
  * @see JobKOctetsProcessed
  * @see JobImpressions
  * @see JobMediaSheets
- *
- * @author  Alan Kaminsky
  */
 public final class JobKOctets   extends IntegerSyntax
         implements PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -8959710146498202869L;
 
     /**
      * Construct a new job K octets attribute with the given integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *  (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public JobKOctets(int value) {
         super (value, 0, Integer.MAX_VALUE);
@@ -151,20 +144,16 @@
      * Returns whether this job K octets attribute is equivalent to the passed
      * in object. To be equivalent, all of the following conditions must be
      * true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobKOctets.
-     * <LI>
-     * This job K octets attribute's value and {@code object}'s value
-     * are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code JobKOctets}.
+     *   <li>This job K octets attribute's value and {@code object}'s value are
+     *   equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job K
-     *          octets attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job K octets
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return super.equals(object) && object instanceof JobKOctets;
@@ -173,11 +162,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobKOctets, the category is class JobKOctets itself.
+     * <p>
+     * For class {@code JobKOctets}, the category is class
+     * {@code JobKOctets} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobKOctets.class;
@@ -186,13 +176,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobKOctets, the category name is {@code "job-k-octets"}.
+     * <p>
+     * For class {@code JobKOctets}, the category name is
+     * {@code "job-k-octets"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-k-octets";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsProcessed.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsProcessed.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,57 +30,57 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobKOctetsProcessed is an integer valued printing attribute class that
- * specifies the total number of print data octets processed so far in K octets,
- * i.e., in units of 1024 octets. The value must be rounded up, so that a job
- * between 1 and 1024 octets inclusive must be indicated as being 1K octets,
- * 1025 to 2048 inclusive must be 2K, etc. For a multidoc print job (a job with
- * multiple documents), the JobKOctetsProcessed value is computed by adding up
- * the individual documents' number of octets processed so far, then rounding up
- * to the next K octets value.
- * <P>
- * The JobKOctetsProcessed attribute describes the progress of the job. This
- * attribute is intended to be a counter. That is, the JobKOctetsProcessed value
- * for a job that has not started processing must be 0. When the job's {@link
- * JobState JobState} is PROCESSING or PROCESSING_STOPPED, the
- * JobKOctetsProcessed value is intended to increase as the job is processed; it
- * indicates the amount of the job that has been processed at the time the Print
- * Job's attribute set is queried or at the time a print job event is reported.
- * When the job enters the COMPLETED, CANCELED, or ABORTED states, the
- * JobKOctetsProcessed value is the final value for the job.
- * <P>
+ * Class {@code JobKOctetsProcessed} is an integer valued printing attribute
+ * class that specifies the total number of print data octets processed so far
+ * in K octets, i.e., in units of 1024 octets. The value must be rounded up, so
+ * that a job between 1 and 1024 octets inclusive must be indicated as being 1K
+ * octets, 1025 to 2048 inclusive must be 2K, etc. For a multidoc print job (a
+ * job with multiple documents), the JobKOctetsProcessed value is computed by
+ * adding up the individual documents' number of octets processed so far, then
+ * rounding up to the next K octets value.
+ * <p>
+ * The {@code JobKOctetsProcessed} attribute describes the progress of the job.
+ * This attribute is intended to be a counter. That is, the JobKOctetsProcessed
+ * value for a job that has not started processing must be 0. When the job's
+ * {@link JobState JobState} is {@code PROCESSING} or
+ * {@code PROCESSING_STOPPED}, the {@code JobKOctetsProcessed} value is intended
+ * to increase as the job is processed; it indicates the amount of the job that
+ * has been processed at the time the Print Job's attribute set is queried or at
+ * the time a print job event is reported. When the job enters the
+ * {@code COMPLETED}, {@code CANCELED}, or {@code ABORTED} states, the
+ * {@code JobKOctetsProcessed} value is the final value for the job.
+ * <p>
  * For implementations where multiple copies are produced by the interpreter
  * with only a single pass over the data, the final value of the
- * JobKOctetsProcessed attribute must be equal to the value of the {@link
- * JobKOctets JobKOctets} attribute. For implementations where multiple copies
- * are produced by the interpreter by processing the data for each copy, the
- * final value must be a multiple of the value of the {@link JobKOctets
- * JobKOctets} attribute.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * JobKOctetsProcessed attribute must be equal to the value of the
+ * {@link JobKOctets JobKOctets} attribute. For implementations where multiple
+ * copies are produced by the interpreter by processing the data for each copy,
+ * the final value must be a multiple of the value of the
+ * {@link JobKOctets JobKOctets} attribute.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
+ * @author Alan Kaminsky
  * @see JobKOctets
  * @see JobKOctetsSupported
  * @see JobImpressionsCompleted
  * @see JobMediaSheetsCompleted
- *
- * @author  Alan Kaminsky
  */
 public final class JobKOctetsProcessed extends IntegerSyntax
         implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -6265238509657881806L;
 
     /**
      * Construct a new job K octets processed attribute with the given integer
      * value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *  (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public JobKOctetsProcessed(int value) {
         super (value, 0, Integer.MAX_VALUE);
@@ -89,20 +90,16 @@
      * Returns whether this job K octets processed attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobKOctetsProcessed.
-     * <LI>
-     * This job K octets processed attribute's value and
-     * {@code object}'s value are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code JobKOctetsProcessed}.
+     *   <li>This job K octets processed attribute's value and {@code object}'s
+     *   value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job K
-     *          octets processed attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job K octets
+     *         processed attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return(super.equals (object) &&
@@ -112,12 +109,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobKOctetsProcessed, the category is class
-     * JobKOctetsProcessed itself.
+     * <p>
+     * For class {@code JobKOctetsProcessed}, the category is class
+     * {@code JobKOctetsProcessed} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobKOctetsProcessed.class;
@@ -126,14 +123,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobKOctetsProcessed, the category name is
+     * <p>
+     * For class {@code JobKOctetsProcessed}, the category name is
      * {@code "job-k-octets-processed"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-k-octets-processed";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsSupported.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsSupported.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,25 +30,28 @@
 import javax.print.attribute.SupportedValuesAttribute;
 
 /**
- * Class JobKOctetsSupported is a printing attribute class, a set of integers,
- * that gives the supported values for a {@link JobKOctets JobKOctets}
+ * Class {@code JobKOctetsSupported} is a printing attribute class, a set of
+ * integers, that gives the supported values for a {@link JobKOctets JobKOctets}
  * attribute. It is restricted to a single contiguous range of integers;
  * multiple non-overlapping ranges are not allowed. This gives the lower and
  * upper bounds of the total sizes of print jobs in units of K octets (1024
  * octets) that the printer will accept.
- * <P>
- * <B>IPP Compatibility:</B> The JobKOctetsSupported attribute's canonical array
- * form gives the lower and upper bound for the range of values to be included
- * in an IPP "job-k-octets-supported" attribute. See class {@link
- * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
- * explanation of canonical array form. The category name returned by
- * {@code getName()} gives the IPP attribute name.
+ * <p>
+ * <b>IPP Compatibility:</b> The {@code JobKOctetsSupported} attribute's
+ * canonical array form gives the lower and upper bound for the range of values
+ * to be included in an IPP "job-k-octets-supported" attribute. See class
+ * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical
+ * array form. The category name returned by {@code getName()} gives the IPP
+ * attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobKOctetsSupported extends SetOfIntegerSyntax
     implements SupportedValuesAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -2867871140549897443L;
 
     /**
@@ -55,13 +59,11 @@
      * range of integers. That is, only those values of JobKOctets in the one
      * range are supported.
      *
-     * @param  lowerBound  Lower bound of the range.
-     * @param  upperBound  Upper bound of the range.
-     *
-     * @exception  IllegalArgumentException
-     *  (Unchecked exception) Thrown if a null range is specified or if a
-     *  non-null range is specified with {@code lowerBound} less than
-     *   0.
+     * @param  lowerBound Lower bound of the range
+     * @param  upperBound Upper bound of the range
+     * @throws IllegalArgumentException if a {@code null} range is specified or
+     *         if a {@code non-null} range is specified with {@code lowerBound}
+     *         less than zero
      */
     public JobKOctetsSupported(int lowerBound, int upperBound) {
         super (lowerBound, upperBound);
@@ -77,20 +79,16 @@
      * Returns whether this job K octets supported attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobKOctetsSupported.
-     * <LI>
-     * This job K octets supported attribute's members and
-     * {@code object}'s members are the same.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code JobKOctetsSupported}.
+     *   <li>This job K octets supported attribute's members and
+     *   {@code object}'s members are the same.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job K
-     *          octets supported attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job K octets
+     *         supported attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -100,12 +98,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobKOctetsSupported, the category is class
-     * JobKOctetsSupported itself.
+     * <p>
+     * For class {@code JobKOctetsSupported}, the category is class
+     * {@code JobKOctetsSupported} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobKOctetsSupported.class;
@@ -114,14 +112,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobKOctetsSupported, the category name is
+     * <p>
+     * For class {@code JobKOctetsSupported}, the category name is
      * {@code "job-k-octets-supported"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-k-octets-supported";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheets.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheets.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,63 +22,62 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
 import javax.print.attribute.IntegerSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobMediaSheets is an integer valued printing attribute class that
- * specifies the total number of media sheets to be produced for this job.
- * <P>
- * The JobMediaSheets attribute describes the size of the job. This attribute is
- * not intended to be a counter; it is intended to be useful routing and
- * scheduling information if known. The printer may try to compute the
- * JobMediaSheets attribute's value if it is not supplied in the Print Request.
- * Even if the client does supply a value for the JobMediaSheets attribute in
- * the Print Request, the printer may choose to change the value if the printer
- * is able to compute a value which is more accurate than the client supplied
- * value. The printer may be able to determine the correct value for the
- * JobMediaSheets attribute either right at job submission time or at any later
- * point in time.
- * <P>
- * Unlike the {@link JobKOctets JobKOctets} and {@link JobImpressions
- * JobImpressions} attributes, the JobMediaSheets value must include the
- * multiplicative factors contributed by the number of copies specified by the
- * {@link Copies Copies} attribute and a "number of copies" instruction embedded
- * in the document data, if any. This difference allows the system administrator
- * to control the lower and upper bounds of both (1) the size of the document(s)
- * with {@link JobKOctetsSupported JobKOctetsSupported} and {@link
- * JobImpressionsSupported JobImpressionsSupported} and (2) the size of the job
- * with {@link JobMediaSheetsSupported JobMediaSheetsSupported}.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * Class {@code JobMediaSheets} is an integer valued printing attribute class
+ * that specifies the total number of media sheets to be produced for this job.
+ * <p>
+ * The {@code JobMediaSheets} attribute describes the size of the job. This
+ * attribute is not intended to be a counter; it is intended to be useful
+ * routing and scheduling information if known. The printer may try to compute
+ * the {@code JobMediaSheets} attribute's value if it is not supplied in the
+ * Print Request. Even if the client does supply a value for the
+ * {@code JobMediaSheets} attribute in the Print Request, the printer may choose
+ * to change the value if the printer is able to compute a value which is more
+ * accurate than the client supplied value. The printer may be able to determine
+ * the correct value for the {@code JobMediaSheets} attribute either right at
+ * job submission time or at any later point in time.
+ * <p>
+ * Unlike the {@link JobKOctets JobKOctets} and
+ * {@link JobImpressions JobImpressions} attributes, the {@code JobMediaSheets}
+ * value must include the multiplicative factors contributed by the number of
+ * copies specified by the {@link Copies Copies} attribute and a "number of
+ * copies" instruction embedded in the document data, if any. This difference
+ * allows the system administrator to control the lower and upper bounds of both
+ * (1) the size of the document(s) with
+ * {@link JobKOctetsSupported JobKOctetsSupported} and
+ * {@link JobImpressionsSupported JobImpressionsSupported} and (2) the size of
+ * the job with {@link JobMediaSheetsSupported JobMediaSheetsSupported}.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
+ * @author Alan Kaminsky
  * @see JobMediaSheetsSupported
  * @see JobMediaSheetsCompleted
  * @see JobKOctets
  * @see JobImpressions
- *
- * @author  Alan Kaminsky
  */
 public class JobMediaSheets extends IntegerSyntax
         implements PrintRequestAttribute, PrintJobAttribute {
 
-
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 408871131531979741L;
 
     /**
-     * Construct a new job media sheets attribute with the given integer
-     * value.
+     * Construct a new job media sheets attribute with the given integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public JobMediaSheets(int value) {
         super (value, 0, Integer.MAX_VALUE);
@@ -88,20 +87,16 @@
      * Returns whether this job media sheets attribute is equivalent to the
      * passed in object. To be equivalent, all of the following conditions must
      * be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobMediaSheets.
-     * <LI>
-     * This job media sheets attribute's value and {@code object}'s
-     * value are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code JobMediaSheets}.
+     *   <li>This job media sheets attribute's value and {@code object}'s value
+     *   are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job media
-     *          sheets attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job media
+     *         sheets attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return super.equals(object) && object instanceof JobMediaSheets;
@@ -110,12 +105,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobMediaSheets and any vendor-defined subclasses, the category
-     * is class JobMediaSheets itself.
+     * <p>
+     * For class {@code JobMediaSheets} and any vendor-defined subclasses, the
+     * category is class {@code JobMediaSheets} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobMediaSheets.class;
@@ -124,14 +119,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobMediaSheets and any vendor-defined subclasses, the
+     * <p>
+     * For class {@code JobMediaSheets} and any vendor-defined subclasses, the
      * category name is {@code "job-media-sheets"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-media-sheets";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsCompleted.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsCompleted.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,46 +30,46 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobMediaSheetsCompleted is an integer valued printing attribute class
- * that specifies the number of media sheets which have completed marking and
- * stacking for the entire job so far, whether those sheets have been processed
- * on one side or on both.
- * <P>
- * The JobMediaSheetsCompleted attribute describes the progress of the job. This
- * attribute is intended to be a counter. That is, the JobMediaSheetsCompleted
- * value for a job that has not started processing must be 0. When the job's
- * {@link JobState JobState} is PROCESSING or PROCESSING_STOPPED, the
- * JobMediaSheetsCompleted value is intended to increase as the job is
+ * Class {@code JobMediaSheetsCompleted} is an integer valued printing attribute
+ * class that specifies the number of media sheets which have completed marking
+ * and stacking for the entire job so far, whether those sheets have been
+ * processed on one side or on both.
+ * <p>
+ * The {@code JobMediaSheetsCompleted} attribute describes the progress of the
+ * job. This attribute is intended to be a counter. That is, the
+ * {@code JobMediaSheetsCompleted} value for a job that has not started
+ * processing must be 0. When the job's {@link JobState JobState} is
+ * {@code PROCESSING} or {@code PROCESSING_STOPPED}, the
+ * {@code JobMediaSheetsCompleted} value is intended to increase as the job is
  * processed; it indicates the amount of the job that has been processed at the
  * time the Print Job's attribute set is queried or at the time a print job
- * event is reported. When the job enters the COMPLETED, CANCELED, or ABORTED
- * states, the JobMediaSheetsCompleted value is the final value for the job.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * event is reported. When the job enters the {@code COMPLETED},
+ * {@code CANCELED}, or {@code ABORTED} states, the
+ * {@code JobMediaSheetsCompleted} value is the final value for the job.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
+ * @author Alan Kaminsky
  * @see JobMediaSheets
  * @see JobMediaSheetsSupported
  * @see JobKOctetsProcessed
  * @see JobImpressionsCompleted
- *
- * @author  Alan Kaminsky
  */
 public final class JobMediaSheetsCompleted extends IntegerSyntax
         implements PrintJobAttribute {
 
-
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 1739595973810840475L;
 
     /**
      * Construct a new job media sheets completed attribute with the given
      * integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public JobMediaSheetsCompleted(int value) {
         super (value, 0, Integer.MAX_VALUE);
@@ -78,20 +79,17 @@
      * Returns whether this job media sheets completed attribute is equivalent
      * to the passed in object. To be equivalent, all of the following
      * conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobMediaSheetsCompleted.
-     * <LI>
-     * This job media sheets completed attribute's value and
-     * {@code object}'s value are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code JobMediaSheetsCompleted}.
+     *   <li>This job media sheets completed attribute's value and
+     *   {@code object}'s value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job media
-     *          sheets completed attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job media
+     *         sheets completed attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -101,12 +99,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobMediaSheetsCompleted, the category is class
-     * JobMediaSheetsCompleted itself.
+     * <p>
+     * For class {@code JobMediaSheetsCompleted}, the category is class
+     * {@code JobMediaSheetsCompleted} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobMediaSheetsCompleted.class;
@@ -115,11 +113,11 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobMediaSheetsCompleted, the category name is
+     * <p>
+     * For class {@code JobMediaSheetsCompleted}, the category name is
      * {@code "job-media-sheets-completed"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-media-sheets-completed";
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsSupported.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsSupported.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,39 +30,40 @@
 import javax.print.attribute.SupportedValuesAttribute;
 
 /**
- * Class JobMediaSheetsSupported is a printing attribute class, a set of
- * integers, that gives the supported values for a {@link JobMediaSheets
- * JobMediaSheets} attribute. It is restricted to a single contiguous range of
- * integers; multiple non-overlapping ranges are not allowed. This gives the
- * lower and upper bounds of the total sizes of print jobs in number of media
- * sheets that the printer will accept.
- * <P>
- * <B>IPP Compatibility:</B> The JobMediaSheetsSupported attribute's canonical
- * array form gives the lower and upper bound for the range of values to be
- * included in an IPP "job-media-sheets-supported" attribute. See class {@link
- * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
- * explanation of canonical array form. The category name returned by
- * {@code getName()} gives the IPP attribute name.
+ * Class {@code JobMediaSheetsSupported} is a printing attribute class, a set of
+ * integers, that gives the supported values for a
+ * {@link JobMediaSheets JobMediaSheets} attribute. It is restricted to a single
+ * contiguous range of integers; multiple non-overlapping ranges are not
+ * allowed. This gives the lower and upper bounds of the total sizes of print
+ * jobs in number of media sheets that the printer will accept.
+ * <p>
+ * <b>IPP Compatibility:</b> The {@code JobMediaSheetsSupported} attribute's
+ * canonical array form gives the lower and upper bound for the range of values
+ * to be included in an IPP "job-media-sheets-supported" attribute. See class
+ * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical
+ * array form. The category name returned by {@code getName()} gives the IPP
+ * attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobMediaSheetsSupported extends SetOfIntegerSyntax
         implements SupportedValuesAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 2953685470388672940L;
 
     /**
      * Construct a new job media sheets supported attribute containing a single
-     * range of integers. That is, only those values of JobMediaSheets in the
-     * one range are supported.
+     * range of integers. That is, only those values of {@code JobMediaSheets}
+     * in the one range are supported.
      *
-     * @param  lowerBound  Lower bound of the range.
-     * @param  upperBound  Upper bound of the range.
-     *
-     * @exception  IllegalArgumentException
-     *  (Unchecked exception) Thrown if a null range is specified or if a
-     *   non-null range is specified with {@code lowerBound} less than
-     *    0.
+     * @param  lowerBound lower bound of the range
+     * @param  upperBound upper bound of the range
+     * @throws IllegalArgumentException if a {@code null} range is specified or
+     *         if a {@code non-null} range is specified with {@code lowerBound}
+     *         less than zero
      */
     public JobMediaSheetsSupported(int lowerBound, int upperBound) {
         super (lowerBound, upperBound);
@@ -77,20 +79,17 @@
      * Returns whether this job media sheets supported attribute is equivalent
      * to the passed in object. To be equivalent, all of the following
      * conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobMediaSheetsSupported.
-     * <LI>
-     * This job media sheets supported attribute's members and
-     * {@code object}'s members are the same.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code JobMediaSheetsSupported}.
+     *   <li>This job media sheets supported attribute's members and
+     *   {@code object}'s members are the same.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job media
-     *          sheets supported attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job media
+     *         sheets supported attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -100,12 +99,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobMediaSheetsSupported, the
-     * category is class JobMediaSheetsSupported itself.
+     * <p>
+     * For class {@code JobMediaSheetsSupported}, the category is class
+     * {@code JobMediaSheetsSupported} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobMediaSheetsSupported.class;
@@ -114,14 +113,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobMediaSheetsSupported, the
-     * category name is {@code "job-media-sheets-supported"}.
+     * <p>
+     * For class {@code JobMediaSheetsSupported}, the category name is
+     * {@code "job-media-sheets-supported"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-media-sheets-supported";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMessageFromOperator.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMessageFromOperator.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,50 +22,53 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobMessageFromOperator is a printing attribute class, a text attribute,
- * that provides a message from an operator, system administrator, or
+ * Class {@code JobMessageFromOperator} is a printing attribute class, a text
+ * attribute, that provides a message from an operator, system administrator, or
  * "intelligent" process to indicate to the end user the reasons for
  * modification or other management action taken on a job.
- * <P>
+ * <p>
  * A Print Job's attribute set includes zero instances or one instance of a
- * JobMessageFromOperator attribute, not more than one instance. A new
- * JobMessageFromOperator attribute replaces an existing JobMessageFromOperator
- * attribute, if any. In other words, JobMessageFromOperator is not intended to
- * be a history log. If it wishes, the client can detect changes to a Print
- * Job's JobMessageFromOperator attribute and maintain the client's own history
- * log of the JobMessageFromOperator attribute values.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * {@code JobMessageFromOperator} attribute, not more than one instance. A new
+ * {@code JobMessageFromOperator} attribute replaces an existing
+ * {@code JobMessageFromOperator} attribute, if any. In other words,
+ * {@code JobMessageFromOperator} is not intended to be a history log. If it
+ * wishes, the client can detect changes to a Print Job's
+ * {@code JobMessageFromOperator} attribute and maintain the client's own
+ * history log of the {@code JobMessageFromOperator} attribute values.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobMessageFromOperator extends TextSyntax
         implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -4620751846003142047L;
 
     /**
      * Constructs a new job message from operator attribute with the given
      * message and locale.
      *
-     * @param  message  Message.
-     * @param  locale   Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code message} is null.
+     * @param  message the message
+     * @param  locale Natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code message} is {@code null}
      */
     public JobMessageFromOperator(String message, Locale locale) {
         super (message, locale);
@@ -75,23 +78,19 @@
      * Returns whether this job message from operator attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobMessageFromOperator.
-     * <LI>
-     * This job message from operator attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This job message from operator attribute's locale and
-     * {@code object}'s locale are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code JobMessageFromOperator}.
+     *   <li>This job message from operator attribute's underlying string and
+     *   {@code object}'s underlying string are equal.
+     *   <li>This job message from operator attribute's locale and
+     *   {@code object}'s locale are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job
-     *          message from operator attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job message
+     *         from operator attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -101,12 +100,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobMessageFromOperator, the
-     * category is class JobMessageFromOperator itself.
+     * <p>
+     * For class {@code JobMessageFromOperator}, the category is class
+     * {@code JobMessageFromOperator} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobMessageFromOperator.class;
@@ -115,14 +114,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobMessageFromOperator, the
-     * category name is {@code "job-message-from-operator"}.
+     * <p>
+     * For class {@code JobMessageFromOperator}, the category name is
+     * {@code "job-message-from-operator"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-message-from-operator";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobName.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobName.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,50 +22,53 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
-import javax.print.attribute.TextSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
+import javax.print.attribute.TextSyntax;
 
 /**
- * Class JobName is a printing attribute class, a text attribute, that specifies
- * the name of a print job. A job's name is an arbitrary string defined by the
- * client. It does not need to be unique between different jobs. A Print Job's
- * JobName attribute is set to the value supplied by the client in the Print
- * Request's attribute set. If, however, the client does not supply a JobName
- * attribute in the Print Request, the printer, when it creates the Print Job,
- * must generate a JobName. The printer should generate the value of the Print
- * Job's JobName attribute from the first of the following sources that produces
- * a value: (1) the {@link DocumentName DocumentName} attribute of the first (or
- * only) doc in the job, (2) the URL of the first (or only) doc in the job, if
- * the doc's print data representation object is a URL, or (3) any other piece
- * of Print Job specific and/or document content information.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * Class {@code JobName} is a printing attribute class, a text attribute, that
+ * specifies the name of a print job. A job's name is an arbitrary string
+ * defined by the client. It does not need to be unique between different jobs.
+ * A Print Job's {@code JobName} attribute is set to the value supplied by the
+ * client in the Print Request's attribute set. If, however, the client does not
+ * supply a {@code JobName} attribute in the Print Request, the printer, when it
+ * creates the Print Job, must generate a {@code JobName}. The printer should
+ * generate the value of the Print Job's {@code JobName} attribute from the
+ * first of the following sources that produces a value: (1) the
+ * {@link DocumentName DocumentName} attribute of the first (or only) doc in the
+ * job, (2) the {@code URL} of the first (or only) doc in the job, if the doc's
+ * print data representation object is a {@code URL}, or (3) any other piece of
+ * Print Job specific and/or document content information.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobName extends TextSyntax
         implements PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 4660359192078689545L;
 
     /**
      * Constructs a new job name attribute with the given job name and locale.
      *
-     * @param  jobName  Job name.
-     * @param  locale   Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code jobName} is null.
+     * @param  jobName job name
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code jobName} is {@code null}
      */
     public JobName(String jobName, Locale locale) {
         super (jobName, locale);
@@ -74,23 +77,18 @@
     /**
      * Returns whether this job name attribute is equivalent to the passed in
      * object. To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobName.
-     * <LI>
-     * This job name attribute's underlying string and {@code object}'s
-     * underlying string are equal.
-     * <LI>
-     * This job name attribute's locale and {@code object}'s locale are
-     * equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code JobName}.
+     *   <li>This job name attribute's underlying string and {@code object}'s
+     *   underlying string are equal.
+     *   <li>This job name attribute's locale and {@code object}'s locale are
+     *   equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job name
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job name
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) && object instanceof JobName);
@@ -99,11 +97,11 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobName, the category is class JobName itself.
+     * <p>
+     * For class {@code JobName}, the category is class {@code JobName} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobName.class;
@@ -112,13 +110,12 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobName, the category name is {@code "job-name"}.
+     * <p>
+     * For class {@code JobName}, the category name is {@code "job-name"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-name";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,50 +22,50 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobOriginatingUserName is a printing attribute class, a text
- * attribute, that contains the name of the end user that submitted the
- * print job. If possible, the printer sets this attribute to the most
- * authenticated printable user name that it can obtain from the
- * authentication service that authenticated the submitted Print Request.
- * If such is not available, the printer uses the value of the
- * {@link RequestingUserName RequestingUserName}
- * attribute supplied by the client in the Print Request's attribute set.
- * If no authentication service is available, and the client did not supply
- * a {@link RequestingUserName RequestingUserName} attribute,
- * the printer sets the JobOriginatingUserName attribute to an empty
- * (zero-length) string.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * Class {@code JobOriginatingUserName} is a printing attribute class, a text
+ * attribute, that contains the name of the end user that submitted the print
+ * job. If possible, the printer sets this attribute to the most authenticated
+ * printable user name that it can obtain from the authentication service that
+ * authenticated the submitted Print Request. If such is not available, the
+ * printer uses the value of the {@link RequestingUserName RequestingUserName}
+ * attribute supplied by the client in the Print Request's attribute set. If no
+ * authentication service is available, and the client did not supply a
+ * {@link RequestingUserName RequestingUserName} attribute, the printer sets the
+ * JobOriginatingUserName attribute to an empty (zero-length) string.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobOriginatingUserName extends TextSyntax
         implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -8052537926362933477L;
 
     /**
-     * Constructs a new job originating user name attribute with the given
-     * user name and locale.
+     * Constructs a new job originating user name attribute with the given user
+     * name and locale.
      *
-     * @param  userName  User name.
-     * @param  locale    Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code userName} is null.
+     * @param  userName user name
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code userName} is {@code null}
      */
     public JobOriginatingUserName(String userName, Locale locale) {
         super (userName, locale);
@@ -75,23 +75,19 @@
      * Returns whether this job originating user name attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobOriginatingUserName.
-     * <LI>
-     * This job originating user name attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This job originating user name attribute's locale and
-     * {@code object}'s locale are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code JobOriginatingUserName}.
+     *   <li>This job originating user name attribute's underlying string and
+     *   {@code object}'s underlying string are equal.
+     *   <li>This job originating user name attribute's locale and
+     *   {@code object}'s locale are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job
-     *          originating user name attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job
+     *         originating user name attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -101,12 +97,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobOriginatingUserName, the
-     * category is class JobOriginatingUserName itself.
+     * <p>
+     * For class {@code JobOriginatingUserName}, the category is class
+     * {@code JobOriginatingUserName} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobOriginatingUserName.class;
@@ -115,14 +111,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobOriginatingUserName, the
-     * category name is {@code "job-originating-user-name"}.
+     * <p>
+     * For class {@code JobOriginatingUserName}, the category name is
+     * {@code "job-originating-user-name"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-originating-user-name";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPriority.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPriority.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,54 +22,55 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
 import javax.print.attribute.IntegerSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobPriority is an integer valued printing attribute class that
+ * Class {@code JobPriority} is an integer valued printing attribute class that
  * specifies a print job's priority.
- * <P>
- * If a JobPriority attribute is specified for a Print Job, it specifies a
- * priority for scheduling the job. A higher value specifies a higher priority.
- * The value 1 indicates the lowest possible priority. The value 100 indicates
- * the highest possible priority. Among those jobs that are ready to print, a
- * printer must print all jobs with a priority value of <I>n</I> before printing
- * those with a priority value of <I>n</I>-1 for all <I>n.</I>
- * <P>
- * If the client does not specify a JobPriority attribute for a Print Job and
- * the printer does support the JobPriority attribute, the printer must use an
- * implementation-defined default JobPriority value.
- * <P>
+ * <p>
+ * If a {@code JobPriority} attribute is specified for a Print Job, it specifies
+ * a priority for scheduling the job. A higher value specifies a higher
+ * priority. The value 1 indicates the lowest possible priority. The value 100
+ * indicates the highest possible priority. Among those jobs that are ready to
+ * print, a printer must print all jobs with a priority value of <i>n</i> before
+ * printing those with a priority value of <i>n</i>-1 for all <i>n.</i>
+ * <p>
+ * If the client does not specify a {@code JobPriority} attribute for a Print
+ * Job and the printer does support the JobPriority attribute, the printer must
+ * use an implementation-defined default JobPriority value.
+ * <p>
  * The client can always specify any job priority value from 1 to 100 for a job.
- * However, a Print Service instance may support fewer than 100 different
- * job priority levels. If this is the case, the Print Service instance
+ * However, a Print Service instance may support fewer than 100 different job
+ * priority levels. If this is the case, the Print Service instance
  * automatically maps the client-specified job priority value to one of the
  * supported job priority levels, dividing the 100 job priority values equally
  * among the available job priority levels.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobPriority extends IntegerSyntax
     implements PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -4599900369040602769L;
 
     /**
      * Construct a new job priority attribute with the given integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if {@code value} is less than 1
-     *     or greater than 100.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is less than 1 or
+     *         greater than 100
      */
     public JobPriority(int value) {
         super (value, 1, 100);
@@ -79,20 +80,16 @@
      * Returns whether this job priority attribute is equivalent to the passed
      * in object. To be equivalent, all of the following conditions must be
      * true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobPriority.
-     * <LI>
-     * This job priority attribute's value and {@code object}'s value
-     * are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code JobPriority}.
+     *   <li>This job priority attribute's value and {@code object}'s value are
+     *   equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job
-     *          priority attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job priority
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) && object instanceof JobPriority);
@@ -101,11 +98,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobPriority, the category is class JobPriority itself.
+     * <p>
+     * For class {@code JobPriority}, the category is class
+     * {@code JobPriority} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobPriority.class;
@@ -114,13 +112,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobPriority, the category name is {@code "job-priority"}.
+     * <p>
+     * For class {@code JobPriority}, the category name is
+     * {@code "job-priority"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-priority";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPrioritySupported.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPrioritySupported.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,39 +30,38 @@
 import javax.print.attribute.SupportedValuesAttribute;
 
 /**
- * Class JobPrioritySupported is an integer valued printing attribute class
- * that specifies whether a Print Service instance supports the {@link
- * JobPriority JobPriority} attribute and the number of different job priority
- * levels supported.
- * <P>
- * The client can always specify any {@link JobPriority JobPriority} value
- * from 1 to 100 for a job. However, the Print Service instance may support
- * fewer than 100 different job priority levels. If this is the case, the
- * Print Service instance automatically maps the client-specified job priority
- * value to one of the supported job priority levels, dividing the 100 job
- * priority values equally among the available job priority levels.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
- * The category name returned by {@code getName()} gives the IPP
- * attribute name.
+ * Class {@code JobPrioritySupported} is an integer valued printing attribute
+ * class that specifies whether a Print Service instance supports the
+ * {@link JobPriority JobPriority} attribute and the number of different job
+ * priority levels supported.
+ * <p>
+ * The client can always specify any {@link JobPriority JobPriority} value from
+ * 1 to 100 for a job. However, the Print Service instance may support fewer
+ * than 100 different job priority levels. If this is the case, the Print
+ * Service instance automatically maps the client-specified job priority value
+ * to one of the supported job priority levels, dividing the 100 job priority
+ * values equally among the available job priority levels.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobPrioritySupported extends IntegerSyntax
     implements SupportedValuesAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 2564840378013555894L;
 
-
     /**
      * Construct a new job priority supported attribute with the given integer
      * value.
      *
-     * @param  value  Number of different job priority levels supported.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if {@code value} is less than 1
-     *     or greater than 100.
+     * @param  value number of different job priority levels supported
+     * @throws IllegalArgumentException if {@code value} is less than 1 or
+     *         greater than 100
      */
     public JobPrioritySupported(int value) {
         super (value, 1, 100);
@@ -71,20 +71,17 @@
      * Returns whether this job priority supported attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class JobPrioritySupported.
-     * <LI>
-     * This job priority supported attribute's value and
-     * {@code object}'s value are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code JobPrioritySupported}.
+     *   <li>This job priority supported attribute's value and {@code object}'s
+     *   value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this job
-     *          priority supported attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this job priority
+     *         supported attribute, {@code false} otherwise
      */
     public boolean equals (Object object) {
 
@@ -92,16 +89,15 @@
                object instanceof JobPrioritySupported);
     }
 
-
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobPrioritySupported, the
-     * category is class JobPrioritySupported itself.
+     * <p>
+     * For class {@code JobPrioritySupported}, the category is class
+     * {@code JobPrioritySupported} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobPrioritySupported.class;
@@ -110,14 +106,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobPrioritySupported, the
-     * category name is {@code "job-priority-supported"}.
+     * <p>
+     * For class {@code JobPrioritySupported}, the category name is
+     * {@code "job-priority-supported"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-priority-supported";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobSheets.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobSheets.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,39 +22,40 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
-import java.util.Locale;
-
 import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobSheets is a printing attribute class, an enumeration, that
+ * Class {@code JobSheets} is a printing attribute class, an enumeration, that
  * determines which job start and end sheets, if any, must be printed with a
- * job. Class JobSheets declares keywords for standard job sheets values.
- * Implementation- or site-defined names for a job sheets attribute may also be
- * created by defining a subclass of class JobSheets.
- * <P>
- * The effect of a JobSheets attribute on multidoc print jobs (jobs with
- * multiple documents) may be affected by the {@link MultipleDocumentHandling
- * MultipleDocumentHandling} job attribute, depending on the meaning of the
- * particular JobSheets value.
- * <P>
- * <B>IPP Compatibility:</B>  The category name returned by
- * {@code getName()} is the IPP attribute name.  The
- * enumeration's integer value is the IPP enum value.  The
- * {@code toString()} method returns the IPP string representation of
- * the attribute value. For a subclass, the attribute value must be
- * localized to give the IPP name and natural language values.
+ * job. Class {@code JobSheets} declares keywords for standard job sheets
+ * values. Implementation- or site-defined names for a job sheets attribute may
+ * also be created by defining a subclass of class {@code JobSheets}.
+ * <p>
+ * The effect of a {@code JobSheets} attribute on multidoc print jobs (jobs with
+ * multiple documents) may be affected by the
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} job attribute,
+ * depending on the meaning of the particular {@code JobSheets} value.
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value. For a subclass, the attribute value must be localized to
+ * give the IPP name and natural language values.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class JobSheets extends EnumSyntax
         implements PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -4735258056132519759L;
 
     /**
@@ -63,9 +64,8 @@
     public static final JobSheets NONE = new JobSheets(0);
 
     /**
-     * One or more site specific standard job sheets are printed. e.g. a
-     * single start sheet is printed, or both start and end sheets are
-     * printed.
+     * One or more site specific standard job sheets are printed. e.g. a single
+     * start sheet is printed, or both start and end sheets are printed.
      */
     public static final JobSheets STANDARD = new JobSheets(1);
 
@@ -73,31 +73,37 @@
      * Construct a new job sheets enumeration value with the given integer
      * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected JobSheets(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code JobSheets}.
+     */
     private static final String[] myStringTable = {
         "none",
         "standard"
     };
 
+    /**
+     * The enumeration value table for class {@code JobSheets}.
+     */
     private static final JobSheets[] myEnumValueTable = {
         NONE,
         STANDARD
     };
 
     /**
-     * Returns the string table for class JobSheets.
+     * Returns the string table for class {@code JobSheets}.
      */
     protected String[] getStringTable() {
         return myStringTable.clone();
     }
 
     /**
-     * Returns the enumeration value table for class JobSheets.
+     * Returns the enumeration value table for class {@code JobSheets}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
@@ -106,12 +112,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobSheets and any vendor-defined subclasses, the category is
-     * class JobSheets itself.
+     * <p>
+     * For class {@code JobSheets} and any vendor-defined subclasses, the
+     * category is class {@code JobSheets} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobSheets.class;
@@ -120,14 +126,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobSheets and any vendor-defined subclasses, the category
-     * name is {@code "job-sheets"}.
+     * <p>
+     * For class {@code JobSheets} and any vendor-defined subclasses, the
+     * category name is {@code "job-sheets"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-sheets";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobState.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobState.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -30,24 +30,27 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * JobState is a printing attribute class, an enumeration, that identifies
- * the current state of a print job. Class JobState defines standard job state
- * values. A  Print Service implementation only needs to report those job
- * states which are appropriate for the particular implementation; it does not
- * have to report every defined job state. The {@link JobStateReasons
- * JobStateReasons} attribute augments the JobState attribute to give more
- * detailed information about the job in the given job state.
- * <P>
- * <B>IPP Compatibility:</B> The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * {@code JobState} is a printing attribute class, an enumeration, that
+ * identifies the current state of a print job. Class {@code JobState} defines
+ * standard job state values. A Print Service implementation only needs to
+ * report those job states which are appropriate for the particular
+ * implementation; it does not have to report every defined job state. The
+ * {@link JobStateReasons JobStateReasons} attribute augments the
+ * {@code JobState} attribute to give more detailed information about the job in
+ * the given job state.
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
-
 public class JobState extends EnumSyntax implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 400465010094018920L;
 
     /**
@@ -62,61 +65,57 @@
 
     /**
      * The job is not a candidate for processing for any number of reasons but
-     * will return to the PENDING state as soon as the reasons are no longer
-     * present. The job's {@link JobStateReasons JobStateReasons} attribute must
-     * indicate why the job is no longer a candidate for processing.
+     * will return to the {@code PENDING} state as soon as the reasons are no
+     * longer present. The job's {@link JobStateReasons JobStateReasons}
+     * attribute must indicate why the job is no longer a candidate for
+     * processing.
      */
     public static final JobState PENDING_HELD = new JobState(4);
 
     /**
      * The job is processing. One or more of the following activities is
      * occurring:
-     * <OL TYPE=1>
-     * <LI>
-     * The job is using, or is attempting to use, one or more purely software
-     * processes that are analyzing, creating, or interpreting a PDL, etc.
-     *
-     * <LI>
-     * The job is using, or is attempting to use, one or more hardware
-     * devices that are interpreting a PDL, making marks on a medium, and/or
-     * performing finishing, such as stapling, etc.
-     *
-     * <LI>
-     * The printer has made the job ready for printing, but the output
-     * device is not yet printing it, either because the job hasn't reached the
-     * output device or because the job is queued in the output device or some
-     * other spooler, awaiting the output device to print it.
-     * </OL>
-     * <P>
-     * When the job is in the PROCESSING state, the entire job state includes
-     * the detailed status represented in the printer's {@link PrinterState
-     * PrinterState} and {@link PrinterStateReasons PrinterStateReasons}
-     * attributes.
-     * <P>
+     * <ol type=1>
+     *   <li>The job is using, or is attempting to use, one or more purely
+     *   software processes that are analyzing, creating, or interpreting a PDL,
+     *   etc.
+     *   <li>The job is using, or is attempting to use, one or more hardware
+     *   devices that are interpreting a PDL, making marks on a medium, and/or
+     *   performing finishing, such as stapling, etc.
+     *   <li>The printer has made the job ready for printing, but the output
+     *   device is not yet printing it, either because the job hasn't reached
+     *   the output device or because the job is queued in the output device or
+     *   some other spooler, awaiting the output device to print it.
+     * </ol>
+     * When the job is in the {@code PROCESSING} state, the entire job state
+     * includes the detailed status represented in the printer's
+     * {@link PrinterState PrinterState} and
+     * {@link PrinterStateReasons PrinterStateReasons} attributes.
+     * <p>
      * Implementations may, though they need not, include additional values in
      * the job's {@link JobStateReasons JobStateReasons} attribute to indicate
-     * the progress of the job, such as adding the JOB_PRINTING value to
+     * the progress of the job, such as adding the {@code JOB_PRINTING} value to
      * indicate when the output device is actually making marks on paper and/or
-     * the PROCESSING_TO_STOP_POINT value to indicate that the printer is in the
-     * process of canceling or aborting the job.
+     * the {@code PROCESSING_TO_STOP_POINT} value to indicate that the printer
+     * is in the process of canceling or aborting the job.
      */
     public static final JobState PROCESSING = new JobState (5);
 
     /**
      * The job has stopped while processing for any number of reasons and will
-     * return to the PROCESSING state as soon as the reasons are no longer
-     * present.
-     * <P>
+     * return to the {@code PROCESSING} state as soon as the reasons are no
+     * longer present.
+     * <p>
      * The job's {@link JobStateReasons JobStateReasons} attribute may indicate
      * why the job has stopped processing. For example, if the output device is
-     * stopped, the PRINTER_STOPPED value may be included in the job's {@link
-     * JobStateReasons JobStateReasons} attribute.
-     * <P>
-     * <I>Note:</I> When an output device is stopped, the device usually
+     * stopped, the {@code PRINTER_STOPPED} value may be included in the job's
+     * {@link JobStateReasons JobStateReasons} attribute.
+     * <p>
+     * <i>Note:</i> When an output device is stopped, the device usually
      * indicates its condition in human readable form locally at the device. A
      * client can obtain more complete device status remotely by querying the
-     * printer's {@link PrinterState PrinterState} and {@link
-     * PrinterStateReasons PrinterStateReasons} attributes.
+     * printer's {@link PrinterState PrinterState} and
+     * {@link PrinterStateReasons PrinterStateReasons} attributes.
      */
     public static final JobState PROCESSING_STOPPED = new JobState (6);
 
@@ -125,24 +124,27 @@
      * canceling the job, and all job status attributes have reached their final
      * values for the job. While the printer is canceling the job, the job
      * remains in its current state, but the job's {@link JobStateReasons
-     * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT
-     * value and one of the CANCELED_BY_USER, CANCELED_BY_OPERATOR, or
-     * CANCELED_AT_DEVICE values. When the job moves to the CANCELED state, the
-     * PROCESSING_TO_STOP_POINT value, if present, must be removed, but the
-     * CANCELED_BY_<I>xxx</I> value, if present, must remain.
+     * JobStateReasons} attribute should contain the
+     * {@code PROCESSING_TO_STOP_POINT} value and one of the
+     * {@code CANCELED_BY_USER}, {@code CANCELED_BY_OPERATOR}, or
+     * {@code CANCELED_AT_DEVICE} values. When the job moves to the
+     * {@code CANCELED} state, the {@code PROCESSING_TO_STOP_POINT} value, if
+     * present, must be removed, but the CANCELED_BY_<i>xxx</i> value, if
+     * present, must remain.
      */
     public static final JobState CANCELED = new JobState (7);
 
     /**
      * The job has been aborted by the system (usually while the job was in the
-     * PROCESSING or PROCESSING_STOPPED state), the printer has completed
-     * aborting the job, and all job status attributes have reached their final
-     * values for the job. While the printer is aborting the job, the job
-     * remains in its current state, but the job's {@link JobStateReasons
-     * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT
-     * and ABORTED_BY_SYSTEM values. When the job moves to the ABORTED state,
-     * the PROCESSING_TO_STOP_POINT value, if present, must be removed, but the
-     * ABORTED_BY_SYSTEM value, if present, must remain.
+     * {@code PROCESSING} or {@code PROCESSING_STOPPED} state), the printer has
+     * completed aborting the job, and all job status attributes have reached
+     * their final values for the job. While the printer is aborting the job,
+     * the job remains in its current state, but the job's
+     * {@link JobStateReasons JobStateReasons} attribute should contain the
+     * {@code PROCESSING_TO_STOP_POINT} and {@code ABORTED_BY_SYSTEM} values.
+     * When the job moves to the {@code ABORTED} state, the
+     * {@code PROCESSING_TO_STOP_POINT} value, if present, must be removed, but
+     * the {@code ABORTED_BY_SYSTEM} value, if present, must remain.
      */
     public static final JobState ABORTED = new JobState (8);
 
@@ -150,10 +152,10 @@
      * The job has completed successfully or with warnings or errors after
      * processing, all of the job media sheets have been successfully stacked in
      * the appropriate output bin(s), and all job status attributes have reached
-     * their final values for the job. The job's {@link JobStateReasons
-     * JobStateReasons} attribute should contain one of these values:
-     * COMPLETED_SUCCESSFULLY, COMPLETED_WITH_WARNINGS, or
-     * COMPLETED_WITH_ERRORS.
+     * their final values for the job. The job's
+     * {@link JobStateReasons JobStateReasons} attribute should contain one of
+     * these values: {@code COMPLETED_SUCCESSFULLY},
+     * {@code COMPLETED_WITH_WARNINGS}, or {@code COMPLETED_WITH_ERRORS}.
      */
     public static final JobState COMPLETED = new JobState (9);
 
@@ -162,12 +164,15 @@
     /**
      * Construct a new job state enumeration value with the given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected JobState(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code JobState}.
+     */
     private static final String[] myStringTable =
     {"unknown",
      null,
@@ -180,6 +185,9 @@
      "aborted",
      "completed"};
 
+    /**
+     * The enumeration value table for class {@code JobState}.
+     */
     private static final JobState[] myEnumValueTable =
     {UNKNOWN,
      null,
@@ -193,14 +201,14 @@
      COMPLETED};
 
     /**
-     * Returns the string table for class JobState.
+     * Returns the string table for class {@code JobState}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class JobState.
+     * Returns the enumeration value table for class {@code JobState}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
@@ -209,12 +217,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobState and any vendor-defined subclasses, the category is
-     * class JobState itself.
+     * <p>
+     * For class {@code JobState} and any vendor-defined subclasses, the
+     * category is class {@code JobState} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobState.class;
@@ -223,14 +231,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobState and any vendor-defined subclasses, the category
-     * name is {@code "job-state"}.
+     * <p>
+     * For class {@code JobState} and any vendor-defined subclasses, the
+     * category name is {@code "job-state"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-state";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReason.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReason.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,40 +22,45 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.Attribute;
 
 /**
- * Class JobStateReason is a printing attribute class, an enumeration, that
- * provides additional information about the job's current state, i.e.,
+ * Class {@code JobStateReason} is a printing attribute class, an enumeration,
+ * that provides additional information about the job's current state, i.e.,
  * information that augments the value of the job's {@link JobState JobState}
- * attribute. Class JobStateReason defines standard job state reason values. A
- * Print Service implementation only needs to report those job state
+ * attribute. Class {@code JobStateReason} defines standard job state reason
+ * values. A Print Service implementation only needs to report those job state
  * reasons which are appropriate for the particular implementation; it does not
  * have to report every defined job state reason.
- * <P>
- * Instances of JobStateReason do not appear in a Print Job's attribute set
- * directly. Rather, a {@link JobStateReasons JobStateReasons} attribute appears
- * in the Print Job's attribute set. The {@link JobStateReasons JobStateReasons}
- * attribute contains zero, one, or more than one JobStateReason objects which
- * pertain to the Print Job's status. The printer adds a JobStateReason object
- * to the Print Job's {@link JobStateReasons JobStateReasons} attribute when the
- * corresponding condition becomes true of the Print Job, and the printer
- * removes the JobStateReason object again when the corresponding condition
- * becomes false, regardless of whether the Print Job's overall {@link JobState
- * JobState} also changed.
- * <P>
- * <B>IPP Compatibility:</B> The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * <p>
+ * Instances of {@code JobStateReason} do not appear in a Print Job's attribute
+ * set directly. Rather, a {@link JobStateReasons JobStateReasons} attribute
+ * appears in the Print Job's attribute set. The
+ * {@link JobStateReasons JobStateReasons} attribute contains zero, one, or more
+ * than one {@code JobStateReason} objects which pertain to the Print Job's
+ * status. The printer adds a JobStateReason object to the Print Job's
+ * {@link JobStateReasons JobStateReasons} attribute when the corresponding
+ * condition becomes true of the Print Job, and the printer removes the
+ * {@code JobStateReason} object again when the corresponding condition becomes
+ * false, regardless of whether the Print Job's overall
+ * {@link JobState JobState} also changed.
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class JobStateReason extends EnumSyntax implements Attribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -8765894420449009168L;
 
     /**
@@ -67,27 +72,29 @@
 
     /**
      * The printer has created the Print Job, but the printer is expecting
-     * additional print data before it can move the job into the PROCESSING
-     * state. If a printer starts processing before it has received all data,
-     * the printer removes the JOB_DATA_INSUFFICIENT reason, but the
-     * JOB_INCOMING reason remains. If a printer starts processing after it
-     * has received all data, the printer removes the JOB_DATA_INSUFFICIENT
-     * and JOB_INCOMING reasons at the same time.
+     * additional print data before it can move the job into the
+     * {@code PROCESSING} state. If a printer starts processing before it has
+     * received all data, the printer removes the {@code JOB_DATA_INSUFFICIENT}
+     * reason, but the {@code JOB_INCOMING} reason remains. If a printer starts
+     * processing after it has received all data, the printer removes the
+     * {@code JOB_DATA_INSUFFICIENT} and {@code JOB_INCOMING} reasons at the
+     * same time.
      */
     public static final JobStateReason
         JOB_DATA_INSUFFICIENT = new JobStateReason(1);
 
     /**
-     * The Printer could not access one or more documents passed by reference
-     * (i.e., the print data representation object is a URL). This reason is
-     * intended to cover any file access problem,including file does not exist
-     * and access denied because of an access control problem. Whether the
-     * printer aborts the job and moves the job to the ABORTED job state or
-     * prints all documents that are accessible and moves the job to the
-     * COMPLETED job state and adds the COMPLETED_WITH_ERRORS reason to the
-     * job's {@link JobStateReasons JobStateReasons} attribute depends on
-     * implementation and/or site policy. This value should be supported if
-     * the printer supports doc flavors with URL print data representation
+     * The printer could not access one or more documents passed by reference
+     * (i.e., the print data representation object is a {@code URL}). This
+     * reason is intended to cover any file access problem,including file does
+     * not exist and access denied because of an access control problem. Whether
+     * the printer aborts the job and moves the job to the {@code ABORTED} job
+     * state or prints all documents that are accessible and moves the job to
+     * the {@code COMPLETED} job state and adds the
+     * {@code COMPLETED_WITH_ERRORS} reason to the job's
+     * {@link JobStateReasons JobStateReasons} attribute depends on
+     * implementation and/or site policy. This value should be supported if the
+     * printer supports doc flavors with {@code URL} print data representation
      * objects.
      */
     public static final JobStateReason
@@ -112,9 +119,8 @@
 
     /**
      * The value of the job's {@link JobHoldUntil JobHoldUntil} attribute was
-     * specified with a date-time that is still in the future. The job must
-     * not be a candidate for processing until this reason is removed and
-     * there are
+     * specified with a date-time that is still in the future. The job must not
+     * be a candidate for processing until this reason is removed and there are
      * no other reasons to hold the job. This value should be supported if the
      * {@link JobHoldUntil JobHoldUntil} job template attribute is supported.
      */
@@ -123,63 +129,64 @@
 
     /**
      * At least one of the resources needed by the job, such as media, fonts,
-     * resource objects, etc., is not ready on any of the physical printers
-     * for which the job is a candidate. This condition may be detected
-     * when the job is accepted, or subsequently while the job is pending
-     * or processing, depending on implementation.
-     * The job may remain in its current state or
-     * be moved to the PENDING_HELD state, depending on implementation and/or
-     * job scheduling policy.
+     * resource objects, etc., is not ready on any of the physical printers for
+     * which the job is a candidate. This condition may be detected when the job
+     * is accepted, or subsequently while the job is pending or processing,
+     * depending on implementation. The job may remain in its current state or
+     * be moved to the {@code PENDING_HELD} state, depending on implementation
+     * and/or job scheduling policy.
      */
     public static final JobStateReason
         RESOURCES_ARE_NOT_READY = new JobStateReason(6);
 
     /**
      * The value of the printer's {@link PrinterStateReasons
-     * PrinterStateReasons} attribute contains a {@link PrinterStateReason
-     * PrinterStateReason} value of STOPPED_PARTLY.
+     * PrinterStateReasons} attribute contains a
+     * {@link PrinterStateReason PrinterStateReason} value of
+     * {@code STOPPED_PARTLY}.
      */
     public static final JobStateReason
         PRINTER_STOPPED_PARTLY = new JobStateReason(7);
 
     /**
-     * The value of the printer's {@link PrinterState PrinterState} attribute
-     * ia STOPPED.
+     * The value of the printer's {@link PrinterState PrinterState} attribute ia
+     * {@code STOPPED}.
      */
     public static final JobStateReason
         PRINTER_STOPPED = new JobStateReason(8);
 
     /**
-     * The job is in the PROCESSING state, but more specifically, the printer
-     * ia interpreting the document data.
+     * The job is in the {@code PROCESSING} state, but more specifically, the
+     * printer ia interpreting the document data.
      */
     public static final JobStateReason
         JOB_INTERPRETING = new JobStateReason(9);
 
     /**
-     * The job is in the PROCESSING state, but more specifically, the printer
-     * has queued the document data.
+     * The job is in the {@code PROCESSING} state, but more specifically, the
+     * printer has queued the document data.
      */
     public static final JobStateReason JOB_QUEUED = new JobStateReason(10);
 
     /**
-     * The job is in the PROCESSING state, but more specifically, the printer
-     * is interpreting document data and producing another electronic
+     * The job is in the {@code PROCESSING} state, but more specifically, the
+     * printer is interpreting document data and producing another electronic
      * representation.
      */
     public static final JobStateReason
         JOB_TRANSFORMING = new JobStateReason(11);
 
     /**
-     * The job is in the PENDING_HELD, PENDING, or PROCESSING state, but more
-     * specifically, the printer has completed enough processing of the document
-     * to be able to start marking and the job is waiting for the marker.
-     * Systems that require human intervention to release jobs put the job into
-     * the PENDING_HELD job state. Systems that automatically select a job to
-     * use the marker put the job into the PENDING job state or keep the job
-     * in the PROCESSING job state while waiting for the marker, depending on
+     * The job is in the {@code PENDING_HELD}, {@code PENDING}, or
+     * {@code PROCESSING} state, but more specifically, the printer has
+     * completed enough processing of the document to be able to start marking
+     * and the job is waiting for the marker. Systems that require human
+     * intervention to release jobs put the job into the {@code PENDING_HELD}
+     * job state. Systems that automatically select a job to use the marker put
+     * the job into the {@code PENDING} job state or keep the job in the
+     * {@code PROCESSING} job state while waiting for the marker, depending on
      * implementation. All implementations put the job into (or back into) the
-     * PROCESSING state when marking does begin.
+     * {@code PROCESSING} state when marking does begin.
      */
     public static final JobStateReason
         JOB_QUEUED_FOR_MARKER = new JobStateReason(12);
@@ -189,8 +196,9 @@
      * which spend a great deal of time processing (1) when no marking is
      * happening and then want to show that marking is now happening or (2) when
      * the job is in the process of being canceled or aborted while the job
-     * remains in the PROCESSING state, but the marking has not yet stopped so
-     * that impression or sheet counts are still increasing for the job.
+     * remains in the {@code PROCESSING} state, but the marking has not yet
+     * stopped so that impression or sheet counts are still increasing for the
+     * job.
      */
     public static final JobStateReason
         JOB_PRINTING = new JobStateReason(13);
@@ -229,9 +237,9 @@
     /**
      * The job was aborted by the system. Either the job (1) is in the process
      * of being aborted, (2) has been aborted by the system and placed in the
-     * ABORTED state, or (3) has been aborted by the system and placed in the
-     * PENDING_HELD state, so that a user or operator can manually try the job
-     * again. This value should be supported.
+     * {@code ABORTED} state, or (3) has been aborted by the system and placed
+     * in the {@code PENDING_HELD} state, so that a user or operator can
+     * manually try the job again. This value should be supported.
      */
     public static final JobStateReason
         ABORTED_BY_SYSTEM = new JobStateReason(17);
@@ -250,7 +258,7 @@
      * The job was aborted by the system because the printer encountered an
      * error in the document data while decompressing it. If the printer posts
      * this reason, the document data has already passed any tests that would
-     * have led to the UNSUPPORTED_COMPRESSION job state reason.
+     * have led to the {@code UNSUPPORTED_COMPRESSION} job state reason.
      */
     public static final JobStateReason
         COMPRESSION_ERROR = new JobStateReason(19);
@@ -259,8 +267,8 @@
      * The job was aborted by the system because the document data's document
      * format (doc flavor) is not among those supported by the printer. If the
      * client specifies a doc flavor with a MIME type of
-     * {@code "application/octet-stream"}, the printer may abort the job if
-     * the printer cannot determine the document data's actual format through
+     * {@code "application/octet-stream"}, the printer may abort the job if the
+     * printer cannot determine the document data's actual format through
      * auto-sensing (even if the printer supports the document format if
      * specified explicitly). This value must be supported, since a doc flavor
      * is required to be specified for each doc.
@@ -272,7 +280,7 @@
      * The job was aborted by the system because the printer encountered an
      * error in the document data while processing it. If the printer posts this
      * reason, the document data has already passed any tests that would have
-     * led to the UNSUPPORTED_DOCUMENT_FORMAT job state reason.
+     * led to the {@code UNSUPPORTED_DOCUMENT_FORMAT} job state reason.
      */
     public static final JobStateReason
         DOCUMENT_FORMAT_ERROR = new JobStateReason(21);
@@ -281,22 +289,23 @@
      * The requester has canceled the job or the printer has aborted the job,
      * but the printer is still performing some actions on the job until a
      * specified stop point occurs or job termination/cleanup is completed.
-     * <P>
+     * <p>
      * If the implementation requires some measurable time to cancel the job in
-     * the PROCESSING or PROCESSING_STOPPED job states, the printer must use
-     * this reason to indicate that the printer is still performing some actions
-     * on the job while the job remains in the PROCESSING or PROCESSING_STOPPED
-     * state. After all the job's job description attributes have stopped
-     * incrementing, the printer moves the job from the PROCESSING state to the
-     * CANCELED or ABORTED job states.
+     * the {@code PROCESSING} or {@code PROCESSING_STOPPED} job states, the
+     * printer must use this reason to indicate that the printer is still
+     * performing some actions on the job while the job remains in the
+     * {@code PROCESSING} or {@code PROCESSING_STOPPED} state. After all the
+     * job's job description attributes have stopped incrementing, the printer
+     * moves the job from the PROCESSING state to the {@code CANCELED} or
+     * {@code ABORTED} job states.
      */
     public static final JobStateReason
         PROCESSING_TO_STOP_POINT = new JobStateReason(22);
 
     /**
-     * The printer is off-line and accepting no jobs. All PENDING jobs are put
-     * into the PENDING_HELD state. This situation could be true if the
-     * service's or document transform's input is impaired or broken.
+     * The printer is off-line and accepting no jobs. All {@code PENDING} jobs
+     * are put into the {@code PENDING_HELD} state. This situation could be true
+     * if the service's or document transform's input is impaired or broken.
      */
     public static final JobStateReason
         SERVICE_OFF_LINE = new JobStateReason(23);
@@ -323,11 +332,11 @@
 
     /**
      * This job is retained and is currently able to be restarted. If
-     * JOB_RESTARTABLE is contained in the job's {@link JobStateReasons
-     * JobStateReasons} attribute, then the printer must accept a request to
-     * restart that job. This value should be supported if restarting jobs is
-     * supported. <I>[The capability for restarting jobs is not in the Java
-     * Print Service API at present.]</I>
+     * {@code JOB_RESTARTABLE} is contained in the job's
+     * {@link JobStateReasons JobStateReasons} attribute, then the printer must
+     * accept a request to restart that job. This value should be supported if
+     * restarting jobs is supported. <i>[The capability for restarting jobs is
+     * not in the Java Print Service API at present.]</i>
      */
     public static final JobStateReason
         JOB_RESTARTABLE = new JobStateReason(27);
@@ -335,24 +344,27 @@
     /**
      * The job has been forwarded to a device or print system that is unable to
      * send back status. The printer sets the job's {@link JobState JobState}
-     * attribute to COMPLETED and adds the QUEUED_IN_DEVICE reason to the job's
-     * {@link JobStateReasons JobStateReasons} attribute to indicate that the
-     * printer has no additional information about the job and never will have
-     * any better information.
+     * attribute to {@code COMPLETED} and adds the {@code QUEUED_IN_DEVICE}
+     * reason to the job's {@link JobStateReasons JobStateReasons} attribute to
+     * indicate that the printer has no additional information about the job and
+     * never will have any better information.
      */
     public static final JobStateReason
         QUEUED_IN_DEVICE = new JobStateReason(28);
 
     /**
-     * Construct a new job state reason enumeration value with the given
-     * integer  value.
+     * Construct a new job state reason enumeration value with the given integer
+     * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected JobStateReason(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code JobStateReason}.
+     */
     private static final String[] myStringTable = {
         "job-incoming",
         "job-data-insufficient",
@@ -384,6 +396,9 @@
         "job-restartable",
         "queued-in-device"};
 
+    /**
+     * The enumeration value table for class {@code JobStateReason}.
+     */
     private static final JobStateReason[] myEnumValueTable = {
         JOB_INCOMING,
         JOB_DATA_INSUFFICIENT,
@@ -416,29 +431,28 @@
         QUEUED_IN_DEVICE};
 
     /**
-     * Returns the string table for class JobStateReason.
+     * Returns the string table for class {@code JobStateReason}.
      */
     protected String[] getStringTable() {
         return myStringTable.clone();
     }
 
     /**
-     * Returns the enumeration value table for class JobStateReason.
+     * Returns the enumeration value table for class {@code JobStateReason}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
     }
 
-
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobStateReason and any vendor-defined subclasses, the
-     * category  is class JobStateReason itself.
+     * <p>
+     * For class {@code JobStateReason} and any vendor-defined subclasses, the
+     * category is class {@code JobStateReason} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobStateReason.class;
@@ -447,14 +461,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobStateReason and any vendor-defined subclasses, the
+     * <p>
+     * For class {@code JobStateReason} and any vendor-defined subclasses, the
      * category name is {@code "job-state-reason"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-state-reason";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReasons.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReasons.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Collection;
@@ -31,43 +32,47 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class JobStateReasons is a printing attribute class, a set of enumeration
- * values, that provides additional information about the job's current state,
- * i.e., information that augments the value of the job's {@link JobState
- * JobState} attribute.
- * <P>
+ * Class {@code JobStateReasons} is a printing attribute class, a set of
+ * enumeration values, that provides additional information about the job's
+ * current state, i.e., information that augments the value of the job's
+ * {@link JobState JobState} attribute.
+ * <p>
  * Instances of {@link JobStateReason JobStateReason} do not appear in a Print
- * Job's attribute set directly. Rather, a JobStateReasons attribute appears in
- * the Print Job's attribute set. The JobStateReasons attribute contains zero,
- * one, or more than one {@link JobStateReason JobStateReason} objects which
- * pertain to the Print Job's status. The printer adds a {@link JobStateReason
- * JobStateReason} object to the Print Job's JobStateReasons attribute when the
- * corresponding condition becomes true of the Print Job, and the printer
- * removes the {@link JobStateReason JobStateReason} object again when the
- * corresponding condition becomes false, regardless of whether the Print Job's
- * overall {@link JobState JobState} also changed.
- * <P>
- * Class JobStateReasons inherits its implementation from class {@link
- * java.util.HashSet java.util.HashSet}. Unlike most printing attributes which
- * are immutable once constructed, class JobStateReasons is designed to be
- * mutable; you can add {@link JobStateReason JobStateReason} objects to an
- * existing JobStateReasons object and remove them again. However, like class
- * {@link java.util.HashSet java.util.HashSet}, class JobStateReasons is not
- * multiple thread safe. If a JobStateReasons object will be used by multiple
- * threads, be sure to synchronize its operations (e.g., using a synchronized
- * set view obtained from class {@link java.util.Collections
- * java.util.Collections}).
- * <P>
- * <B>IPP Compatibility:</B> The string value returned by each individual {@link
- * JobStateReason JobStateReason} object's {@code toString()} method gives
- * the IPP keyword value. The category name returned by {@code getName()}
+ * Job's attribute set directly. Rather, a {@code JobStateReasons} attribute
+ * appears in the Print Job's attribute set. The {@code JobStateReasons}
+ * attribute contains zero, one, or more than one
+ * {@link JobStateReason JobStateReason} objects which pertain to the Print
+ * Job's status. The printer adds a {@link JobStateReason JobStateReason} object
+ * to the Print Job's JobStateReasons attribute when the corresponding condition
+ * becomes true of the Print Job, and the printer removes the
+ * {@link JobStateReason JobStateReason} object again when the corresponding
+ * condition becomes false, regardless of whether the Print Job's overall
+ * {@link JobState JobState} also changed.
+ * <p>
+ * Class {@code JobStateReasons} inherits its implementation from class
+ * {@link HashSet java.util.HashSet}. Unlike most printing attributes
+ * which are immutable once constructed, class {@code JobStateReasons} is
+ * designed to be mutable; you can add {@link JobStateReason JobStateReason}
+ * objects to an existing {@code JobStateReasons} object and remove them again.
+ * However, like class {@link HashSet java.util.HashSet}, class
+ * {@code JobStateReasons} is not multiple thread safe. If a
+ * {@code JobStateReasons} object will be used by multiple threads, be sure to
+ * synchronize its operations (e.g., using a synchronized set view obtained
+ * from class {@link java.util.Collections java.util.Collections}).
+ * <p>
+ * <b>IPP Compatibility:</b> The string value returned by each individual
+ * {@link JobStateReason JobStateReason} object's {@code toString()} method
+ * gives the IPP keyword value. The category name returned by {@code getName()}
  * gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class JobStateReasons
     extends HashSet<JobStateReason> implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 8849088261264331812L;
 
     /**
@@ -82,9 +87,8 @@
      * Construct a new, empty job state reasons attribute; the underlying hash
      * set has the given initial capacity and the default load factor.
      *
-     * @param  initialCapacity  Initial capacity.
-     * @throws IllegalArgumentException if the initial capacity is less
-     *     than zero.
+     * @param  initialCapacity initial capacity
+     * @throws IllegalArgumentException if the initial capacity is negative
      */
     public JobStateReasons(int initialCapacity) {
         super (initialCapacity);
@@ -94,10 +98,9 @@
      * Construct a new, empty job state reasons attribute; the underlying hash
      * set has the given initial capacity and load factor.
      *
-     * @param  initialCapacity  Initial capacity.
-     * @param  loadFactor       Load factor.
-     * @throws IllegalArgumentException if the initial capacity is less
-     *     than zero.
+     * @param  initialCapacity initial capacity
+     * @param  loadFactor load factor
+     * @throws IllegalArgumentException if the initial capacity is negative
      */
     public JobStateReasons(int initialCapacity, float loadFactor) {
         super (initialCapacity, loadFactor);
@@ -107,23 +110,18 @@
      * Construct a new job state reasons attribute that contains the same
      * {@link JobStateReason JobStateReason} objects as the given collection.
      * The underlying hash set's initial capacity and load factor are as
-     * specified in the superclass constructor {@link
-     * java.util.HashSet#HashSet(java.util.Collection)
-     * HashSet(Collection)}.
-     *
-     * @param  collection  Collection to copy.
+     * specified in the superclass constructor
+     * {@link HashSet#HashSet(Collection) HashSet(Collection)}.
      *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code collection} is null or
-     *     if any element in {@code collection} is null.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if any element in
-     *     {@code collection} is not an instance of class {@link
-     *     JobStateReason JobStateReason}.
+     * @param  collection collection to copy
+     * @throws NullPointerException if {@code collection} is {@code null} or if
+     *         any element in {@code collection} is {@code null}
+     * @throws ClassCastException if any element in {@code collection} is not an
+     *         instance of class {@link JobStateReason JobStateReason}
      */
-   public JobStateReasons(Collection<JobStateReason> collection) {
-       super (collection);
-   }
+    public JobStateReasons(Collection<JobStateReason> collection) {
+        super (collection);
+    }
 
     /**
      * Adds the specified element to this job state reasons attribute if it is
@@ -132,16 +130,12 @@
      * attribute already contains the specified element, the call leaves this
      * job state reasons attribute unchanged and returns {@code false}.
      *
-     * @param  o  Element to be added to this job state reasons attribute.
-     *
-     * @return  {@code true} if this job state reasons attribute did not
-     *          already contain the specified element.
-     *
-     * @throws  NullPointerException
-     *     (unchecked exception) Thrown if the specified element is null.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if the specified element is not an
-     *     instance of class {@link JobStateReason JobStateReason}.
+     * @param  o element to be added to this job state reasons attribute
+     * @return {@code true} if this job state reasons attribute did not already
+     *         contain the specified element
+     * @throws NullPointerException if the specified element is {@code null}
+     * @throws ClassCastException if the specified element is not an instance of
+     *         class {@link JobStateReason JobStateReason}
      * @since 1.5
      */
     public boolean add(JobStateReason o) {
@@ -154,11 +148,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class JobStateReasons, the category is class JobStateReasons itself.
+     * <p>
+     * For class {@code JobStateReasons}, the category is class
+     * JobStateReasons itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return JobStateReasons.class;
@@ -167,14 +162,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class JobStateReasons, the category
-     * name is {@code "job-state-reasons"}.
+     * <p>
+     * For class JobStateReasons, the category name is
+     * {@code "job-state-reasons"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "job-state-reasons";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Media.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Media.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,48 +22,51 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
 import javax.print.attribute.DocAttribute;
 import javax.print.attribute.EnumSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class Media is a printing attribute class that specifies the
- * medium on which to print.
+ * Class {@code Media} is a printing attribute class that specifies the medium
+ * on which to print.
  * <p>
  * Media may be specified in different ways.
  * <ul>
- * <li> it may be specified by paper source - eg paper tray
- * <li> it may be specified by a standard size - eg "A4"
- * <li> it may be specified by a name - eg "letterhead"
+ *   <li>it may be specified by paper source - eg paper tray
+ *   <li>it may be specified by a standard size - eg "A4"
+ *   <li>it may be specified by a name - eg "letterhead"
  * </ul>
- * Each of these corresponds to the IPP "media" attribute.
- * The current API does not support describing media by characteristics
- * (eg colour, opacity).
- * This may be supported in a later revision of the specification.
+ * Each of these corresponds to the IPP "media" attribute. The current API does
+ * not support describing media by characteristics (eg colour, opacity). This
+ * may be supported in a later revision of the specification.
  * <p>
- * A Media object is constructed with a value which represents
- * one of the ways in which the Media attribute can be specified.
+ * A {@code Media} object is constructed with a value which represents one of
+ * the ways in which the Media attribute can be specified.
  * <p>
- * <B>IPP Compatibility:</B>  The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
  * @author Phil Race
  */
 public abstract class Media extends EnumSyntax
     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -2823970704630722439L;
 
     /**
      * Constructs a new media attribute specified by name.
      *
-     * @param value         a value
+     * @param  value a value
      */
     protected Media(int value) {
            super (value);
@@ -72,19 +75,16 @@
     /**
      * Returns whether this media attribute is equivalent to the passed in
      * object. To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is of the same subclass of Media as this object.
-     * <LI>
-     * The values are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is of the same subclass of {@code Media} as this
+     *   object.
+     *   <li>The values are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this media
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this media
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return(object != null && object instanceof Media &&
@@ -95,12 +95,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class Media and any vendor-defined subclasses, the category is
-     * class Media itself.
+     * <p>
+     * For class {@code Media} and any vendor-defined subclasses, the category
+     * is class {@code Media} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return Media.class;
@@ -109,14 +109,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class Media and any vendor-defined subclasses, the category name is
-     * {@code "media"}.
+     * <p>
+     * For class {@code Media} and any vendor-defined subclasses, the category
+     * name is {@code "media"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "media";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaName.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaName.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,37 +22,40 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
-import java.util.Locale;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
 
 /**
- * Class MediaName is a subclass of Media, a printing attribute class (an
- * enumeration) that specifies the media for a print job as a name.
- * <P>
- * This attribute can be used instead of specifying MediaSize or MediaTray.
+ * Class {@code MediaName} is a subclass of {@code Media}, a printing attribute
+ * class (an enumeration) that specifies the media for a print job as a name.
+ * <p>
+ * This attribute can be used instead of specifying {@code MediaSize} or
+ * {@code MediaTray}.
  * <p>
- * Class MediaName currently declares a few standard media names.
- * Implementation- or site-defined names for a media name attribute may also
- * be created by defining a subclass of class MediaName.
- * <P>
- * <B>IPP Compatibility:</B> MediaName is a representation class for
+ * Class {@code MediaName} currently declares a few standard media names.
+ * Implementation- or site-defined names for a media name attribute may also be
+ * created by defining a subclass of class {@code MediaName}.
+ * <p>
+ * <b>IPP Compatibility:</b> {@code MediaName} is a representation class for
  * values of the IPP "media" attribute which names media.
- *
  */
 public class MediaName extends Media implements Attribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 4653117714524155448L;
 
     /**
-     *  white letter paper.
+     * white letter paper.
      */
     public static final MediaName NA_LETTER_WHITE = new MediaName(0);
 
     /**
-     *  letter transparency.
+     * letter transparency.
      */
     public static final MediaName NA_LETTER_TRANSPARENT = new MediaName(1);
 
@@ -61,23 +64,24 @@
      */
     public static final MediaName ISO_A4_WHITE = new MediaName(2);
 
-
     /**
-     *  A4 transparency.
+     * A4 transparency.
      */
     public static final MediaName ISO_A4_TRANSPARENT= new MediaName(3);
 
-
     /**
      * Constructs a new media name enumeration value with the given integer
      * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected MediaName(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code MediaTray}.
+     */
     private static final String[] myStringTable = {
         "na-letter-white",
         "na-letter-transparent",
@@ -85,6 +89,9 @@
         "iso-a4-transparent"
     };
 
+    /**
+     * The enumeration value table for class {@code MediaTray}.
+     */
     private static final MediaName[] myEnumValueTable = {
         NA_LETTER_WHITE,
         NA_LETTER_TRANSPARENT,
@@ -93,8 +100,9 @@
     };
 
     /**
-     * Returns the string table for class MediaTray.
-     * @return the String table.
+     * Returns the string table for class {@code MediaTray}.
+     *
+     * @return the string table
      */
     protected String[] getStringTable()
     {
@@ -102,11 +110,11 @@
     }
 
     /**
-     * Returns the enumeration value table for class MediaTray.
-     * @return the enumeration value table.
+     * Returns the enumeration value table for class {@code MediaTray}.
+     *
+     * @return the enumeration value table
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaPrintableArea.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaPrintableArea.java	Sat Sep 09 14:36:45 2017 +0200
@@ -22,9 +22,11 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.DocFlavor;
+import javax.print.PrintService;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.AttributeSet;
 import javax.print.attribute.DocAttribute;
@@ -32,60 +34,67 @@
 import javax.print.attribute.PrintRequestAttribute;
 
 /**
- * Class MediaPrintableArea is a printing attribute used to distinguish
+ * Class {@code MediaPrintableArea} is a printing attribute used to distinguish
  * the printable and non-printable areas of media.
  * <p>
  * The printable area is specified to be a rectangle, within the overall
  * dimensions of a media.
  * <p>
- * Most printers cannot print on the entire surface of the media, due
- * to printer hardware limitations. This class can be used to query
- * the acceptable values for a supposed print job, and to request an area
- * within the constraints of the printable area to be used in a print job.
+ * Most printers cannot print on the entire surface of the media, due to printer
+ * hardware limitations. This class can be used to query the acceptable values
+ * for a supposed print job, and to request an area within the constraints of
+ * the printable area to be used in a print job.
  * <p>
  * To query for the printable area, a client must supply a suitable context.
- * Without specifying at the very least the size of the media being used
- * no meaningful value for printable area can be obtained.
+ * Without specifying at the very least the size of the media being used no
+ * meaningful value for printable area can be obtained.
  * <p>
- * The attribute is not described in terms of the distance from the edge
- * of the paper, in part to emphasise that this attribute is not independent
- * of a particular media, but must be described within the context of a
- * choice of other attributes. Additionally it is usually more convenient
- * for a client to use the printable area.
+ * The attribute is not described in terms of the distance from the edge of the
+ * paper, in part to emphasise that this attribute is not independent of a
+ * particular media, but must be described within the context of a choice of
+ * other attributes. Additionally it is usually more convenient for a client to
+ * use the printable area.
  * <p>
- * The hardware's minimum margins is not just a property of the printer,
- * but may be a function of the media size, orientation, media type, and
- * any specified finishings.
- * {@code PrintService} provides the method to query the supported
- * values of an attribute in a suitable context :
- * See  {@link javax.print.PrintService#getSupportedAttributeValues(Class,DocFlavor, AttributeSet) PrintService.getSupportedAttributeValues()}
+ * The hardware's minimum margins is not just a property of the printer, but may
+ * be a function of the media size, orientation, media type, and any specified
+ * finishings. {@code PrintService} provides the method to query the supported
+ * values of an attribute in a suitable context : See
+ * {@link PrintService#getSupportedAttributeValues(Class, DocFlavor, AttributeSet)
+ * PrintService.getSupportedAttributeValues()}
  * <p>
- * The rectangular printable area is defined thus:
- * The (x,y) origin is positioned at the top-left of the paper in portrait
- * mode regardless of the orientation specified in the requesting context.
- * For example a printable area for A4 paper in portrait or landscape
- * orientation will have height {@literal >} width.
+ * The rectangular printable area is defined thus: The (x,y) origin is
+ * positioned at the top-left of the paper in portrait mode regardless of the
+ * orientation specified in the requesting context. For example a printable area
+ * for A4 paper in portrait or landscape orientation will have height
+ * {@literal >} width.
  * <p>
- * A printable area attribute's values are stored
- * internally as integers in units of micrometers (&#181;m), where 1 micrometer
- * = 10<SUP>-6</SUP> meter = 1/1000 millimeter = 1/25400 inch. This permits
- * dimensions to be represented exactly to a precision of 1/1000 mm (= 1
- * &#181;m) or 1/100 inch (= 254 &#181;m). If fractional inches are expressed in
-
- * negative powers of two, this permits dimensions to be represented exactly to
- * a precision of 1/8 inch (= 3175 &#181;m) but not 1/16 inch (because 1/16 inch
-
- * does not equal an integral number of &#181;m).
+ * A printable area attribute's values are stored internally as integers in
+ * units of micrometers (&#181;m), where 1 micrometer = 10<SUP>-6</SUP> meter =
+ * 1/1000 millimeter = 1/25400 inch. This permits dimensions to be represented
+ * exactly to a precision of 1/1000 mm (= 1 &#181;m) or 1/100 inch (= 254
+ * &#181;m). If fractional inches are expressed in negative powers of two, this
+ * permits dimensions to be represented exactly to a precision of 1/8 inch
+ * (= 3175 &#181;m) but not 1/16 inch (because 1/16 inch does not equal an
+ * integral number of &#181;m).
  * <p>
- * <B>IPP Compatibility:</B> MediaPrintableArea is not an IPP attribute.
+ * <b>IPP Compatibility:</b> MediaPrintableArea is not an IPP attribute.
  */
-
 public final class MediaPrintableArea
       implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Printable {@code x}, {@code y}, {@code width} and {@code height}.
+     */
     private int x, y, w, h;
+
+    /**
+     * The units in which the values are expressed.
+     */
     private int units;
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -1597171464050795793L;
 
     /**
@@ -101,18 +110,17 @@
     public static final int MM = 1000;
 
     /**
-      * Constructs a MediaPrintableArea object from floating point values.
-      * @param x      printable x
-      * @param y      printable y
-      * @param w      printable width
-      * @param h      printable height
-      * @param units  in which the values are expressed.
-      *
-      * @exception  IllegalArgumentException
-      *     Thrown if {@code x < 0} or {@code y < 0}
-      *     or {@code w <= 0} or {@code h <= 0} or
-      *     {@code units < 1}.
-      */
+     * Constructs a {@code MediaPrintableArea} object from floating point
+     * values.
+     *
+     * @param  x printable x
+     * @param  y printable y
+     * @param  w printable width
+     * @param  h printable height
+     * @param  units in which the values are expressed
+     * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or
+     *         {@code w <= 0} or {@code h <= 0} or {@code units < 1}
+     */
     public MediaPrintableArea(float x, float y, float w, float h, int units) {
         if ((x < 0.0) || (y < 0.0) || (w <= 0.0) || (h <= 0.0) ||
             (units < 1)) {
@@ -127,18 +135,16 @@
     }
 
     /**
-      * Constructs a MediaPrintableArea object from integer values.
-      * @param x      printable x
-      * @param y      printable y
-      * @param w      printable width
-      * @param h      printable height
-      * @param units  in which the values are expressed.
-      *
-      * @exception  IllegalArgumentException
-      *     Thrown if {@code x < 0} or {@code y < 0}
-      *     or {@code w <= 0} or {@code h <= 0} or
-      *     {@code units < 1}.
-      */
+     * Constructs a {@code MediaPrintableArea} object from integer values.
+     *
+     * @param  x printable x
+     * @param  y printable y
+     * @param  w printable width
+     * @param  h printable height
+     * @param  units in which the values are expressed
+     * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or
+     *         {@code w <= 0} or {@code h <= 0} or {@code units < 1}
+     */
     public MediaPrintableArea(int x, int y, int w, int h, int units) {
         if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) ||
             (units < 1)) {
@@ -153,15 +159,13 @@
 
     /**
      * Get the printable area as an array of 4 values in the order
-     * x, y, w, h. The values returned are in the given units.
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or
-     *     {@link #MM MM}.
+     * {@code x, y, w, h}. The values returned are in the given units.
      *
-     * @return printable area as array of x, y, w, h in the specified units.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @return printable area as array of {@code x, y, w, h} in the specified
+     *         units
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public float[] getPrintableArea(int units) {
         return new float[] { getX(units), getY(units),
@@ -169,86 +173,70 @@
     }
 
     /**
-     * Get the x location of the origin of the printable area in the
-     * specified units.
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or
-     *     {@link #MM MM}.
-     *
-     * @return  x location of the origin of the printable area in the
+     * Get the {@code x} location of the origin of the printable area in the
      * specified units.
      *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @return {@code x} location of the origin of the printable area in the
+     *         specified units
+     * @throws IllegalArgumentException if {@code units < 1}
      */
-     public float getX(int units) {
+    public float getX(int units) {
         return convertFromMicrometers(x, units);
-     }
+    }
 
     /**
-     * Get the y location of the origin of the printable area in the
-     * specified units.
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or
-     *     {@link #MM MM}.
-     *
-     * @return  y location of the origin of the printable area in the
+     * Get the {@code y} location of the origin of the printable area in the
      * specified units.
      *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @return {@code y} location of the origin of the printable area in the
+     *         specified units
+     * @throws IllegalArgumentException if {@code units < 1}
      */
-     public float getY(int units) {
+    public float getY(int units) {
         return convertFromMicrometers(y, units);
-     }
+    }
 
     /**
-     * Get the width of the printable area in the specified units.
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or
-     *     {@link #MM MM}.
-     *
-     * @return  width of the printable area in the specified units.
+     * Get the {@code width} of the printable area in the specified units.
      *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @return {@code width} of the printable area in the specified units
+     * @throws IllegalArgumentException if {@code units < 1}
      */
-     public float getWidth(int units) {
+    public float getWidth(int units) {
         return convertFromMicrometers(w, units);
-     }
+    }
 
     /**
-     * Get the height of the printable area in the specified units.
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or
-     *     {@link #MM MM}.
-     *
-     * @return  height of the printable area in the specified units.
+     * Get the {@code height} of the printable area in the specified units.
      *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *        {@link #MM MM}
+     * @return {@code height} of the printable area in the specified units
+     * @throws IllegalArgumentException if {@code units < 1}
      */
-     public float getHeight(int units) {
+    public float getHeight(int units) {
         return convertFromMicrometers(h, units);
-     }
+    }
 
     /**
      * Returns whether this media margins attribute is equivalent to the passed
-     * in object.
-     * To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class MediaPrintableArea.
-     * <LI>
-     * The origin and dimensions are the same.
-     * </OL>
+     * in object. To be equivalent, all of the following conditions must be
+     * true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code MediaPrintableArea}.
+     *   <li>The origin and dimensions are the same.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this media margins
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this media
+     *         margins attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         boolean ret = false;
@@ -264,12 +252,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class MediaPrintableArea, the category is
-     * class MediaPrintableArea itself.
+     * <p>
+     * For class {@code MediaPrintableArea}, the category is class
+     * {@code MediaPrintableArea} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return MediaPrintableArea.class;
@@ -278,32 +266,28 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class MediaPrintableArea,
-     * the category name is {@code "media-printable-area"}.
-     * <p>This is not an IPP V1.1 attribute.
+     * <p>
+     * For class {@code MediaPrintableArea}, the category name is
+     * {@code "media-printable-area"}.
+     * <p>
+     * This is not an IPP V1.1 attribute.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "media-printable-area";
     }
 
     /**
-     * Returns a string version of this rectangular size attribute in the
-     * given units.
+     * Returns a string version of this rectangular size attribute in the given
+     * units.
      *
-     * @param  units
-     *     Unit conversion factor, e.g. {@link #INCH INCH} or
-     *     {@link #MM MM}.
-     * @param  unitsName
-     *     Units name string, e.g. {@code "in"} or {@code "mm"}. If
-     *     null, no units name is appended to the result.
-     *
-     * @return  String version of this two-dimensional size attribute.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code units < 1}.
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *         {@link #MM MM}
+     * @param  unitsName units name string, e.g. {@code "in"} or {@code "mm"}.
+     *         If {@code null}, no units name is appended to the result
+     * @return string version of this two-dimensional size attribute
+     * @throws IllegalArgumentException if {@code units < 1}
      */
     public String toString(int units, String unitsName) {
         if (unitsName == null) {
@@ -328,6 +312,14 @@
         return x + 37*y + 43*w + 47*h;
     }
 
+    /**
+     * Converts the {@code x} from micrometers to {@code units}.
+     *
+     * @param  x the value
+     * @param  units unit conversion factor, e.g. {@link #INCH INCH} or
+     *        {@link #MM MM}
+     * @return the value of {@code x} in the specified units
+     */
     private static float convertFromMicrometers(int x, int units) {
         if (units < 1) {
             throw new IllegalArgumentException("units is < 1");
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSize.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSize.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,37 +22,44 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.HashMap;
 import java.util.Vector;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.Size2DSyntax;
-import javax.print.attribute.Attribute;
 
 /**
- * Class MediaSize is a two-dimensional size valued printing attribute class
- * that indicates the dimensions of the medium in a portrait orientation, with
- * the X dimension running along the bottom edge and the Y dimension running
- * along the left edge. Thus, the Y dimension must be greater than or equal to
- * the X dimension. Class MediaSize declares many standard media size
- * values, organized into nested classes for ISO, JIS, North American,
- * engineering, and other media.
- * <P>
- * MediaSize is not yet used to specify media. Its current role is
- * as a mapping for named media (see {@link MediaSizeName MediaSizeName}).
- * Clients can use the mapping method
- * {@code MediaSize.getMediaSizeForName(MediaSizeName)}
- * to find the physical dimensions of the MediaSizeName instances
- * enumerated in this API. This is useful for clients which need this
- * information to format {@literal &} paginate printing.
+ * Class {@code MediaSize} is a two-dimensional size valued printing attribute
+ * class that indicates the dimensions of the medium in a portrait orientation,
+ * with the {@code X} dimension running along the bottom edge and the {@code Y}
+ * dimension running along the left edge. Thus, the {@code Y} dimension must be
+ * greater than or equal to the {@code X} dimension. Class {@code MediaSize}
+ * declares many standard media size values, organized into nested classes for
+ * ISO, JIS, North American, engineering, and other media.
+ * <p>
+ * {@code MediaSize} is not yet used to specify media. Its current role is as a
+ * mapping for named media (see {@link MediaSizeName MediaSizeName}). Clients
+ * can use the mapping method
+ * {@code MediaSize.getMediaSizeForName(MediaSizeName)} to find the physical
+ * dimensions of the {@code MediaSizeName} instances enumerated in this API.
+ * This is useful for clients which need this information to format {@literal &}
+ * paginate printing.
  *
- * @author  Phil Race, Alan Kaminsky
+ * @author Phil Race, Alan Kaminsky
  */
 public class MediaSize extends Size2DSyntax implements Attribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -1967958664615414771L;
 
+    /**
+     * The media name.
+     */
     private MediaSizeName mediaName;
 
     private static HashMap<MediaSizeName, MediaSize> mediaMap = new HashMap<>(100, 10);
@@ -63,15 +70,12 @@
      * Construct a new media size attribute from the given floating-point
      * values.
      *
-     * @param  x  X dimension.
-     * @param  y  Y dimension.
-     * @param  units
-     *     Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
-     *     {@code Size2DSyntax.MM}.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or
-     *   {@code units < 1} or {@code x > y}.
+     * @param  x {@code X} dimension
+     * @param  y {@code Y} dimension
+     * @param  units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
+     *         {@code Size2DSyntax.MM}
+     * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or
+     *         {@code units < 1} or {@code x > y}
      */
     public MediaSize(float x, float y,int units) {
         super (x, y, units);
@@ -84,15 +88,12 @@
     /**
      * Construct a new media size attribute from the given integer values.
      *
-     * @param  x  X dimension.
-     * @param  y  Y dimension.
-     * @param  units
-     *     Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
-     *     {@code Size2DSyntax.MM}.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or
-     *   {@code units < 1} or {@code x > y}.
+     * @param  x {@code X} dimension
+     * @param  y {@code Y} dimension
+     * @param  units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
+     *         {@code Size2DSyntax.MM}
+     * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or
+     *         {@code units < 1} or {@code x > y}
      */
     public MediaSize(int x, int y,int units) {
         super (x, y, units);
@@ -102,20 +103,17 @@
         sizeVector.add(this);
     }
 
-   /**
+    /**
      * Construct a new media size attribute from the given floating-point
      * values.
      *
-     * @param  x  X dimension.
-     * @param  y  Y dimension.
-     * @param  units
-     *     Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
-     *     {@code Size2DSyntax.MM}.
-     * @param media a media name to associate with this MediaSize
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or
-     *   {@code units < 1} or {@code x > y}.
+     * @param  x {@code X} dimension
+     * @param  y {@code Y} dimension
+     * @param  units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
+     *         {@code Size2DSyntax.MM}
+     * @param  media a media name to associate with this {@code MediaSize}
+     * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or
+     *         {@code units < 1} or {@code x > y}
      */
     public MediaSize(float x, float y,int units, MediaSizeName media) {
         super (x, y, units);
@@ -132,16 +130,13 @@
     /**
      * Construct a new media size attribute from the given integer values.
      *
-     * @param  x  X dimension.
-     * @param  y  Y dimension.
-     * @param  units
-     *     Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
-     *     {@code Size2DSyntax.MM}.
-     * @param media a media name to associate with this MediaSize
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or
-     *   {@code units < 1} or {@code x > y}.
+     * @param  x {@code X} dimension
+     * @param  y {@code Y} dimension
+     * @param  units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
+     *         {@code Size2DSyntax.MM}
+     * @param  media a media name to associate with this {@code MediaSize}
+     * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or
+     *         {@code units < 1} or {@code x > y}
      */
     public MediaSize(int x, int y,int units, MediaSizeName media) {
         super (x, y, units);
@@ -158,44 +153,43 @@
     /**
      * Get the media name, if any, for this size.
      *
-     * @return the name for this media size, or null if no name was
-     * associated with this size (an anonymous size).
+     * @return the name for this media size, or {@code null} if no name was
+     *         associated with this size (an anonymous size)
      */
     public MediaSizeName getMediaSizeName() {
         return mediaName;
     }
 
     /**
-     * Get the MediaSize for the specified named media.
+     * Get the {@code MediaSize} for the specified named media.
      *
-     * @param media the name of the media for which the size is sought
-     * @return size of the media, or null if this media is not associated
-     * with any size.
+     * @param  media the name of the media for which the size is sought
+     * @return size of the media, or {@code null} if this media is not
+     *         associated with any size
      */
     public static MediaSize getMediaSizeForName(MediaSizeName media) {
         return mediaMap.get(media);
     }
 
     /**
-     * The specified dimensions are used to locate a matching MediaSize
-     * instance from amongst all the standard MediaSize instances.
-     * If there is no exact match, the closest match is used.
+     * The specified dimensions are used to locate a matching {@code MediaSize}
+     * instance from amongst all the standard {@code MediaSize} instances. If
+     * there is no exact match, the closest match is used.
      * <p>
-     * The MediaSize is in turn used to locate the MediaSizeName object.
-     * This method may return null if the closest matching MediaSize
-     * has no corresponding Media instance.
+     * The {@code MediaSize} is in turn used to locate the {@code MediaSizeName}
+     * object. This method may return {@code null} if the closest matching
+     * {@code MediaSize} has no corresponding {@code Media} instance.
      * <p>
-     * This method is useful for clients which have only dimensions and
-     * want to find a Media which corresponds to the dimensions.
-     * @param x X dimension
-     * @param y Y dimension.
-     * @param  units
-     *     Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
-     *     {@code Size2DSyntax.MM}
-     * @return MediaSizeName matching these dimensions, or null.
-     * @exception IllegalArgumentException if {@code x <= 0},
-     *      {@code y <= 0}, or {@code units < 1}.
+     * This method is useful for clients which have only dimensions and want to
+     * find a {@code Media} which corresponds to the dimensions.
      *
+     * @param  x {@code X} dimension
+     * @param  y {@code Y} dimension
+     * @param  units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or
+     *         {@code Size2DSyntax.MM}
+     * @return {@code MediaSizeName} matching these dimensions, or {@code null}
+     * @throws IllegalArgumentException if {@code x <= 0}, {@code y <= 0}, or
+     *         {@code units < 1}
      */
     public static MediaSizeName findMedia(float x, float y, int units) {
 
@@ -232,26 +226,20 @@
     }
 
     /**
-     * Returns whether this media size attribute is equivalent to the passed
-     * in object.
-     * To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class MediaSize.
-     * <LI>
-     * This media size attribute's X dimension is equal to
-     * {@code object}'s X dimension.
-     * <LI>
-     * This media size attribute's Y dimension is equal to
-     * {@code object}'s Y dimension.
-     * </OL>
+     * Returns whether this media size attribute is equivalent to the passed in
+     * object. To be equivalent, all of the following conditions must be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code MediaSize}.
+     *   <li>This media size attribute's {@code X} dimension is equal to
+     *   {@code object}'s {@code X} dimension.
+     *   <li>This media size attribute's {@code Y} dimension is equal to
+     *   {@code object}'s {@code Y} dimension.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this media size
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this media size
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) && object instanceof MediaSize);
@@ -260,12 +248,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class MediaSize and any vendor-defined subclasses, the category is
-     * class MediaSize itself.
+     * <p>
+     * For class {@code MediaSize} and any vendor-defined subclasses, the
+     * category is class {@code MediaSize} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return MediaSize.class;
@@ -274,151 +262,178 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class MediaSize and any vendor-defined subclasses, the category
-     * name is {@code "media-size"}.
+     * <p>
+     * For class {@code MediaSize} and any vendor-defined subclasses, the
+     * category name is {@code "media-size"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "media-size";
     }
 
     /**
-     * Class MediaSize.ISO includes {@link MediaSize MediaSize} values for ISO
-     * media.
+     * Class {@code MediaSize.ISO} includes {@link MediaSize MediaSize} values
+     * for ISO media.
      */
     public static final class ISO {
+
         /**
          * Specifies the ISO A0 size, 841 mm by 1189 mm.
          */
         public static final MediaSize
             A0 = new MediaSize(841, 1189, Size2DSyntax.MM, MediaSizeName.ISO_A0);
+
         /**
          * Specifies the ISO A1 size, 594 mm by 841 mm.
          */
         public static final MediaSize
             A1 = new MediaSize(594, 841, Size2DSyntax.MM, MediaSizeName.ISO_A1);
+
         /**
          * Specifies the ISO A2 size, 420 mm by 594 mm.
          */
         public static final MediaSize
             A2 = new MediaSize(420, 594, Size2DSyntax.MM, MediaSizeName.ISO_A2);
+
         /**
          * Specifies the ISO A3 size, 297 mm by 420 mm.
          */
         public static final MediaSize
             A3 = new MediaSize(297, 420, Size2DSyntax.MM, MediaSizeName.ISO_A3);
+
         /**
          * Specifies the ISO A4 size, 210 mm by 297 mm.
          */
         public static final MediaSize
             A4 = new MediaSize(210, 297, Size2DSyntax.MM, MediaSizeName.ISO_A4);
+
         /**
          * Specifies the ISO A5 size, 148 mm by 210 mm.
          */
         public static final MediaSize
             A5 = new MediaSize(148, 210, Size2DSyntax.MM, MediaSizeName.ISO_A5);
+
         /**
          * Specifies the ISO A6 size, 105 mm by 148 mm.
          */
         public static final MediaSize
             A6 = new MediaSize(105, 148, Size2DSyntax.MM, MediaSizeName.ISO_A6);
+
         /**
          * Specifies the ISO A7 size, 74 mm by 105 mm.
          */
         public static final MediaSize
             A7 = new MediaSize(74, 105, Size2DSyntax.MM, MediaSizeName.ISO_A7);
+
         /**
          * Specifies the ISO A8 size, 52 mm by 74 mm.
          */
         public static final MediaSize
             A8 = new MediaSize(52, 74, Size2DSyntax.MM, MediaSizeName.ISO_A8);
+
         /**
          * Specifies the ISO A9 size, 37 mm by 52 mm.
          */
         public static final MediaSize
             A9 = new MediaSize(37, 52, Size2DSyntax.MM, MediaSizeName.ISO_A9);
+
         /**
          * Specifies the ISO A10 size, 26 mm by 37 mm.
          */
         public static final MediaSize
             A10 = new MediaSize(26, 37, Size2DSyntax.MM, MediaSizeName.ISO_A10);
+
         /**
          * Specifies the ISO B0 size, 1000 mm by 1414 mm.
          */
         public static final MediaSize
             B0 = new MediaSize(1000, 1414, Size2DSyntax.MM, MediaSizeName.ISO_B0);
+
         /**
          * Specifies the ISO B1 size, 707 mm by 1000 mm.
          */
         public static final MediaSize
             B1 = new MediaSize(707, 1000, Size2DSyntax.MM, MediaSizeName.ISO_B1);
+
         /**
          * Specifies the ISO B2 size, 500 mm by 707 mm.
          */
         public static final MediaSize
             B2 = new MediaSize(500, 707, Size2DSyntax.MM, MediaSizeName.ISO_B2);
+
         /**
          * Specifies the ISO B3 size, 353 mm by 500 mm.
          */
         public static final MediaSize
             B3 = new MediaSize(353, 500, Size2DSyntax.MM, MediaSizeName.ISO_B3);
+
         /**
          * Specifies the ISO B4 size, 250 mm by 353 mm.
          */
         public static final MediaSize
             B4 = new MediaSize(250, 353, Size2DSyntax.MM, MediaSizeName.ISO_B4);
+
         /**
          * Specifies the ISO B5 size, 176 mm by 250 mm.
          */
         public static final MediaSize
             B5 = new MediaSize(176, 250, Size2DSyntax.MM, MediaSizeName.ISO_B5);
+
         /**
          * Specifies the ISO B6 size, 125 mm by 176 mm.
          */
         public static final MediaSize
             B6 = new MediaSize(125, 176, Size2DSyntax.MM, MediaSizeName.ISO_B6);
+
         /**
          * Specifies the ISO B7 size, 88 mm by 125 mm.
          */
         public static final MediaSize
             B7 = new MediaSize(88, 125, Size2DSyntax.MM, MediaSizeName.ISO_B7);
+
         /**
          * Specifies the ISO B8 size, 62 mm by 88 mm.
          */
         public static final MediaSize
             B8 = new MediaSize(62, 88, Size2DSyntax.MM, MediaSizeName.ISO_B8);
+
         /**
          * Specifies the ISO B9 size, 44 mm by 62 mm.
          */
         public static final MediaSize
             B9 = new MediaSize(44, 62, Size2DSyntax.MM, MediaSizeName.ISO_B9);
+
         /**
          * Specifies the ISO B10 size, 31 mm by 44 mm.
          */
         public static final MediaSize
             B10 = new MediaSize(31, 44, Size2DSyntax.MM, MediaSizeName.ISO_B10);
+
         /**
          * Specifies the ISO C3 size, 324 mm by 458 mm.
          */
         public static final MediaSize
             C3 = new MediaSize(324, 458, Size2DSyntax.MM, MediaSizeName.ISO_C3);
+
         /**
          * Specifies the ISO C4 size, 229 mm by 324 mm.
          */
         public static final MediaSize
             C4 = new MediaSize(229, 324, Size2DSyntax.MM, MediaSizeName.ISO_C4);
+
         /**
          * Specifies the ISO C5 size, 162 mm by 229 mm.
          */
         public static final MediaSize
             C5 = new MediaSize(162, 229, Size2DSyntax.MM, MediaSizeName.ISO_C5);
+
         /**
          * Specifies the ISO C6 size, 114 mm by 162 mm.
          */
         public static final MediaSize
             C6 = new MediaSize(114, 162, Size2DSyntax.MM, MediaSizeName.ISO_C6);
+
         /**
          * Specifies the ISO Designated Long size, 110 mm by 220 mm.
          */
@@ -434,8 +449,8 @@
     }
 
     /**
-     * Class MediaSize.JIS includes {@link MediaSize MediaSize} values for JIS
-     * (Japanese) media.      *
+     * Class {@code MediaSize.JIS} includes {@link MediaSize MediaSize} values
+     * for JIS (Japanese) media.
      */
     public static final class JIS {
 
@@ -444,152 +459,188 @@
          */
         public static final MediaSize
             B0 = new MediaSize(1030, 1456, Size2DSyntax.MM, MediaSizeName.JIS_B0);
+
         /**
          * Specifies the JIS B1 size, 728 mm by 1030 mm.
          */
         public static final MediaSize
             B1 = new MediaSize(728, 1030, Size2DSyntax.MM, MediaSizeName.JIS_B1);
+
         /**
          * Specifies the JIS B2 size, 515 mm by 728 mm.
          */
         public static final MediaSize
             B2 = new MediaSize(515, 728, Size2DSyntax.MM, MediaSizeName.JIS_B2);
+
         /**
          * Specifies the JIS B3 size, 364 mm by 515 mm.
          */
         public static final MediaSize
             B3 = new MediaSize(364, 515, Size2DSyntax.MM, MediaSizeName.JIS_B3);
+
         /**
          * Specifies the JIS B4 size, 257 mm by 364 mm.
          */
         public static final MediaSize
             B4 = new MediaSize(257, 364, Size2DSyntax.MM, MediaSizeName.JIS_B4);
+
         /**
          * Specifies the JIS B5 size, 182 mm by 257 mm.
          */
         public static final MediaSize
             B5 = new MediaSize(182, 257, Size2DSyntax.MM, MediaSizeName.JIS_B5);
+
         /**
          * Specifies the JIS B6 size, 128 mm by 182 mm.
          */
         public static final MediaSize
             B6 = new MediaSize(128, 182, Size2DSyntax.MM, MediaSizeName.JIS_B6);
+
         /**
          * Specifies the JIS B7 size, 91 mm by 128 mm.
          */
         public static final MediaSize
             B7 = new MediaSize(91, 128, Size2DSyntax.MM, MediaSizeName.JIS_B7);
+
         /**
          * Specifies the JIS B8 size, 64 mm by 91 mm.
          */
         public static final MediaSize
             B8 = new MediaSize(64, 91, Size2DSyntax.MM, MediaSizeName.JIS_B8);
+
         /**
          * Specifies the JIS B9 size, 45 mm by 64 mm.
          */
         public static final MediaSize
             B9 = new MediaSize(45, 64, Size2DSyntax.MM, MediaSizeName.JIS_B9);
+
         /**
          * Specifies the JIS B10 size, 32 mm by 45 mm.
          */
         public static final MediaSize
             B10 = new MediaSize(32, 45, Size2DSyntax.MM, MediaSizeName.JIS_B10);
+
         /**
          * Specifies the JIS Chou ("long") #1 envelope size, 142 mm by 332 mm.
          */
         public static final MediaSize CHOU_1 = new MediaSize(142, 332, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Chou ("long") #2 envelope size, 119 mm by 277 mm.
          */
         public static final MediaSize CHOU_2 = new MediaSize(119, 277, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Chou ("long") #3 envelope size, 120 mm by 235 mm.
          */
         public static final MediaSize CHOU_3 = new MediaSize(120, 235, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Chou ("long") #4 envelope size, 90 mm by 205 mm.
          */
         public static final MediaSize CHOU_4 = new MediaSize(90, 205, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Chou ("long") #30 envelope size, 92 mm by 235 mm.
          */
         public static final MediaSize CHOU_30 = new MediaSize(92, 235, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Chou ("long") #40 envelope size, 90 mm by 225 mm.
          */
         public static final MediaSize CHOU_40 = new MediaSize(90, 225, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") #0 envelope size, 287 mm by 382 mm.
          */
         public static final MediaSize KAKU_0 = new MediaSize(287, 382, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") #1 envelope size, 270 mm by 382 mm.
          */
         public static final MediaSize KAKU_1 = new MediaSize(270, 382, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") #2 envelope size, 240 mm by 332 mm.
          */
         public static final MediaSize KAKU_2 = new MediaSize(240, 332, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") #3 envelope size, 216 mm by 277 mm.
          */
         public static final MediaSize KAKU_3 = new MediaSize(216, 277, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") #4 envelope size, 197 mm by 267 mm.
          */
         public static final MediaSize KAKU_4 = new MediaSize(197, 267, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") #5 envelope size, 190 mm by 240 mm.
          */
         public static final MediaSize KAKU_5 = new MediaSize(190, 240, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") #6 envelope size, 162 mm by 229 mm.
          */
         public static final MediaSize KAKU_6 = new MediaSize(162, 229, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") #7 envelope size, 142 mm by 205 mm.
          */
         public static final MediaSize KAKU_7 = new MediaSize(142, 205, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") #8 envelope size, 119 mm by 197 mm.
          */
         public static final MediaSize KAKU_8 = new MediaSize(119, 197, Size2DSyntax.MM);
+
         /**
-         * Specifies the JIS Kaku ("square") #20 envelope size, 229 mm by 324 mm.
+         * Specifies the JIS Kaku ("square") #20 envelope size, 229 mm by 324
+         * mm.
          */
         public static final MediaSize KAKU_20 = new MediaSize(229, 324, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS Kaku ("square") A4 envelope size, 228 mm by 312 mm.
          */
         public static final MediaSize KAKU_A4 = new MediaSize(228, 312, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS You ("Western") #1 envelope size, 120 mm by 176 mm.
          */
         public static final MediaSize YOU_1 = new MediaSize(120, 176, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS You ("Western") #2 envelope size, 114 mm by 162 mm.
          */
         public static final MediaSize YOU_2 = new MediaSize(114, 162, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS You ("Western") #3 envelope size, 98 mm by 148 mm.
          */
         public static final MediaSize YOU_3 = new MediaSize(98, 148, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS You ("Western") #4 envelope size, 105 mm by 235 mm.
          */
         public static final MediaSize YOU_4 = new MediaSize(105, 235, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS You ("Western") #5 envelope size, 95 mm by 217 mm.
          */
         public static final MediaSize YOU_5 = new MediaSize(95, 217, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS You ("Western") #6 envelope size, 98 mm by 190 mm.
          */
         public static final MediaSize YOU_6 = new MediaSize(98, 190, Size2DSyntax.MM);
+
         /**
          * Specifies the JIS You ("Western") #7 envelope size, 92 mm by 165 mm.
          */
         public static final MediaSize YOU_7 = new MediaSize(92, 165, Size2DSyntax.MM);
+
         /**
          * Hide all constructors.
          */
@@ -598,8 +649,8 @@
     }
 
     /**
-     * Class MediaSize.NA includes {@link MediaSize MediaSize} values for North
-     * American media.
+     * Class {@code MediaSize.NA} includes {@link MediaSize MediaSize} values
+     * for North American media.
      */
     public static final class NA {
 
@@ -609,59 +660,67 @@
         public static final MediaSize
             LETTER = new MediaSize(8.5f, 11.0f, Size2DSyntax.INCH,
                                                 MediaSizeName.NA_LETTER);
+
         /**
          * Specifies the North American legal size, 8.5 inches by 14 inches.
          */
         public static final MediaSize
             LEGAL = new MediaSize(8.5f, 14.0f, Size2DSyntax.INCH,
                                                MediaSizeName.NA_LEGAL);
+
         /**
          * Specifies the North American 5 inch by 7 inch paper.
          */
         public static final MediaSize
             NA_5X7 = new MediaSize(5, 7, Size2DSyntax.INCH,
                                    MediaSizeName.NA_5X7);
+
         /**
          * Specifies the North American 8 inch by 10 inch paper.
          */
         public static final MediaSize
             NA_8X10 = new MediaSize(8, 10, Size2DSyntax.INCH,
                                    MediaSizeName.NA_8X10);
+
         /**
-         * Specifies the North American Number 9 business envelope size,
-         * 3.875 inches by 8.875 inches.
+         * Specifies the North American Number 9 business envelope size, 3.875
+         * inches by 8.875 inches.
          */
         public static final MediaSize
             NA_NUMBER_9_ENVELOPE =
             new MediaSize(3.875f, 8.875f, Size2DSyntax.INCH,
                           MediaSizeName.NA_NUMBER_9_ENVELOPE);
+
         /**
-         * Specifies the North American Number 10 business envelope size,
-         * 4.125 inches by 9.5 inches.
+         * Specifies the North American Number 10 business envelope size, 4.125
+         * inches by 9.5 inches.
          */
         public static final MediaSize
             NA_NUMBER_10_ENVELOPE =
             new MediaSize(4.125f, 9.5f, Size2DSyntax.INCH,
                           MediaSizeName.NA_NUMBER_10_ENVELOPE);
+
         /**
-         * Specifies the North American Number 11 business envelope size,
-         * 4.5 inches by 10.375 inches.
+         * Specifies the North American Number 11 business envelope size, 4.5
+         * inches by 10.375 inches.
          */
         public static final MediaSize
             NA_NUMBER_11_ENVELOPE =
             new MediaSize(4.5f, 10.375f, Size2DSyntax.INCH,
                           MediaSizeName.NA_NUMBER_11_ENVELOPE);
+
         /**
-         * Specifies the North American Number 12 business envelope size,
-         * 4.75 inches by 11 inches.
+         * Specifies the North American Number 12 business envelope size, 4.75
+         * inches by 11 inches.
          */
         public static final MediaSize
             NA_NUMBER_12_ENVELOPE =
             new MediaSize(4.75f, 11.0f, Size2DSyntax.INCH,
                           MediaSizeName.NA_NUMBER_12_ENVELOPE);
+
         /**
-         * Specifies the North American Number 14 business envelope size,
-         * 5 inches by 11.5 inches.
+         * Specifies the North American Number 14 business envelope size, 5
+         * inches by 11.5 inches.
          */
         public static final MediaSize
             NA_NUMBER_14_ENVELOPE =
@@ -674,42 +733,49 @@
         public static final MediaSize
             NA_6X9_ENVELOPE = new MediaSize(6.0f, 9.0f, Size2DSyntax.INCH,
                                             MediaSizeName.NA_6X9_ENVELOPE);
+
         /**
          * Specifies the North American 7 inch by 9 inch envelope size.
          */
         public static final MediaSize
             NA_7X9_ENVELOPE = new MediaSize(7.0f, 9.0f, Size2DSyntax.INCH,
                                             MediaSizeName.NA_7X9_ENVELOPE);
+
         /**
          * Specifies the North American 9 inch by 11 inch envelope size.
          */
         public static final MediaSize
             NA_9x11_ENVELOPE = new MediaSize(9.0f, 11.0f, Size2DSyntax.INCH,
                                              MediaSizeName.NA_9X11_ENVELOPE);
+
         /**
          * Specifies the North American 9 inch by 12 inch envelope size.
          */
         public static final MediaSize
             NA_9x12_ENVELOPE = new MediaSize(9.0f, 12.0f, Size2DSyntax.INCH,
                                              MediaSizeName.NA_9X12_ENVELOPE);
+
         /**
          * Specifies the North American 10 inch by 13 inch envelope size.
          */
         public static final MediaSize
             NA_10x13_ENVELOPE = new MediaSize(10.0f, 13.0f, Size2DSyntax.INCH,
                                               MediaSizeName.NA_10X13_ENVELOPE);
+
         /**
          * Specifies the North American 10 inch by 14 inch envelope size.
          */
         public static final MediaSize
             NA_10x14_ENVELOPE = new MediaSize(10.0f, 14.0f, Size2DSyntax.INCH,
                                               MediaSizeName.NA_10X14_ENVELOPE);
+
         /**
          * Specifies the North American 10 inch by 15 inch envelope size.
          */
         public static final MediaSize
             NA_10X15_ENVELOPE = new MediaSize(10.0f, 15.0f, Size2DSyntax.INCH,
                                               MediaSizeName.NA_10X15_ENVELOPE);
+
         /**
          * Hide all constructors.
          */
@@ -718,8 +784,8 @@
     }
 
     /**
-     * Class MediaSize.Engineering includes {@link MediaSize MediaSize} values
-     * for engineering media.
+     * Class {@code MediaSize.Engineering} includes {@link MediaSize MediaSize}
+     * values for engineering media.
      */
     public static final class Engineering {
 
@@ -729,30 +795,35 @@
         public static final MediaSize
             A = new MediaSize(8.5f, 11.0f, Size2DSyntax.INCH,
                               MediaSizeName.A);
+
         /**
          * Specifies the engineering B size, 11 inch by 17 inch.
          */
         public static final MediaSize
             B = new MediaSize(11.0f, 17.0f, Size2DSyntax.INCH,
                               MediaSizeName.B);
+
         /**
          * Specifies the engineering C size, 17 inch by 22 inch.
          */
         public static final MediaSize
             C = new MediaSize(17.0f, 22.0f, Size2DSyntax.INCH,
                               MediaSizeName.C);
+
         /**
          * Specifies the engineering D size, 22 inch by 34 inch.
          */
         public static final MediaSize
             D = new MediaSize(22.0f, 34.0f, Size2DSyntax.INCH,
                               MediaSizeName.D);
+
         /**
          * Specifies the engineering E size, 34 inch by 44 inch.
          */
         public static final MediaSize
             E = new MediaSize(34.0f, 44.0f, Size2DSyntax.INCH,
                               MediaSizeName.E);
+
         /**
          * Hide all constructors.
          */
@@ -761,16 +832,18 @@
     }
 
     /**
-     * Class MediaSize.Other includes {@link MediaSize MediaSize} values for
-     * miscellaneous media.
+     * Class {@code MediaSize.Other} includes {@link MediaSize MediaSize} values
+     * for miscellaneous media.
      */
     public static final class Other {
+
         /**
          * Specifies the executive size, 7.25 inches by 10.5 inches.
          */
         public static final MediaSize
             EXECUTIVE = new MediaSize(7.25f, 10.5f, Size2DSyntax.INCH,
                                       MediaSizeName.EXECUTIVE);
+
         /**
          * Specifies the ledger size, 11 inches by 17 inches.
          */
@@ -780,6 +853,7 @@
 
         /**
          * Specifies the tabloid size, 11 inches by 17 inches.
+         *
          * @since 1.5
          */
         public static final MediaSize
@@ -792,48 +866,56 @@
         public static final MediaSize
             INVOICE = new MediaSize(5.5f, 8.5f, Size2DSyntax.INCH,
                               MediaSizeName.INVOICE);
+
         /**
          * Specifies the folio size, 8.5 inches by 13 inches.
          */
         public static final MediaSize
             FOLIO = new MediaSize(8.5f, 13.0f, Size2DSyntax.INCH,
                                   MediaSizeName.FOLIO);
+
         /**
          * Specifies the quarto size, 8.5 inches by 10.83 inches.
          */
         public static final MediaSize
             QUARTO = new MediaSize(8.5f, 10.83f, Size2DSyntax.INCH,
                                    MediaSizeName.QUARTO);
+
         /**
          * Specifies the Italy envelope size, 110 mm by 230 mm.
          */
         public static final MediaSize
         ITALY_ENVELOPE = new MediaSize(110, 230, Size2DSyntax.MM,
                                        MediaSizeName.ITALY_ENVELOPE);
+
         /**
          * Specifies the Monarch envelope size, 3.87 inch by 7.5 inch.
          */
         public static final MediaSize
         MONARCH_ENVELOPE = new MediaSize(3.87f, 7.5f, Size2DSyntax.INCH,
                                          MediaSizeName.MONARCH_ENVELOPE);
+
         /**
          * Specifies the Personal envelope size, 3.625 inch by 6.5 inch.
          */
         public static final MediaSize
         PERSONAL_ENVELOPE = new MediaSize(3.625f, 6.5f, Size2DSyntax.INCH,
                                          MediaSizeName.PERSONAL_ENVELOPE);
+
         /**
          * Specifies the Japanese postcard size, 100 mm by 148 mm.
          */
         public static final MediaSize
             JAPANESE_POSTCARD = new MediaSize(100, 148, Size2DSyntax.MM,
                                               MediaSizeName.JAPANESE_POSTCARD);
+
         /**
          * Specifies the Japanese Double postcard size, 148 mm by 200 mm.
          */
         public static final MediaSize
             JAPANESE_DOUBLE_POSTCARD = new MediaSize(148, 200, Size2DSyntax.MM,
                                      MediaSizeName.JAPANESE_DOUBLE_POSTCARD);
+
         /**
          * Hide all constructors.
          */
@@ -841,8 +923,9 @@
         }
     }
 
-    /* force loading of all the subclasses so that the instances
-     * are created and inserted into the hashmap.
+    /*
+     * force loading of all the subclasses so that the instances are created and
+     * inserted into the hashmap.
      */
     static {
         MediaSize ISOA4 = ISO.A4;
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSizeName.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSizeName.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,161 +22,192 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
-import java.util.Locale;
-
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.Attribute;
 
 /**
- * Class MediaSizeName is a subclass of Media.
- * <P>
- * This attribute can be used instead of specifying MediaName or MediaTray.
+ * Class {@code MediaSizeName} is a subclass of {@code Media}.
+ * <p>
+ * This attribute can be used instead of specifying {@code MediaName} or
+ * {@code MediaTray}.
  * <p>
- * Class MediaSizeName currently declares a few standard media
- * name values.
- * <P>
- * <B>IPP Compatibility:</B> MediaSizeName is a representation class for
- * values of the IPP "media" attribute which names media sizes.
- * The names of the media sizes correspond to those in the IPP 1.1 RFC
- * <a HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911</a>
- *
+ * Class {@code MediaSizeName} currently declares a few standard media name
+ * values.
+ * <p>
+ * <b>IPP Compatibility:</b> {@code MediaSizeName} is a representation class for
+ * values of the IPP "media" attribute which names media sizes. The names of the
+ * media sizes correspond to those in the IPP 1.1 RFC
+ * <a href="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911</a>
  */
 public class MediaSizeName extends Media {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 2778798329756942747L;
 
     /**
      * A0 size.
      */
     public static final MediaSizeName ISO_A0 = new MediaSizeName(0);
+
     /**
      * A1 size.
      */
     public static final MediaSizeName ISO_A1 = new MediaSizeName(1);
+
     /**
      * A2 size.
      */
     public static final MediaSizeName ISO_A2 = new MediaSizeName(2);
+
     /**
      * A3 size.
      */
     public static final MediaSizeName ISO_A3 = new MediaSizeName(3);
+
     /**
      * A4 size.
      */
     public static final MediaSizeName ISO_A4 = new MediaSizeName(4);
+
     /**
      * A5 size.
      */
     public static final MediaSizeName ISO_A5 = new MediaSizeName(5);
+
     /**
      * A6 size.
      */
     public static final MediaSizeName ISO_A6 = new MediaSizeName(6);
+
     /**
      * A7 size.
      */
     public static final MediaSizeName ISO_A7 = new MediaSizeName(7);
+
     /**
      * A8 size.
      */
     public static final MediaSizeName ISO_A8 = new MediaSizeName(8);
+
     /**
      * A9 size.
      */
     public static final MediaSizeName ISO_A9 = new MediaSizeName(9);
+
     /**
      * A10 size.
      */
     public static final MediaSizeName ISO_A10 = new MediaSizeName(10);
 
-   /**
+    /**
      * ISO B0 size.
      */
     public static final MediaSizeName ISO_B0 = new MediaSizeName(11);
+
     /**
      * ISO B1 size.
      */
     public static final MediaSizeName ISO_B1 = new MediaSizeName(12);
+
     /**
      * ISO B2 size.
      */
     public static final MediaSizeName ISO_B2 = new MediaSizeName(13);
+
     /**
      * ISO B3 size.
      */
     public static final MediaSizeName ISO_B3 = new MediaSizeName(14);
+
     /**
      * ISO B4 size.
      */
     public static final MediaSizeName ISO_B4 = new MediaSizeName(15);
+
     /**
      * ISO B5 size.
      */
     public static final MediaSizeName ISO_B5 = new MediaSizeName(16);
+
     /**
      * ISO B6 size.
      */
     public static final MediaSizeName ISO_B6 = new MediaSizeName(17);
+
     /**
      * ISO B7 size.
      */
     public static final MediaSizeName ISO_B7 = new MediaSizeName(18);
+
     /**
      * ISO B8 size.
      */
     public static final MediaSizeName ISO_B8 = new MediaSizeName(19);
+
     /**
      * ISO B9 size.
      */
     public static final MediaSizeName ISO_B9 = new MediaSizeName(20);
+
     /**
      * ISO B10 size.
      */
     public static final MediaSizeName ISO_B10 = new MediaSizeName(21);
 
-   /**
+    /**
      * JIS B0 size.
      */
     public static final MediaSizeName JIS_B0 = new MediaSizeName(22);
+
     /**
      * JIS B1 size.
      */
     public static final MediaSizeName JIS_B1 = new MediaSizeName(23);
+
     /**
      * JIS B2 size.
      */
     public static final MediaSizeName JIS_B2 = new MediaSizeName(24);
+
     /**
      * JIS B3 size.
      */
     public static final MediaSizeName JIS_B3 = new MediaSizeName(25);
+
     /**
      * JIS B4 size.
      */
     public static final MediaSizeName JIS_B4 = new MediaSizeName(26);
+
     /**
      * JIS B5 size.
      */
     public static final MediaSizeName JIS_B5 = new MediaSizeName(27);
+
     /**
      * JIS B6 size.
      */
     public static final MediaSizeName JIS_B6 = new MediaSizeName(28);
+
     /**
      * JIS B7 size.
      */
     public static final MediaSizeName JIS_B7 = new MediaSizeName(29);
+
     /**
      * JIS B8 size.
      */
     public static final MediaSizeName JIS_B8 = new MediaSizeName(30);
+
     /**
      * JIS B9 size.
      */
     public static final MediaSizeName JIS_B9 = new MediaSizeName(31);
+
     /**
      * JIS B10 size.
      */
@@ -186,198 +217,216 @@
      * ISO C0 size.
      */
     public static final MediaSizeName ISO_C0 = new MediaSizeName(33);
+
     /**
      * ISO C1 size.
      */
     public static final MediaSizeName ISO_C1 = new MediaSizeName(34);
+
     /**
      * ISO C2 size.
      */
     public static final MediaSizeName ISO_C2 = new MediaSizeName(35);
+
     /**
      * ISO C3 size.
      */
     public static final MediaSizeName ISO_C3 = new MediaSizeName(36);
+
     /**
      * ISO C4 size.
      */
     public static final MediaSizeName ISO_C4 = new MediaSizeName(37);
+
     /**
      * ISO C5 size.
      */
     public static final MediaSizeName ISO_C5 = new MediaSizeName(38);
+
     /**
-     *   letter size.
+     * letter size.
      */
     public static final MediaSizeName ISO_C6 = new MediaSizeName(39);
+
     /**
-     *   letter size.
+     * letter size.
      */
     public static final MediaSizeName NA_LETTER = new MediaSizeName(40);
 
     /**
-     *  legal size .
+     * legal size.
      */
     public static final MediaSizeName NA_LEGAL = new MediaSizeName(41);
 
     /**
-     *  executive size .
+     * executive size.
      */
     public static final MediaSizeName EXECUTIVE = new MediaSizeName(42);
 
     /**
-     *  ledger size .
+     * ledger size.
      */
     public static final MediaSizeName LEDGER = new MediaSizeName(43);
 
     /**
-     *  tabloid size .
+     * tabloid size.
      */
     public static final MediaSizeName TABLOID = new MediaSizeName(44);
 
     /**
-     *  invoice size .
+     * invoice size.
      */
     public static final MediaSizeName INVOICE = new MediaSizeName(45);
 
     /**
-     *  folio size .
+     * folio size.
      */
     public static final MediaSizeName FOLIO = new MediaSizeName(46);
 
     /**
-     *  quarto size .
+     * quarto size.
      */
     public static final MediaSizeName QUARTO = new MediaSizeName(47);
 
     /**
-     *  Japanese Postcard size.
+     * Japanese Postcard size.
      */
     public static final MediaSizeName
         JAPANESE_POSTCARD = new MediaSizeName(48);
-   /**
-     *  Japanese Double Postcard size.
+
+    /**
+     * Japanese Double Postcard size.
      */
     public static final MediaSizeName
         JAPANESE_DOUBLE_POSTCARD = new MediaSizeName(49);
 
     /**
-     *  A size .
+     * A size.
      */
     public static final MediaSizeName A = new MediaSizeName(50);
 
     /**
-     *  B size .
+     * B size.
      */
     public static final MediaSizeName B = new MediaSizeName(51);
 
     /**
-     *  C size .
+     * C size.
      */
     public static final MediaSizeName C = new MediaSizeName(52);
 
     /**
-     *  D size .
+     * D size.
      */
     public static final MediaSizeName D = new MediaSizeName(53);
 
     /**
-     *  E size .
+     * E size.
      */
     public static final MediaSizeName E = new MediaSizeName(54);
 
     /**
-     *  ISO designated long size .
+     * ISO designated long size.
      */
     public static final MediaSizeName
         ISO_DESIGNATED_LONG = new MediaSizeName(55);
 
     /**
-     *  Italy envelope size .
+     * Italy envelope size.
      */
     public static final MediaSizeName
         ITALY_ENVELOPE = new MediaSizeName(56);  // DESIGNATED_LONG?
 
     /**
-     *  monarch envelope size .
+     * monarch envelope size.
      */
     public static final MediaSizeName
         MONARCH_ENVELOPE = new MediaSizeName(57);
+
     /**
-     * personal envelope size .
+     * personal envelope size.
      */
     public static final MediaSizeName
         PERSONAL_ENVELOPE = new MediaSizeName(58);
+
     /**
-     *  number 9 envelope size .
+     * number 9 envelope size.
      */
     public static final MediaSizeName
         NA_NUMBER_9_ENVELOPE = new MediaSizeName(59);
+
     /**
-     *  number 10 envelope size .
+     * number 10 envelope size.
      */
     public static final MediaSizeName
         NA_NUMBER_10_ENVELOPE = new MediaSizeName(60);
+
     /**
-     *  number 11 envelope size .
+     * number 11 envelope size.
      */
     public static final MediaSizeName
         NA_NUMBER_11_ENVELOPE = new MediaSizeName(61);
+
     /**
-     *  number 12 envelope size .
+     * number 12 envelope size.
      */
     public static final MediaSizeName
         NA_NUMBER_12_ENVELOPE = new MediaSizeName(62);
+
     /**
-     *  number 14 envelope size .
+     * number 14 envelope size.
      */
     public static final MediaSizeName
         NA_NUMBER_14_ENVELOPE = new MediaSizeName(63);
-   /**
-     *  6x9 North American envelope size.
+
+    /**
+     * 6x9 North American envelope size.
      */
     public static final MediaSizeName
         NA_6X9_ENVELOPE = new MediaSizeName(64);
-   /**
-     *  7x9 North American envelope size.
+
+    /**
+     * 7x9 North American envelope size.
      */
     public static final MediaSizeName
         NA_7X9_ENVELOPE = new MediaSizeName(65);
-   /**
-     *  9x11 North American envelope size.
+
+    /**
+     * 9x11 North American envelope size.
      */
     public static final MediaSizeName
         NA_9X11_ENVELOPE = new MediaSizeName(66);
+
     /**
-     *  9x12 North American envelope size.
+     * 9x12 North American envelope size.
      */
     public static final MediaSizeName
         NA_9X12_ENVELOPE = new MediaSizeName(67);
 
     /**
-     *  10x13 North American envelope size .
+     * 10x13 North American envelope size.
      */
     public static final MediaSizeName
         NA_10X13_ENVELOPE = new MediaSizeName(68);
     /**
-     *  10x14North American  envelope size .
+     * 10x14North American envelope size.
      */
     public static final MediaSizeName
         NA_10X14_ENVELOPE = new MediaSizeName(69);
     /**
-     *  10x15 North American envelope size.
+     * 10x15 North American envelope size.
      */
     public static final MediaSizeName
         NA_10X15_ENVELOPE = new MediaSizeName(70);
 
     /**
-     *  5x7 North American paper.
+     * 5x7 North American paper.
      */
     public static final MediaSizeName
         NA_5X7 = new MediaSizeName(71);
 
     /**
-     *  8x10 North American paper.
+     * 8x10 North American paper.
      */
     public static final MediaSizeName
         NA_8X10 = new MediaSizeName(72);
@@ -386,12 +435,15 @@
      * Construct a new media size enumeration value with the given integer
      * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected MediaSizeName(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code MediaSizeName}.
+     */
     private static final String[] myStringTable = {
                 "iso-a0",
                 "iso-a1",
@@ -468,6 +520,9 @@
                 "na-8x10",
         };
 
+    /**
+     * The enumeration value table for class {@code MediaSizeName}.
+     */
     private static final MediaSizeName[] myEnumValueTable = {
                 ISO_A0,
                 ISO_A1,
@@ -544,9 +599,8 @@
                 NA_8X10,
         };
 
-
     /**
-     * Returns the string table for class MediaSizeName.
+     * Returns the string table for class {@code MediaSizeName}.
      */
     protected String[] getStringTable()
     {
@@ -554,11 +608,9 @@
     }
 
     /**
-     * Returns the enumeration value table for class MediaSizeName.
+     * Returns the enumeration value table for class {@code MediaSizeName}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
     }
-
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaTray.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaTray.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,29 +22,30 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
-import java.util.Locale;
-
 import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
 
-
 /**
- * Class MediaTray is a subclass of Media.
- * Class MediaTray is a printing attribute class, an enumeration, that
- * specifies the media tray or bin for the job.
- * This attribute can be used instead of specifying MediaSize or MediaName.
+ * Class {@code MediaTray} is a subclass of {@code Media}. Class
+ * {@code MediaTray} is a printing attribute class, an enumeration, that
+ * specifies the media tray or bin for the job. This attribute can be used
+ * instead of specifying {@code MediaSize} or {@code MediaName}.
  * <p>
- * Class MediaTray declares keywords for standard media kind values.
- * Implementation- or site-defined names for a media kind attribute may also
- * be created by defining a subclass of class MediaTray.
- * <P>
- * <B>IPP Compatibility:</B> MediaTray is a representation class for
+ * Class {@code MediaTray} declares keywords for standard media kind values.
+ * Implementation- or site-defined names for a media kind attribute may also be
+ * created by defining a subclass of class {@code MediaTray}.
+ * <p>
+ * <b>IPP Compatibility:</b> {@code MediaTray} is a representation class for
  * values of the IPP "media" attribute which name paper trays.
  */
 public class MediaTray extends Media implements Attribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -982503611095214703L;
 
     /**
@@ -91,12 +92,15 @@
      * Construct a new media tray enumeration value with the given integer
      * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected MediaTray(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code MediaTray}.
+     */
     private static final String[] myStringTable ={
         "top",
         "middle",
@@ -108,6 +112,9 @@
         "side"
     };
 
+    /**
+     * The enumeration value table for class {@code MediaTray}.
+     */
     private static final MediaTray[] myEnumValueTable = {
         TOP,
         MIDDLE,
@@ -120,7 +127,7 @@
     };
 
     /**
-     * Returns the string table for class MediaTray.
+     * Returns the string table for class {@code MediaTray}.
      */
     protected String[] getStringTable()
     {
@@ -128,11 +135,9 @@
     }
 
     /**
-     * Returns the enumeration value table for class MediaTray.
+     * Returns the enumeration value table for class {@code MediaTray}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
     }
-
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java	Sat Sep 09 14:36:45 2017 +0200
@@ -22,178 +22,162 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class MultipleDocumentHandling is a printing attribute class, an enumeration,
- * that controls finishing operations and the placement of one or more
- * print-stream pages into impressions and onto media sheets. When the value of
- * the {@link Copies Copies} attribute exceeds 1, MultipleDocumentHandling also
- * controls the order in which the copies that result from processing the
- * documents are produced. This attribute is relevant only for a multidoc print
- * job consisting of two or more individual docs.
- * <P>
- * Briefly, MultipleDocumentHandling determines the relationship between the
- * multiple input (electronic) documents fed into a multidoc print job and the
- * output (physical) document or documents produced by the multidoc print job.
+ * Class {@code MultipleDocumentHandling} is a printing attribute class, an
+ * enumeration, that controls finishing operations and the placement of one or
+ * more print-stream pages into impressions and onto media sheets. When the
+ * value of the {@link Copies Copies} attribute exceeds 1,
+ * {@code MultipleDocumentHandling} also controls the order in which the copies
+ * that result from processing the documents are produced. This attribute is
+ * relevant only for a multidoc print job consisting of two or more individual
+ * docs.
+ * <p>
+ * Briefly, {@code MultipleDocumentHandling} determines the relationship between
+ * the multiple input (electronic) documents fed into a multidoc print job and
+ * the output (physical) document or documents produced by the multidoc print
+ * job.
  * There are two possibilities:
- * <UL>
- * <LI>
- * The multiple input documents are combined into a single output document.
- * Finishing operations ({@link Finishings Finishings}),
- * are performed on this single output
- * document. The {@link Copies Copies} attribute tells how many copies of this
- * single output document to produce. The MultipleDocumentHandling values
- * SINGLE_DOCUMENT and SINGLE_DOCUMENT_NEW_SHEET specify two variations of
- * this  possibility.
- *
- * <LI>
- * The multiple input documents remain separate output documents. Finishing
- * operations ({@link Finishings Finishings}),
- * are performed on each output document
- * separately. The {@link Copies Copies} attribute tells how many copies of each
- * separate output document to produce. The MultipleDocumentHandling values
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and SEPARATE_DOCUMENTS_COLLATED_COPIES
- * specify two variations of this possibility.
- * </UL>
- * <P>
- * In the detailed explanations below, if "{@code a}" represents an
- * instance of document data, then the result of processing the data in
- * document "{@code a}" is a sequence of media sheets represented by
- * "{@code a(*)}".
- * <P>
- * The standard MultipleDocumentHandling values are:
- * <UL>
- * <LI>
- * <a id="sdfi"></a>{@link #SINGLE_DOCUMENT
- * <B>SINGLE_DOCUMENT</B>}. If a print job has multiple
- * documents -- say, the document data is called {@code a} and
- * {@code b} -- then the result of processing all the document data
- * ({@code a} and then {@code b}) must be treated as a single sequence
- * of media sheets for finishing operations; that is, finishing would be
- * performed on the concatenation of the sequences {@code a(*),b(*)}. The
- * printer must not force the data in each document instance to be formatted
- * onto a new print-stream page, nor to start a new impression on a new media
- * sheet. If more than one copy is made, the ordering of the sets of media
- * sheets resulting from processing the document data must be
- * {@code a(*),b(*),a(*),b(*),...}, and the printer object must force
- * each copy ({@code a(*),b(*)}) to start on a new media sheet.
- *
- * <LI>
- * <a id="sducfi"></a>{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
- * <B>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</B>}. If a print job
- * has multiple documents -- say, the document data is called {@code a} and
- * {@code b} -- then the result of processing the data in each document
- * instance must be treated as a single sequence of media sheets for finishing
- * operations; that is, the sets {@code a(*)} and {@code b(*)} would
- * each be finished separately. The printer must force each copy of the result
- * of processing the data in a single document to start on a new media sheet.
- * If more than one copy is made, the ordering of the sets of media sheets
- * resulting from processing the document data must be
- * {@code a(*),a(*),...,b(*),b(*)...}.
- *
- * <LI>
- * <a id="sdccfi"></a>{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
- * <B>SEPARATE_DOCUMENTS_COLLATED_COPIES</B>}. If a print job
- * has multiple documents -- say, the document data is called {@code a} and
- * {@code b} -- then the result of processing the data in each document
- * instance must be treated as a single sequence of media sheets for finishing
- * operations; that is, the sets {@code a(*)} and {@code b(*)} would
- * each be finished separately. The printer must force each copy of the result
- * of processing the data in a single document to start on a new media sheet.
- * If more than one copy is made, the ordering of the sets of media sheets
- * resulting from processing the document data must be
- * {@code a(*),b(*),a(*),b(*),...}.
- *
- * <LI>
- * <a id="sdnsfi"></a>{@link #SINGLE_DOCUMENT_NEW_SHEET
- * <B>SINGLE_DOCUMENT_NEW_SHEET</B>}. Same as SINGLE_DOCUMENT,
- * except that the printer must ensure that the first impression of each
- * document instance in the job is placed on a new media sheet. This value
- * allows multiple documents to be stapled together with a single staple where
- * each document starts on a new sheet.
- * </UL>
- * <P>
- * SINGLE_DOCUMENT is the same as SEPARATE_DOCUMENTS_COLLATED_COPIES with
- * respect to ordering of print-stream pages, but not media sheet generation,
- * since SINGLE_DOCUMENT will put the first page of the next document on the
- * back side of a sheet if an odd number of pages have been produced so far
- * for the job, while SEPARATE_DOCUMENTS_COLLATED_COPIES always forces the
+ * <ul>
+ *   <li>The multiple input documents are combined into a single output
+ *   document. Finishing operations ({@link Finishings Finishings}), are
+ *   performed on this single output document. The {@link Copies Copies}
+ *   attribute tells how many copies of this single output document to produce.
+ *   The {@code MultipleDocumentHandling} values {@code SINGLE_DOCUMENT} and
+ *   {@code SINGLE_DOCUMENT_NEW_SHEET} specify two variations of this
+ *   possibility.
+ *   <li>The multiple input documents remain separate output documents.
+ *   Finishing operations ({@link Finishings Finishings}), are performed on each
+ *   output document separately. The {@link Copies Copies} attribute tells how
+ *   many copies of each separate output document to produce. The
+ *   {@code MultipleDocumentHandling} values
+ *   {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} and
+ *   {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} specify two variations of this
+ *   possibility.
+ * </ul>
+ * In the detailed explanations below, if "{@code a}" represents an instance of
+ * document data, then the result of processing the data in document "{@code a}"
+ * is a sequence of media sheets represented by "{@code a(*)}".
+ * <p>
+ * The standard {@code MultipleDocumentHandling} values are:
+ * <ul>
+ *   <li><a id="sdfi"></a>{@link #SINGLE_DOCUMENT <b>SINGLE_DOCUMENT</b>}. If a
+ *   print job has multiple documents -- say, the document data is called
+ *   {@code a} and {@code b} -- then the result of processing all the document
+ *   data ({@code a} and then {@code b}) must be treated as a single sequence of
+ *   media sheets for finishing operations; that is, finishing would be
+ *   performed on the concatenation of the sequences {@code a(*),b(*)}. The
+ *   printer must not force the data in each document instance to be formatted
+ *   onto a new print-stream page, nor to start a new impression on a new media
+ *   sheet. If more than one copy is made, the ordering of the sets of media
+ *   sheets resulting from processing the document data must be
+ *   {@code a(*),b(*),a(*),b(*),...}, and the printer object must force each
+ *   copy ({@code a(*),b(*)}) to start on a new media sheet.
+ *   <li><a id="sducfi"></a>{@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES
+ *   <b>SEPARATE_DOCUMENTS_UNCOLLATED_COPIES</b>}. If a print job has multiple
+ *   documents -- say, the document data is called {@code a} and {@code b} --
+ *   then the result of processing the data in each document instance must be
+ *   treated as a single sequence of media sheets for finishing operations; that
+ *   is, the sets {@code a(*)} and {@code b(*)} would each be finished
+ *   separately. The printer must force each copy of the result of processing
+ *   the data in a single document to start on a new media sheet. If more than
+ *   one copy is made, the ordering of the sets of media sheets resulting from
+ *   processing the document data must be {@code a(*),a(*),...,b(*),b(*)...}.
+ *   <li><a id="sdccfi"></a>{@link #SEPARATE_DOCUMENTS_COLLATED_COPIES
+ *   <b>SEPARATE_DOCUMENTS_COLLATED_COPIES</b>}. If a print job has multiple
+ *   documents -- say, the document data is called {@code a} and {@code b} --
+ *   then the result of processing the data in each document instance must be
+ *   treated as a single sequence of media sheets for finishing operations; that
+ *   is, the sets {@code a(*)} and {@code b(*)} would each be finished
+ *   separately. The printer must force each copy of the result of processing
+ *   the data in a single document to start on a new media sheet. If more than
+ *   one copy is made, the ordering of the sets of media sheets resulting from
+ *   processing the document data must be {@code a(*),b(*),a(*),b(*),...}.
+ *   <li><a id="sdnsfi"></a>{@link #SINGLE_DOCUMENT_NEW_SHEET
+ *   <b>SINGLE_DOCUMENT_NEW_SHEET</b>}. Same as SINGLE_DOCUMENT, except that the
+ *   printer must ensure that the first impression of each document instance in
+ *   the job is placed on a new media sheet. This value allows multiple
+ *   documents to be stapled together with a single staple where each document
+ *   starts on a new sheet.
+ * </ul>
+ * <p>
+ * {@code SINGLE_DOCUMENT} is the same as
+ * {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} with respect to ordering of
+ * print-stream pages, but not media sheet generation, since
+ * {@code SINGLE_DOCUMENT} will put the first page of the next document on the
+ * back side of a sheet if an odd number of pages have been produced so far for
+ * the job, while {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} always forces the
  * next document or document copy on to a new sheet.
- * <P>
+ * <p>
  * In addition, if a {@link Finishings Finishings} attribute of
  * {@link Finishings#STAPLE STAPLE} is specified, then:
- * <UL>
- * <LI>
- * With SINGLE_DOCUMENT, documents {@code a} and {@code b} are
- * stapled together as a single document with no regard to new sheets.
- *
- * <LI>
- * With SINGLE_DOCUMENT_NEW_SHEET, documents {@code a} and {@code b}
- * are stapled together as a single document, but document {@code b}
- * starts on a new sheet.
+ * <ul>
+ *   <li>With {@code SINGLE_DOCUMENT}, documents {@code a} and {@code b} are
+ *   stapled together as a single document with no regard to new sheets.
+ *   <li>With {@code SINGLE_DOCUMENT_NEW_SHEET}, documents {@code a} and
+ *   {@code b} are stapled together as a single document, but document {@code b}
+ *   starts on a new sheet.
+ *   <li>With {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} and
+ *   {@code SEPARATE_DOCUMENTS_COLLATED_COPIES}, documents {@code a} and
+ *   {@code b} are stapled separately.
+ * </ul>
+ * <i>Note:</i> None of these values provide means to produce uncollated sheets
+ * within a document, i.e., where multiple copies of sheet <i>n</i> are produced
+ * before sheet <i>n</i>+1 of the same document. To specify that, see the
+ * {@link SheetCollate SheetCollate} attribute.
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * <LI>
- * With SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and
- * SEPARATE_DOCUMENTS_COLLATED_COPIES, documents {@code a} and
- * {@code b} are stapled separately.
- * </UL>
- * <P>
- * <I>Note:</I> None of these values provide means to produce uncollated
- * sheets within a document, i.e., where multiple copies of sheet <I>n</I>
- * are produced before sheet <I>n</I>+1 of the same document.
- * To specify that, see the {@link SheetCollate SheetCollate} attribute.
- * <P>
- * <B>IPP Compatibility:</B> The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
- *
- * @see  Copies
- * @see  Finishings
- * @see  NumberUp
- * @see  PageRanges
- * @see  SheetCollate
- * @see  Sides
- *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
+ * @see Copies
+ * @see Finishings
+ * @see NumberUp
+ * @see PageRanges
+ * @see SheetCollate
+ * @see Sides
  */
 public class MultipleDocumentHandling extends EnumSyntax
     implements PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 8098326460746413466L;
 
-
     /**
-     * Single document -- see above for <A HREF="#sdfi">further
-     * information</A>.
+     * Single document -- see above for <a href="#sdfi">further information</a>.
      */
     public static final MultipleDocumentHandling
         SINGLE_DOCUMENT = new MultipleDocumentHandling (0);
 
     /**
      * Separate documents uncollated copies -- see above for
-     * <A HREF="#sducfi">further information</A>.
+     * <a href="#sducfi">further information</a>.
      */
     public static final MultipleDocumentHandling
        SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling (1);
 
     /**
      * Separate documents collated copies -- see above for
-     * <A HREF="#sdccfi">further information</A>.
+     * <a href="#sdccfi">further information</a>.
      */
     public static final MultipleDocumentHandling
         SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling (2);
 
     /**
-     * Single document new sheet -- see above for
-     * <A HREF="#sdnsfi">further information</A>.
+     * Single document new sheet -- see above for <a href="#sdnsfi">further
+     * information</a>.
      */
     public static final MultipleDocumentHandling
         SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling (3);
@@ -203,12 +187,15 @@
      * Construct a new multiple document handling enumeration value with the
      * given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected MultipleDocumentHandling(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code MultipleDocumentHandling}.
+     */
     private static final String[] myStringTable = {
         "single-document",
         "separate-documents-uncollated-copies",
@@ -216,6 +203,9 @@
         "single-document-new-sheet"
     };
 
+    /**
+     * The enumeration value table for class {@code MultipleDocumentHandling}.
+     */
     private static final MultipleDocumentHandling[] myEnumValueTable = {
         SINGLE_DOCUMENT,
         SEPARATE_DOCUMENTS_UNCOLLATED_COPIES,
@@ -224,14 +214,15 @@
     };
 
     /**
-     * Returns the string table for class MultipleDocumentHandling.
+     * Returns the string table for class {@code MultipleDocumentHandling}.
      */
     protected String[] getStringTable() {
         return myStringTable.clone();
     }
 
     /**
-     * Returns the enumeration value table for class MultipleDocumentHandling.
+     * Returns the enumeration value table for class
+     * {@code MultipleDocumentHandling}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
@@ -240,12 +231,13 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class MultipleDocumentHandling and any vendor-defined subclasses,
-     * the category is class MultipleDocumentHandling itself.
+     * <p>
+     * For class {@code MultipleDocumentHandling} and any vendor-defined
+     * subclasses, the category is class {@code MultipleDocumentHandling}
+     * itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return MultipleDocumentHandling.class;
@@ -254,14 +246,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class MultipleDocumentHandling and any vendor-defined subclasses,
-     * the category name is {@code "multiple-document-handling"}.
+     * <p>
+     * For class {@code MultipleDocumentHandling} and any vendor-defined
+     * subclasses, the category name is {@code "multiple-document-handling"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "multiple-document-handling";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfDocuments.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfDocuments.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,31 +30,30 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class NumberOfDocuments is an integer valued printing attribute that
+ * Class {@code NumberOfDocuments} is an integer valued printing attribute that
  * indicates the number of individual docs the printer has accepted for this
  * job, regardless of whether the docs' print data has reached the printer or
  * not.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class NumberOfDocuments extends IntegerSyntax
     implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 7891881310684461097L;
 
-
     /**
      * Construct a new number of documents attribute with the given integer
      * value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public NumberOfDocuments(int value) {
         super (value, 0, Integer.MAX_VALUE);
@@ -61,22 +61,18 @@
 
     /**
      * Returns whether this number of documents attribute is equivalent to the
-     * passed in object. To be equivalent, all of the following conditions
-     * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class NumberOfDocuments.
-     * <LI>
-     * This number of documents attribute's value and {@code object}'s
-     * value are equal.
-     * </OL>
+     * passed in object. To be equivalent, all of the following conditions must
+     * be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code NumberOfDocuments}.
+     *   <li>This number of documents attribute's value and {@code object}'s
+     *   value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this number of
-     *          documents attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this number of
+     *         documents attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -86,12 +82,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class NumberOfDocuments, the
-     * category is class NumberOfDocuments itself.
+     * <p>
+     * For class {@code NumberOfDocuments}, the category is class
+     * {@code NumberOfDocuments} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return NumberOfDocuments.class;
@@ -100,14 +96,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class NumberOfDocuments, the
-     * category name is {@code "number-of-documents"}.
+     * <p>
+     * For class {@code NumberOfDocuments}, the category name is
+     * {@code "number-of-documents"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "number-of-documents";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfInterveningJobs.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfInterveningJobs.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,30 +30,30 @@
 import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class NumberOfInterveningJobs is an integer valued printing attribute that
- * indicates the number of jobs that are ahead of this job in the relative
- * chronological order of expected time to complete (i.e., the current
- * scheduled order).
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
- * The category name returned by {@code getName()} gives the IPP
- * attribute name.
+ * Class {@code NumberOfInterveningJobs} is an integer valued printing attribute
+ * that indicates the number of jobs that are ahead of this job in the relative
+ * chronological order of expected time to complete (i.e., the current scheduled
+ * order).
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class NumberOfInterveningJobs extends IntegerSyntax
     implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 2568141124844982746L;
 
     /**
      * Construct a new number of intervening jobs attribute with the given
      * integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public NumberOfInterveningJobs(int value) {
         super(value, 0, Integer.MAX_VALUE);
@@ -62,20 +63,17 @@
      * Returns whether this number of intervening jobs attribute is equivalent
      * to the passed in object. To be equivalent, all of the following
      * conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class NumberOfInterveningJobs.
-     * <LI>
-     * This number of intervening jobs attribute's value and
-     * {@code object}'s value are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code NumberOfInterveningJobs}.
+     *   <li>This number of intervening jobs attribute's value and
+     *   {@code object}'s value are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this number of
-     *          intervening jobs attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this number of
+     *         intervening jobs attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -85,12 +83,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class NumberOfInterveningJobs, the
-     * category is class NumberOfInterveningJobs itself.
+     * <p>
+     * For class {@code NumberOfInterveningJobs}, the category is class
+     * {@code NumberOfInterveningJobs} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return NumberOfInterveningJobs.class;
@@ -99,14 +97,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class NumberOfInterveningJobs, the
-     * category name is {@code "number-of-intervening-jobs"}.
+     * <p>
+     * For class {@code NumberOfInterveningJobs}, the category name is
+     * {@code "number-of-intervening-jobs"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "number-of-intervening-jobs";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUp.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUp.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -22,120 +22,107 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
 import javax.print.attribute.IntegerSyntax;
-import javax.print.attribute.DocAttribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class NumberUp is an integer valued printing attribute class that specifies
- * the number of print-stream pages to impose upon a single side of an
- * instance of a selected medium. That is, if the NumberUp value is <I>n,</I>
- * the printer must place <I>n</I> print-stream pages on a single side of
- * an instance of the
- * selected medium. To accomplish this, the printer may add some sort of
- * translation, scaling, or rotation. This attribute primarily controls the
- * translation, scaling and rotation of print-stream pages.
- * <P>
- * The effect of a NumberUp attribute on a multidoc print job (a job with
- * multiple documents) depends on whether all the docs have the same number up
- * values specified or whether different docs have different number up values
- * specified, and on the (perhaps defaulted) value of the {@link
- * MultipleDocumentHandling MultipleDocumentHandling} attribute.
- * <UL>
- * <LI>
- * If all the docs have the same number up value <I>n</I> specified, then any
- * value of {@link MultipleDocumentHandling MultipleDocumentHandling} makes
- * sense, and the printer's processing depends on the {@link
- * MultipleDocumentHandling MultipleDocumentHandling} value:
- * <UL>
- * <LI>
- * SINGLE_DOCUMENT -- All the input docs will be combined together into one
- * output document. Each media impression will consist of <I>n</I>m
- *  print-stream pages from the output document.
- *
- * <LI>
- * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
- * into one output document. Each media impression will consist of <I>n</I>
- * print-stream pages from the output document. However, the first impression of
- * each input doc will always start on a new media sheet; this means the last
- * impression of an input doc may have fewer than <I>n</I> print-stream pages
- *  on it.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
- * Each media impression will consist of <I>n</I> print-stream pages from the
- * input doc. Since the input docs are separate, the first impression of each
- * input doc will always start on a new media sheet; this means the last
- * impression of an input doc may have fewer than <I>n</I> print-stream pages on
- * it.
+ * Class {@code NumberUp} is an integer valued printing attribute class that
+ * specifies the number of print-stream pages to impose upon a single side of an
+ * instance of a selected medium. That is, if the NumberUp value is <i>n,</i>
+ * the printer must place <i>n</i> print-stream pages on a single side of an
+ * instance of the selected medium. To accomplish this, the printer may add some
+ * sort of translation, scaling, or rotation. This attribute primarily controls
+ * the translation, scaling and rotation of print-stream pages.
+ * <p>
+ * The effect of a {@code NumberUp} attribute on a multidoc print job (a job
+ * with multiple documents) depends on whether all the docs have the same number
+ * up values specified or whether different docs have different number up values
+ * specified, and on the (perhaps defaulted) value of the
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute.
+ * <ul>
+ *   <li>If all the docs have the same number up value <i>n</i> specified, then
+ *   any value of {@link MultipleDocumentHandling MultipleDocumentHandling}
+ *   makes sense, and the printer's processing depends on the
+ *   {@link MultipleDocumentHandling MultipleDocumentHandling} value:
+ *   <ul>
+ *     <li>{@code SINGLE_DOCUMENT} -- All the input docs will be combined
+ *     together into one output document. Each media impression will consist of
+ *     <i>n</i>m print-stream pages from the output document.
+ *     <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be
+ *     combined together into one output document. Each media impression will
+ *     consist of <i>n</i> print-stream pages from the output document. However,
+ *     the first impression of each input doc will always start on a new media
+ *     sheet; this means the last impression of an input doc may have fewer than
+ *     <i>n</i> print-stream pages on it.
+ *     <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will
+ *     remain separate. Each media impression will consist of <i>n</i>
+ *     print-stream pages from the input doc. Since the input docs are separate,
+ *     the first impression of each input doc will always start on a new media
+ *     sheet; this means the last impression of an input doc may have fewer than
+ *     <i>n</i> print-stream pages on it.
+ *     <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will
+ *     remain separate. Each media impression will consist of <i>n</i>
+ *     print-stream pages from the input doc. Since the input docs are separate,
+ *     the first impression of each input doc will always start on a new media
+ *     sheet; this means the last impression of an input doc may have fewer than
+ *     <i>n</i> print-stream pages on it.
+ *   </ul>
+ *   <ul>
+ *     <li>{@code SINGLE_DOCUMENT} -- All the input docs will be combined
+ *     together into one output document. Each media impression will consist of
+ *     <i>n<sub>i</sub></i> print-stream pages from the output document, where
+ *     <i>i</i> is the number of the input doc corresponding to that point in
+ *     the output document. When the next input doc has a different number up
+ *     value from the previous input doc, the first print-stream page of the
+ *     next input doc goes at the start of the next media impression, possibly
+ *     leaving fewer than the full number of print-stream pages on the previous
+ *     media impression.
+ *     <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be
+ *     combined together into one output document. Each media impression will
+ *     consist of <i>n</i> print-stream pages from the output document. However,
+ *     the first impression of each input doc will always start on a new media
+ *     sheet; this means the last impression of an input doc may have fewer than
+ *     <i>n</i> print-stream pages on it.
+ *     <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will
+ *     remain separate. For input doc <i>i,</i> each media impression will
+ *     consist of <i>n<sub>i</sub></i> print-stream pages from the input doc.
+ *     Since the input docs are separate, the first impression of each input doc
+ *     will always start on a new media sheet; this means the last impression of
+ *     an input doc may have fewer than <i>n<sub>i</sub></i> print-stream pages
+ *     on it.
+ *     <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will
+ *     remain separate. For input doc <i>i,</i> each media impression will
+ *     consist of <i>n<sub>i</sub></i> print-stream pages from the input doc.
+ *     Since the input docs are separate, the first impression of each input doc
+ *     will always start on a new media sheet; this means the last impression of
+ *     an input doc may have fewer than <i>n<sub>i</sub></i> print-stream pages
+ *     on it.
+ *   </ul>
+ * </ul>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * <LI>
- * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
- * Each media impression will consist of <I>n</I> print-stream pages from the
- * input doc. Since the input docs are separate, the first impression of each
- * input doc will always start on a new media sheet; this means the last
- * impression of an input doc may have fewer than <I>n</I> print-stream pages
- * on it.
- * </UL>
- * <UL>
- * <LI>
- * SINGLE_DOCUMENT -- All the input docs will be combined together into one
- * output document. Each media impression will consist of <I>n<SUB>i</SUB></I>
- * print-stream pages from the output document, where <I>i</I> is the number of
- * the input doc corresponding to that point in the output document. When the
- * next input doc has a different number up value from the previous input doc,
- * the first print-stream page of the next input doc goes at the start of the
- * next media impression, possibly leaving fewer than the full number of
- * print-stream pages on the previous media impression.
- *
- * <LI>
- * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
- * into one output document. Each media impression will consist of <I>n</I>
- * print-stream pages from the output document. However, the first impression of
- * each input doc will always start on a new media sheet; this means the last
- * impression of an input doc may have fewer than <I>n</I> print-stream pages
- * on it.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
- * For input doc <I>i,</I> each media impression will consist of
- * <I>n<SUB>i</SUB></I> print-stream pages from the input doc. Since the input
- * docs are separate, the first impression of each input doc will always start
- * on a new media sheet; this means the last impression of an input doc may have
- * fewer than <I>n<SUB>i</SUB></I> print-stream pages on it.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
- * For input doc <I>i,</I> each media impression will consist of
- * <I>n<SUB>i</SUB></I> print-stream pages from the input doc. Since the input
- * docs are separate, the first impression of each input doc will always start
- * on a new media sheet; this means the last impression of an input doc may
- * have fewer than <I>n<SUB>i</SUB></I> print-stream pages on it.
- * </UL>
- * </UL>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
- * The category name returned by {@code getName()} gives the IPP
- * attribute name.
- *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class NumberUp extends IntegerSyntax
     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -3040436486786527811L;
 
-
     /**
      * Construct a new number up attribute with the given integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code value} is less than 1.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value < 1}
      */
     public NumberUp(int value) {
         super (value, 1, Integer.MAX_VALUE);
@@ -144,20 +131,16 @@
     /**
      * Returns whether this number up attribute is equivalent to the passed in
      * object. To be equivalent, all of the following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class NumberUp.
-     * <LI>
-     * This number up attribute's value and {@code object}'s value are
-     * equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code NumberUp}.
+     *   <li>This number up attribute's value and {@code object}'s value are
+     *   equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this number up
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this number up
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) && object instanceof NumberUp);
@@ -166,11 +149,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class NumberUp, the category is class NumberUp itself.
+     * <p>
+     * For class {@code NumberUp}, the category is class {@code NumberUp}
+     * itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return NumberUp.class;
@@ -179,13 +163,12 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class NumberUp, the category name is {@code "number-up"}.
+     * <p>
+     * For class {@code NumberUp}, the category name is {@code "number-up"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "number-up";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUpSupported.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUpSupported.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,41 +30,39 @@
 import javax.print.attribute.SupportedValuesAttribute;
 
 /**
- * Class NumberUpSupported is a printing attribute class, a set of integers,
- * that gives the supported values for a {@link NumberUp NumberUp} attribute.
- * <P>
- * <B>IPP Compatibility:</B> The NumberUpSupported attribute's canonical array
+ * Class {@code NumberUpSupported} is a printing attribute class, a set of
+ * integers, that gives the supported values for a {@link NumberUp NumberUp}
+ * attribute.
+ * <p>
+ * <b>IPP Compatibility:</b> The NumberUpSupported attribute's canonical array
  * form gives the lower and upper bound for each range of number-up to be
- * included in an IPP "number-up-supported" attribute. See class {@link
- * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
- * explanation of canonical array form. The category name returned by
- * {@code getName()} gives the IPP attribute name.
+ * included in an IPP "number-up-supported" attribute. See class
+ * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical
+ * array form. The category name returned by {@code getName()} gives the IPP
+ * attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class NumberUpSupported    extends SetOfIntegerSyntax
         implements SupportedValuesAttribute {
 
-     private static final long serialVersionUID = -1041573395759141805L;
-
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
+    private static final long serialVersionUID = -1041573395759141805L;
 
     /**
-     * Construct a new number up supported attribute with the given members.
-     * The supported values for NumberUp are specified in "array form;" see
-     * class
-     * {@link javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax}
-     * for an explanation of array form.
-     *
-     * @param  members  Set members in array form.
+     * Construct a new number up supported attribute with the given members. The
+     * supported values for NumberUp are specified in "array form;" see class
+     * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for
+     * an explanation of array form.
      *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code members} is null or
-     *     any element of {@code members} is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if any element of
-     *   {@code members} is not a length-one or length-two array. Also
-     *    thrown if {@code members} is a zero-length array or if any
-     *    member of the set is less than 1.
+     * @param  members set members in array form
+     * @throws NullPointerException if {@code members} is {@code null} or any
+     *         element of {@code members} is {@code null}
+     * @throws IllegalArgumentException if any element of {@code members} is not
+     *         a length-one or length-two array. Also if {@code members} is a
+     *         zero-length array or if any member of the set is less than 1.
      */
     public NumberUpSupported(int[][] members) {
         super (members);
@@ -86,13 +85,10 @@
 
     /**
      * Construct a new number up supported attribute containing a single
-     * integer. That is, only the one value of NumberUp is supported.
-     *
-     * @param  member  Set member.
+     * integer. That is, only the one value of {@code NumberUp} is supported.
      *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if {@code member} is less than
-     *     1.
+     * @param  member set member
+     * @throws IllegalArgumentException if {@code member < 1}
      */
     public NumberUpSupported(int member) {
         super (member);
@@ -103,16 +99,14 @@
 
     /**
      * Construct a new number up supported attribute containing a single range
-     * of integers. That is, only those values of NumberUp in the one range are
-     * supported.
+     * of integers. That is, only those values of {@code NumberUp} in the one
+     * range are supported.
      *
-     * @param  lowerBound  Lower bound of the range.
-     * @param  upperBound  Upper bound of the range.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if a null range is specified or if a
-     *     non-null range is specified with {@code lowerBound} less than
-     *     1.
+     * @param  lowerBound lower bound of the range
+     * @param  upperBound upper bound of the range
+     * @throws IllegalArgumentException if a {@code null} range is specified or
+     *         if a {@code non-null} range is specified with {@code lowerBound}
+     *         less than 1
      */
     public NumberUpSupported(int lowerBound, int upperBound) {
         super (lowerBound, upperBound);
@@ -126,22 +120,18 @@
 
     /**
      * Returns whether this number up supported attribute is equivalent to the
-     * passed in object. To be equivalent, all of the following conditions
-     * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class NumberUpSupported.
-     * <LI>
-     * This number up supported attribute's members and {@code object}'s
-     * members are the same.
-     * </OL>
+     * passed in object. To be equivalent, all of the following conditions must
+     * be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code NumberUpSupported}.
+     *   <li>This number up supported attribute's members and {@code object}'s
+     *   members are the same.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this number up
-     *          supported attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this number up
+     *         supported attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -151,12 +141,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class NumberUpSupported, the
-     * category is class NumberUpSupported itself.
+     * <p>
+     * For class {@code NumberUpSupported}, the category is class
+     * {@code NumberUpSupported} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return NumberUpSupported.class;
@@ -165,14 +155,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class NumberUpSupported, the
-     * category name is {@code "number-up-supported"}.
+     * <p>
+     * For class {@code NumberUpSupported}, the category name is
+     * {@code "number-up-supported"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "number-up-supported";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OrientationRequested.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OrientationRequested.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,48 +22,51 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.DocAttribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class OrientationRequested is a printing attribute class, an enumeration,
- * that indicates the desired orientation for printed print-stream pages; it
- * does not describe the orientation of the client-supplied print-stream
- * pages.
- * <P>
- * For some document formats (such as {@code "application/postscript"}),
- * the desired orientation of the print-stream pages is specified within the
- * document data. This information is generated by a device driver prior to
- * the submission of the print job. Other document formats (such as
- * {@code "text/plain"}) do not include the notion of desired orientation
- * within the document data. In the latter case it is possible for the printer
- * to bind the desired orientation to the document data after it has been
- * submitted. It is expected that a printer would only support the
- * OrientationRequested attribute for some document formats (e.g.,
+ * Class {@code OrientationRequested} is a printing attribute class, an
+ * enumeration, that indicates the desired orientation for printed print-stream
+ * pages; it does not describe the orientation of the client-supplied
+ * print-stream pages.
+ * <p>
+ * For some document formats (such as {@code "application/postscript"}), the
+ * desired orientation of the print-stream pages is specified within the
+ * document data. This information is generated by a device driver prior to the
+ * submission of the print job. Other document formats (such as
+ * {@code "text/plain"}) do not include the notion of desired orientation within
+ * the document data. In the latter case it is possible for the printer to bind
+ * the desired orientation to the document data after it has been submitted. It
+ * is expected that a printer would only support the
+ * {@code OrientationRequested} attribute for some document formats (e.g.,
  * {@code "text/plain"} or {@code "text/html"}) but not others (e.g.
- * {@code "application/postscript"}). This is no different from any other
- * job template attribute, since a print job can always impose constraints
- * among the values of different job template attributes.
- *  However, a special mention
- * is made here since it is very likely that a printer will support the
- * OrientationRequested attribute for only a subset of the supported document
- * formats.
- * <P>
- * <B>IPP Compatibility:</B> The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * {@code "application/postscript"}). This is no different from any other job
+ * template attribute, since a print job can always impose constraints among the
+ * values of different job template attributes. However, a special mention is
+ * made here since it is very likely that a printer will support the
+ * {@code OrientationRequested} attribute for only a subset of the supported
+ * document formats.
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class OrientationRequested extends EnumSyntax
     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -4447437289862822276L;
 
     /**
@@ -73,11 +76,10 @@
         PORTRAIT = new OrientationRequested(3);
 
     /**
-     * The content will be imaged across the long edge of the medium.
-     * Landscape is defined to be a rotation of the print-stream page to be
-     * imaged by +90 degrees with respect to the medium
-     * (i.e. anti-clockwise) from the
-     * portrait orientation. <I>Note:</I> The +90 direction was chosen because
+     * The content will be imaged across the long edge of the medium. Landscape
+     * is defined to be a rotation of the print-stream page to be imaged by +90
+     * degrees with respect to the medium (i.e. anti-clockwise) from the
+     * portrait orientation. <i>Note:</i> The +90 direction was chosen because
      * simple finishing on the long edge is the same edge whether portrait or
      * landscape.
      */
@@ -85,13 +87,13 @@
         LANDSCAPE = new OrientationRequested(4);
 
     /**
-     * The content will be imaged across the long edge of the medium, but in
-     * the opposite manner from landscape. Reverse-landscape is defined to be
-     * a rotation of the print-stream page to be imaged by -90 degrees with
+     * The content will be imaged across the long edge of the medium, but in the
+     * opposite manner from landscape. Reverse-landscape is defined to be a
+     * rotation of the print-stream page to be imaged by -90 degrees with
      * respect to the medium (i.e. clockwise) from the portrait orientation.
-     * <I>Note:</I> The REVERSE_LANDSCAPE value was added because some
-     * applications rotate landscape -90 degrees from portrait, rather than
-     * +90 degrees.
+     * <i>Note:</i> The REVERSE_LANDSCAPE value was added because some
+     * applications rotate landscape -90 degrees from portrait, rather than +90
+     * degrees.
      */
     public static final OrientationRequested
         REVERSE_LANDSCAPE = new OrientationRequested(5);
@@ -100,14 +102,14 @@
      * The content will be imaged across the short edge of the medium, but in
      * the opposite manner from portrait. Reverse-portrait is defined to be a
      * rotation of the print-stream page to be imaged by 180 degrees with
-     * respect to the medium from the portrait orientation. <I>Note:</I> The
-     * REVERSE_PORTRAIT value was added for use with the {@link
-     * Finishings Finishings} attribute in cases where the
-     * opposite edge is desired for finishing a portrait document on simple
-     * finishing devices that have only one finishing position. Thus a
-     * {@code "text/plain"} portrait document can be stapled "on the
-     * right" by a simple finishing device as is common use with some
-     * Middle Eastern languages such as Hebrew.
+     * respect to the medium from the portrait orientation. <i>Note:</i> The
+     * REVERSE_PORTRAIT value was added for use with the
+     * {@link Finishings Finishings} attribute in cases where the opposite edge
+     * is desired for finishing a portrait document on simple finishing devices
+     * that have only one finishing position. Thus a {@code "text/plain"}
+     * portrait document can be stapled "on the right" by a simple finishing
+     * device as is common use with some Middle Eastern languages such as
+     * Hebrew.
      */
     public static final OrientationRequested
         REVERSE_PORTRAIT = new OrientationRequested(6);
@@ -116,12 +118,15 @@
      * Construct a new orientation requested enumeration value with the given
      * integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected OrientationRequested(int value) {
         super(value);
     }
 
+    /**
+     * The string table for class {@code OrientationRequested}.
+     */
     private static final String[] myStringTable = {
         "portrait",
         "landscape",
@@ -129,6 +134,9 @@
         "reverse-portrait"
     };
 
+    /**
+     * The enumeration value table for class {@code OrientationRequested}.
+     */
     private static final OrientationRequested[] myEnumValueTable = {
         PORTRAIT,
         LANDSCAPE,
@@ -137,21 +145,23 @@
     };
 
     /**
-     * Returns the string table for class OrientationRequested.
+     * Returns the string table for class {@code OrientationRequested}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class OrientationRequested.
+     * Returns the enumeration value table for class
+     * {@code OrientationRequested}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
     }
 
     /**
-     * Returns the lowest integer value used by class OrientationRequested.
+     * Returns the lowest integer value used by class
+     * {@code OrientationRequested}.
      */
     protected int getOffset() {
         return 3;
@@ -160,12 +170,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class OrientationRequested, the
-     * category is class OrientationRequested itself.
+     * <p>
+     * For class {@code OrientationRequested}, the category is class
+     * {@code OrientationRequested} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return OrientationRequested.class;
@@ -174,14 +184,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class OrientationRequested, the
-     * category name is {@code "orientation-requested"}.
+     * <p>
+     * For class {@code OrientationRequested}, the category name is
+     * {@code "orientation-requested"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "orientation-requested";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OutputDeviceAssigned.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OutputDeviceAssigned.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,46 +22,48 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class OutputDeviceAssigned is a printing attribute class, a text attribute,
- * that identifies the output device to which the service has assigned this
- * job. If an output device implements an embedded Print Service instance, the
- * printer need not set this attribute. If a print server implements a
- * Print Service instance, the value may be empty (zero- length string) or not
- * returned until the service assigns an output device to the job. This
- * attribute is particularly useful when a single service supports multiple
- * devices (so called "fan-out").
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * Class {@code OutputDeviceAssigned} is a printing attribute class, a text
+ * attribute, that identifies the output device to which the service has
+ * assigned this job. If an output device implements an embedded Print Service
+ * instance, the printer need not set this attribute. If a print server
+ * implements a Print Service instance, the value may be empty (zero- length
+ * string) or not returned until the service assigns an output device to the
+ * job. This attribute is particularly useful when a single service supports
+ * multiple devices (so called "fan-out").
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class OutputDeviceAssigned extends TextSyntax
     implements PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 5486733778854271081L;
 
     /**
      * Constructs a new output device assigned attribute with the given device
      * name and locale.
      *
-     * @param  deviceName  Device name.
-     * @param  locale      Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *   (unchecked exception) Thrown if {@code deviceName} is null.
+     * @param  deviceName device name
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code deviceName} is {@code null}
      */
     public OutputDeviceAssigned(String deviceName, Locale locale) {
 
@@ -74,23 +76,19 @@
      * Returns whether this output device assigned attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class OutputDeviceAssigned.
-     * <LI>
-     * This output device assigned attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This output device assigned attribute's locale and
-     * {@code object}'s locale are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code OutputDeviceAssigned}.
+     *   <li>This output device assigned attribute's underlying string and
+     *   {@code object}'s underlying string are equal.
+     *   <li>This output device assigned attribute's locale and {@code object}'s
+     *   locale are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this output
-     *          device assigned attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this output
+     *         device assigned attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -100,12 +98,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class OutputDeviceAssigned, the
-     * category is class OutputDeviceAssigned itself.
+     * <p>
+     * For class {@code OutputDeviceAssigned}, the category is class
+     * {@code OutputDeviceAssigned} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return OutputDeviceAssigned.class;
@@ -114,14 +112,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class OutputDeviceAssigned, the
-     * category name is {@code "output-device-assigned"}.
+     * <p>
+     * For class {@code OutputDeviceAssigned}, the category name is
+     * {@code "output-device-assigned"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "output-device-assigned";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PDLOverrideSupported.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PDLOverrideSupported.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,27 +30,29 @@
 import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PDLOverrideSupported is a printing attribute class, an enumeration,
- * that expresses the printer's ability to attempt to override processing
- * instructions embedded in documents' print data with processing instructions
- * specified as attributes outside the print data.
- * <P>
- * <B>IPP Compatibility:</B> The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * Class {@code PDLOverrideSupported} is a printing attribute class, an
+ * enumeration, that expresses the printer's ability to attempt to override
+ * processing instructions embedded in documents' print data with processing
+ * instructions specified as attributes outside the print data.
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class PDLOverrideSupported extends EnumSyntax
     implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -4393264467928463934L;
 
     /**
      * The printer makes no attempt to make the external job attribute values
-     * take precedence over embedded instructions in the documents' print
-     * data.
+     * take precedence over embedded instructions in the documents' print data.
      */
     public static final PDLOverrideSupported
         NOT_ATTEMPTED = new PDLOverrideSupported(0);
@@ -62,36 +65,42 @@
     public static final PDLOverrideSupported
         ATTEMPTED = new PDLOverrideSupported(1);
 
-
     /**
      * Construct a new PDL override supported enumeration value with the given
      * integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected PDLOverrideSupported(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code PDLOverrideSupported}.
+     */
     private static final String[] myStringTable = {
         "not-attempted",
         "attempted"
     };
 
+    /**
+     * The enumeration value table for class {@code PDLOverrideSupported}.
+     */
     private static final PDLOverrideSupported[] myEnumValueTable = {
         NOT_ATTEMPTED,
         ATTEMPTED
     };
 
     /**
-     * Returns the string table for class PDLOverrideSupported.
+     * Returns the string table for class {@code PDLOverrideSupported}.
      */
     protected String[] getStringTable() {
         return myStringTable.clone();
     }
 
     /**
-     * Returns the enumeration value table for class PDLOverrideSupported.
+     * Returns the enumeration value table for class
+     * {@code PDLOverrideSupported}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
@@ -100,12 +109,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PDLOverrideSupported and any vendor-defined subclasses, the
-     * category is class PDLOverrideSupported itself.
+     * <p>
+     * For class {@code PDLOverrideSupported} and any vendor-defined subclasses,
+     * the category is class {@code PDLOverrideSupported} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PDLOverrideSupported.class;
@@ -114,14 +123,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PDLOverrideSupported and any vendor-defined subclasses, the
-     * category name is {@code "pdl-override-supported"}.
+     * <p>
+     * For class {@code PDLOverrideSupported} and any vendor-defined subclasses,
+     * the category name is {@code "pdl-override-supported"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "pdl-override-supported";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PageRanges.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PageRanges.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -26,106 +26,93 @@
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
+import javax.print.attribute.PrintJobAttribute;
+import javax.print.attribute.PrintRequestAttribute;
 import javax.print.attribute.SetOfIntegerSyntax;
-import javax.print.attribute.DocAttribute;
-import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class PageRanges is a printing attribute class, a set of integers, that
- * identifies the range(s) of print-stream pages that the Printer object uses
- * for each copy of each document which are to be printed. Nothing is printed
- * for any pages identified that do not exist in the document(s). The attribute
- * is associated with <I>print-stream</I> pages, not application-numbered pages
- * (for example, the page numbers found in the headers and or footers for
- * certain word processing applications).
- * <P>
+ * Class {@code PageRanges} is a printing attribute class, a set of integers,
+ * that identifies the range(s) of print-stream pages that the Printer object
+ * uses for each copy of each document which are to be printed. Nothing is
+ * printed for any pages identified that do not exist in the document(s). The
+ * attribute is associated with <i>print-stream</i> pages, not
+ * application-numbered pages (for example, the page numbers found in the
+ * headers and or footers for certain word processing applications).
+ * <p>
  * In most cases, the exact pages to be printed will be generated by a device
  * driver and this attribute would not be required. However, when printing an
  * archived document which has already been formatted, the end user may elect to
  * print just a subset of the pages contained in the document. In this case, if
- * a page range of <code>"<I>n</I>-<I>m</I>"</code> is specified, the first page
- * to be printed will be page <I>n.</I> All subsequent pages of the document
- * will be printed through and including page <I>m.</I>
- * <P>
- * If a PageRanges attribute is not specified for a print job, all pages of
- * the document will be printed. In other words, the default value for the
- * PageRanges attribute is always {@code {{1, Integer.MAX_VALUE}}}.
- * <P>
- * The effect of a PageRanges attribute on a multidoc print job (a job with
- * multiple documents) depends on whether all the docs have the same page ranges
- * specified or whether different docs have different page ranges specified, and
- * on the (perhaps defaulted) value of the {@link MultipleDocumentHandling
- * MultipleDocumentHandling} attribute.
- * <UL>
- * <LI>
- * If all the docs have the same page ranges specified, then any value of {@link
- * MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the
- * printer's processing depends on the {@link MultipleDocumentHandling
- * MultipleDocumentHandling} value:
- * <UL>
- * <LI>
- * SINGLE_DOCUMENT -- All the input docs will be combined together into one
- * output document. The specified page ranges of that output document will be
- * printed.
+ * a page range of <code>"<i>n</i>-<i>m</i>"</code> is specified, the first page
+ * to be printed will be page <i>n.</i> All subsequent pages of the document
+ * will be printed through and including page <i>m.</i>
+ * <p>
+ * If a {@code PageRanges} attribute is not specified for a print job, all pages
+ * of the document will be printed. In other words, the default value for the
+ * {@code PageRanges} attribute is always {@code {{1, Integer.MAX_VALUE}}}.
+ * <p>
+ * The effect of a {@code PageRanges} attribute on a multidoc print job (a job
+ * with multiple documents) depends on whether all the docs have the same page
+ * ranges specified or whether different docs have different page ranges
+ * specified, and on the (perhaps defaulted) value of the
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute.
+ * <ul>
+ *   <li>If all the docs have the same page ranges specified, then any value of
+ *   {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense, and
+ *   the printer's processing depends on the
+ *   {@link MultipleDocumentHandling MultipleDocumentHandling} value:
+ *   <ul>
+ *     <li>{@code SINGLE_DOCUMENT} -- All the input docs will be combined
+ *     together into one output document. The specified page ranges of that
+ *     output document will be printed.
+ *     <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be
+ *     combined together into one output document, and the first impression of
+ *     each input doc will always start on a new media sheet. The specified page
+ *     ranges of that output document will be printed.
+ *     <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- For each separate
+ *     input doc, the specified page ranges will be printed.
+ *     <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- For each separate input
+ *     doc, the specified page ranges will be printed.
+ *   </ul>
+ *   <ul>
+ *     <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- For each separate
+ *     input doc, its own specified page ranges will be printed.
+ *     <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- For each separate input
+ *     doc, its own specified page ranges will be printed.
+ *   </ul>
+ * </ul>
+ * <p>
+ * <b>IPP Compatibility:</b> The PageRanges attribute's canonical array form
+ * gives the lower and upper bound for each range of pages to be included in and
+ * IPP "page-ranges" attribute. See class
+ * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical
+ * array form. The category name returned by {@code getName()} gives the IPP
+ * attribute name.
  *
- * <LI>
- * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
- * into one output document, and the first impression of each input doc will
- * always start on a new media sheet. The specified page ranges of that output
- * document will be printed.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- For each separate input doc, the
- * specified page ranges will be printed.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_COLLATED_COPIES -- For each separate input doc, the
- * specified page ranges will be printed.
- * </UL>
- * <UL>
- * <LI>
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- For each separate input doc, its own
- * specified page ranges will be printed..
- *
- * <LI>
- * SEPARATE_DOCUMENTS_COLLATED_COPIES -- For each separate input doc, its own
- * specified page ranges will be printed..
- * </UL>
- * </UL>
- * <P>
- * <B>IPP Compatibility:</B> The PageRanges attribute's canonical array form
- * gives the lower and upper bound for each range of pages to be included in
- * and IPP "page-ranges" attribute. See class {@link
- * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
- * explanation of canonical array form. The category name returned by
- * {@code getName()} gives the IPP attribute name.
- *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
  */
 public final class PageRanges   extends SetOfIntegerSyntax
         implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 8639895197656148392L;
 
-
     /**
-     * Construct a new page ranges attribute with the given members. The
-     * members are specified in "array form;" see class {@link
-     * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an
-     * explanation of array form.
-     *
-     * @param  members  Set members in array form.
+     * Construct a new page ranges attribute with the given members. The members
+     * are specified in "array form;" see class
+     * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of array
+     * form.
      *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code members} is null or
-     *     any element of {@code members} is null.
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if any element of
-     *   {@code members} is not a length-one or length-two array. Also
-     *     thrown if {@code members} is a zero-length array or if any
-     *     member of the set is less than 1.
+     * @param  members set members in array form
+     * @throws NullPointerException if {@code members} is {@code null} or any
+     *         element of {@code members} is {@code null}
+     * @throws IllegalArgumentException if any element of {@code members} is not
+     *         a length-one or length-two array. Also if {@code members} is a
+     *         zero-length array or if any member of the set is less than 1.
      */
     public PageRanges(int[][] members) {
         super (members);
@@ -134,24 +121,18 @@
         }
         myPageRanges();
     }
+
     /**
-     * Construct a new  page ranges attribute with the given members in
-     * string form.
-     * See class {@link javax.print.attribute.SetOfIntegerSyntax
-     * SetOfIntegerSyntax}
-     * for explanation of the syntax.
-     *
-     * @param  members  Set members in string form.
+     * Construct a new page ranges attribute with the given members in string
+     * form. See class {@link SetOfIntegerSyntax SetOfIntegerSyntax} for
+     * explanation of the syntax.
      *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code members} is null or
-     *     any element of {@code members} is null.
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if {@code members} does not
-     *    obey  the proper syntax.  Also
-     *     thrown if the constructed set-of-integer is a
-     *     zero-length array or if any
-     *     member of the set is less than 1.
+     * @param  members set members in string form
+     * @throws NullPointerException if {@code members} is {@code null} or any
+     * element of {@code members} is {@code null}
+     * @throws IllegalArgumentException if {@code members} does not obey the
+     *         proper syntax. Also if the constructed set-of-integer is a
+     *         zero-length array or if any member of the set is less than 1.
      */
     public PageRanges(String members) {
         super(members);
@@ -161,6 +142,9 @@
         myPageRanges();
     }
 
+    /**
+     * Validates the page ranges.
+     */
     private void myPageRanges() {
         int[][] myMembers = getMembers();
         int n = myMembers.length;
@@ -179,11 +163,8 @@
      * Construct a new page ranges attribute containing a single integer. That
      * is, only the one page is to be printed.
      *
-     * @param  member  Set member.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if {@code member} is less than
-     *     1.
+     * @param  member set member
+     * @throws IllegalArgumentException if {@code member < 1}
      */
     public PageRanges(int member) {
         super (member);
@@ -196,13 +177,11 @@
      * Construct a new page ranges attribute containing a single range of
      * integers. That is, only those pages in the one range are to be printed.
      *
-     * @param  lowerBound  Lower bound of the range.
-     * @param  upperBound  Upper bound of the range.
-     *
-     * @exception  IllegalArgumentException
-     *     (Unchecked exception) Thrown if a null range is specified or if a
-     *     non-null range is specified with {@code lowerBound} less than
-     *     1.
+     * @param  lowerBound lower bound of the range
+     * @param  upperBound upper bound of the range
+     * @throws IllegalArgumentException if a {@code null} range is specified or
+     *         if a {@code non-null} range is specified with {@code lowerBound}
+     *         less than 1
      */
     public PageRanges(int lowerBound, int upperBound) {
         super (lowerBound, upperBound);
@@ -214,23 +193,18 @@
     }
 
     /**
-     * Returns whether this page ranges attribute is equivalent to the passed
-     * in object. To be equivalent, all of the following conditions must be
-     * true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PageRanges.
-     * <LI>
-     * This page ranges attribute's members and {@code object}'s members
-     * are the same.
-     * </OL>
+     * Returns whether this page ranges attribute is equivalent to the passed in
+     * object. To be equivalent, all of the following conditions must be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PageRanges}.
+     *   <li>This page ranges attribute's members and {@code object}'s members
+     *   are the same.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this page ranges
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this page ranges
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) && object instanceof PageRanges);
@@ -239,11 +213,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PageRanges, the category is class PageRanges itself.
+     * <p>
+     * For class {@code PageRanges}, the category is class
+     * {@code PageRanges} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PageRanges.class;
@@ -252,13 +227,12 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PageRanges, the category name is {@code "page-ranges"}.
+     * <p>
+     * For class {@code PageRanges}, the category name is {@code "page-ranges"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "page-ranges";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinute.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinute.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,32 +30,31 @@
 import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PagesPerMinute is an integer valued printing attribute that indicates
- * the nominal number of pages per minute to the nearest whole number which may
- * be generated by this printer (e.g., simplex, black-and-white). This attribute
- * is informative, not a service guarantee. Generally, it is the value used in
- * the marketing literature to describe the device. A value of 0 indicates a
- * device that takes more than two minutes to process a page.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * Class {@code PagesPerMinute} is an integer valued printing attribute that
+ * indicates the nominal number of pages per minute to the nearest whole number
+ * which may be generated by this printer (e.g., simplex, black-and-white). This
+ * attribute is informative, not a service guarantee. Generally, it is the value
+ * used in the marketing literature to describe the device. A value of 0
+ * indicates a device that takes more than two minutes to process a page.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PagesPerMinute extends IntegerSyntax
         implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -6366403993072862015L;
 
     /**
-     * Construct a new pages per minute attribute with the given integer
-     * value.
+     * Construct a new pages per minute attribute with the given integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public PagesPerMinute(int value) {
         super(value, 0, Integer.MAX_VALUE);
@@ -62,22 +62,18 @@
 
     /**
      * Returns whether this pages per minute attribute is equivalent to the
-     * passed in object. To be equivalent, all of the following conditions
-     * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PagesPerMinute.
-     * <LI>
-     * This pages per minute attribute's value and {@code object}'s
-     * value are equal.
-     * </OL>
+     * passed in object. To be equivalent, all of the following conditions must
+     * be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PagesPerMinute}.
+     *   <li>This pages per minute attribute's value and {@code object}'s value
+     *   are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this pages per
-     *          minute attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this pages per
+     *         minute attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -87,11 +83,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PagesPerMinute, the category is class PagesPerMinute itself.
+     * <p>
+     * For class {@code PagesPerMinute}, the category is class
+     * {@code PagesPerMinute} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PagesPerMinute.class;
@@ -100,14 +97,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PagesPerMinute, the
-     * category name is {@code "pages-per-minute"}.
+     * <p>
+     * For class {@code PagesPerMinute}, the category name is
+     * {@code "pages-per-minute"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "pages-per-minute";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinuteColor.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinuteColor.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,43 +30,44 @@
 import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PagesPerMinuteColor is an integer valued printing attribute that
- * indicates the nominal number of pages per minute to the nearest whole number
- * which may be generated by this printer when printing color (e.g., simplex,
- * color). For purposes of this attribute, "color" means the same as for the
- * {@link ColorSupported ColorSupported} attribute, namely, the device is
- * capable of any type of color printing at all, including highlight color as
+ * Class {@code PagesPerMinuteColor} is an integer valued printing attribute
+ * that indicates the nominal number of pages per minute to the nearest whole
+ * number which may be generated by this printer when printing color (e.g.,
+ * simplex, color). For purposes of this attribute, "color" means the same as
+ * for the {@link ColorSupported ColorSupported} attribute, namely, the device
+ * is capable of any type of color printing at all, including highlight color as
  * well as full process color. This attribute is informative, not a service
  * guarantee. Generally, it is the value used in the marketing literature to
  * describe the color capabilities of this device. A value of 0 indicates a
  * device that takes more than two minutes to process a page. If a color device
  * has several color modes, it may use the pages-per- minute value for this
  * attribute that corresponds to the mode that produces the highest number.
- * <P>
- * A black and white only printer must not include the PagesPerMinuteColor
- * attribute in its attribute set or service registration. If this attribute is
- * present, then the {@link ColorSupported ColorSupported} printer description
- * attribute must also be present and have a value of SUPPORTED.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value. The
- * category name returned by {@code getName()} gives the IPP attribute
- * name.
+ * <p>
+ * A black and white only printer must not include the
+ * {@code PagesPerMinuteColor} attribute in its attribute set or service
+ * registration. If this attribute is present, then the
+ * {@link ColorSupported ColorSupported} printer description attribute must also
+ * be present and have a value of {@code SUPPORTED}.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PagesPerMinuteColor extends IntegerSyntax
         implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     static final long serialVersionUID = 1684993151687470944L;
 
     /**
      * Construct a new pages per minute color attribute with the given integer
      * value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *    (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public PagesPerMinuteColor(int value) {
         super(value, 0, Integer.MAX_VALUE);
@@ -75,20 +77,16 @@
      * Returns whether this pages per minute color attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PagesPerMinuteColor.
-     * <LI>
-     * This pages per minute attribute's value and {@code object}'s
-     * value are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PagesPerMinuteColor}.
+     *   <li>This pages per minute attribute's value and {@code object}'s value
+     *   are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this pages per
-     *          minute color attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this pages per
+     *         minute color attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) &&
@@ -98,12 +96,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PagesPerMinuteColor, the
-     * category is class PagesPerMinuteColor itself.
+     * <p>
+     * For class {@code PagesPerMinuteColor}, the category is class
+     * {@code PagesPerMinuteColor} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PagesPerMinuteColor.class;
@@ -112,14 +110,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PagesPerMinuteColor, the
-     * category name is {@code "pages-per-minute-color"}.
+     * <p>
+     * For class {@code PagesPerMinuteColor}, the category name is
+     * {@code "pages-per-minute-color"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "pages-per-minute-color";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PresentationDirection.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PresentationDirection.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, 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
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -30,81 +31,84 @@
 import javax.print.attribute.PrintRequestAttribute;
 
 /**
- * Class PresentationDirection is a printing attribute class, an enumeration,
- * that is used in conjunction with the {@link  NumberUp NumberUp} attribute to
- * indicate the layout of multiple print-stream pages to impose upon a
- * single side of an instance of a selected medium.
- * This is useful to mirror the text layout conventions of different scripts.
- * For example, English is "toright-tobottom", Hebrew is "toleft-tobottom"
- *  and Japanese is usually "tobottom-toleft".
- * <P>
- * <B>IPP Compatibility:</B>  This attribute is not an IPP 1.1
- * attribute; it is an attribute in the Production Printing Extension
- * (<a href="ftp://ftp.pwg.org/pub/pwg/standards/pwg5100.3.pdf">PDF</a>)
- * of IPP 1.1.  The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * Class {@code PresentationDirection} is a printing attribute class, an
+ * enumeration, that is used in conjunction with the {@link NumberUp NumberUp}
+ * attribute to indicate the layout of multiple print-stream pages to impose
+ * upon a single side of an instance of a selected medium. This is useful to
+ * mirror the text layout conventions of different scripts. For example, English
+ * is "toright-tobottom", Hebrew is "toleft-tobottom" and Japanese is usually
+ * "tobottom-toleft".
+ * <p>
+ * <b>IPP Compatibility:</b> This attribute is not an IPP 1.1 attribute; it is
+ * an attribute in the Production Printing Extension
+ * (<a href="ftp://ftp.pwg.org/pub/pwg/standards/pwg5100.3.pdf">PDF</a>) of IPP
+ * 1.1. The category name returned by {@code getName()} is the IPP attribute
+ * name. The enumeration's integer value is the IPP enum value. The
+ * {@code toString()} method returns the IPP string representation of the
+ * attribute value.
  *
- * @author  Phil Race.
+ * @author Phil Race
  */
 public final class PresentationDirection extends EnumSyntax
        implements PrintJobAttribute, PrintRequestAttribute  {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 8294728067230931780L;
 
     /**
-     * Pages are laid out in columns starting at the top left,
-     * proceeding towards the bottom {@literal &} right.
+     * Pages are laid out in columns starting at the top left, proceeding
+     * towards the bottom {@literal &} right.
      */
     public static final PresentationDirection TOBOTTOM_TORIGHT =
         new PresentationDirection(0);
 
     /**
-     * Pages are laid out in columns starting at the top right,
-     * proceeding towards the bottom {@literal &} left.
+     * Pages are laid out in columns starting at the top right, proceeding
+     * towards the bottom {@literal &} left.
      */
     public static final PresentationDirection TOBOTTOM_TOLEFT =
         new PresentationDirection(1);
 
     /**
-     * Pages are laid out in columns starting at the bottom left,
-     * proceeding towards the top {@literal &} right.
+     * Pages are laid out in columns starting at the bottom left, proceeding
+     * towards the top {@literal &} right.
      */
     public static final PresentationDirection TOTOP_TORIGHT =
         new PresentationDirection(2);
 
     /**
-     * Pages are laid out in columns starting at the bottom right,
-     * proceeding towards the top {@literal &} left.
+     * Pages are laid out in columns starting at the bottom right, proceeding
+     * towards the top {@literal &} left.
      */
     public static final PresentationDirection TOTOP_TOLEFT =
         new PresentationDirection(3);
 
     /**
-     * Pages are laid out in rows starting at the top left,
-     * proceeding towards the right {@literal &} bottom.
+     * Pages are laid out in rows starting at the top left, proceeding towards
+     * the right {@literal &} bottom.
      */
     public static final PresentationDirection TORIGHT_TOBOTTOM =
         new PresentationDirection(4);
 
     /**
-     * Pages are laid out in rows starting at the bottom left,
-     * proceeding towards the right {@literal &} top.
+     * Pages are laid out in rows starting at the bottom left, proceeding
+     * towards the right {@literal &} top.
      */
     public static final PresentationDirection TORIGHT_TOTOP =
         new PresentationDirection(5);
 
     /**
-     * Pages are laid out in rows starting at the top right,
-     * proceeding towards the left {@literal &} bottom.
+     * Pages are laid out in rows starting at the top right, proceeding towards
+     * the left {@literal &} bottom.
      */
     public static final PresentationDirection TOLEFT_TOBOTTOM =
         new PresentationDirection(6);
 
     /**
-     * Pages are laid out in rows starting at the bottom right,
-     * proceeding towards the left {@literal &} top.
+     * Pages are laid out in rows starting at the bottom right, proceeding
+     * towards the left {@literal &} top.
      */
     public static final PresentationDirection TOLEFT_TOTOP =
         new PresentationDirection(7);
@@ -113,12 +117,15 @@
      * Construct a new presentation direction enumeration value with the given
      * integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     private PresentationDirection(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code PresentationDirection}.
+     */
     private static final String[] myStringTable = {
         "tobottom-toright",
         "tobottom-toleft",
@@ -130,6 +137,9 @@
         "toleft-totop",
     };
 
+    /**
+     * The enumeration value table for class {@code PresentationDirection}.
+     */
     private static final PresentationDirection[] myEnumValueTable = {
         TOBOTTOM_TORIGHT,
         TOBOTTOM_TOLEFT,
@@ -142,14 +152,15 @@
     };
 
     /**
-     * Returns the string table for class PresentationDirection.
+     * Returns the string table for class {@code PresentationDirection}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class PresentationDirection.
+     * Returns the enumeration value table for class
+     * {@code PresentationDirection}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
@@ -158,12 +169,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PresentationDirection
-     * the category is class PresentationDirection itself.
+     * <p>
+     * For class {@code PresentationDirection} the category is class
+     * {@code PresentationDirection} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PresentationDirection.class;
@@ -172,14 +183,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PresentationDirection
-     * the category name is {@code "presentation-direction"}.
+     * <p>
+     * For class {@code PresentationDirection} the category name is
+     * {@code "presentation-direction"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "presentation-direction";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrintQuality.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrintQuality.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,30 +22,35 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.DocAttribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class PrintQuality is a printing attribute class, an enumeration,
+ * Class {@code PrintQuality} is a printing attribute class, an enumeration,
  * that specifies the print quality that the printer uses for the job.
- * <P>
- * <B>IPP Compatibility:</B> The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
  */
 public class PrintQuality extends EnumSyntax
     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -3072341285225858365L;
+
     /**
      * Lowest quality available on the printer.
      */
@@ -65,18 +70,24 @@
      * Construct a new print quality enumeration value with the given integer
      * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected PrintQuality(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code PrintQuality}.
+     */
     private static final String[] myStringTable = {
         "draft",
         "normal",
         "high"
     };
 
+    /**
+     * The enumeration value table for class {@code PrintQuality}.
+     */
     private static final PrintQuality[] myEnumValueTable = {
         DRAFT,
         NORMAL,
@@ -84,21 +95,21 @@
     };
 
     /**
-     * Returns the string table for class PrintQuality.
+     * Returns the string table for class {@code PrintQuality}.
      */
     protected String[] getStringTable() {
         return myStringTable.clone();
     }
 
     /**
-     * Returns the enumeration value table for class PrintQuality.
+     * Returns the enumeration value table for class {@code PrintQuality}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
     }
 
     /**
-     * Returns the lowest integer value used by class PrintQuality.
+     * Returns the lowest integer value used by class {@code PrintQuality}.
      */
     protected int getOffset() {
         return 3;
@@ -107,12 +118,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrintQuality and any vendor-defined subclasses, the category is
-     * class PrintQuality itself.
+     * <p>
+     * For class {@code PrintQuality} and any vendor-defined subclasses, the
+     * category is class {@code PrintQuality} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrintQuality.class;
@@ -121,14 +132,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrintQuality and any vendor-defined subclasses, the category
-     * name is {@code "print-quality"}.
+     * <p>
+     * For class {@code PrintQuality} and any vendor-defined subclasses, the
+     * category name is {@code "print-quality"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "print-quality";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterInfo.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterInfo.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,45 +22,47 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterInfo is a printing attribute class, a text attribute, that
- * provides descriptive information about a printer. This could include things
- * like: {@code "This printer can be used for printing color transparencies for
- * HR presentations"}, or {@code "Out of courtesy for others, please
- * print only small (1-5 page) jobs at this printer"}, or even
+ * Class {@code PrinterInfo} is a printing attribute class, a text attribute,
+ * that provides descriptive information about a printer. This could include
+ * things like: {@code "This printer can be used for printing color
+ * transparencies for HR presentations"}, or {@code "Out of courtesy for others,
+ * please print only small (1-5 page) jobs at this printer"}, or even
  * {@code "This printer is going away on July 1, 1997, please find a new
  * printer"}.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
- * locale gives the IPP natural language. The category name returned by
- * {@code getName()} gives the IPP attribute name.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
+ * locale gives the IPP natural language. The category name returned by {@code
+ * getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterInfo extends TextSyntax
         implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 7765280618777599727L;
 
     /**
-     * Constructs a new printer info attribute with the given information
-     * string and locale.
+     * Constructs a new printer info attribute with the given information string
+     * and locale.
      *
-     * @param  info    Printer information string.
-     * @param  locale  Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code info} is null.
+     * @param  info printer information string
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code info} is {@code null}
      */
     public PrinterInfo(String info, Locale locale) {
         super (info, locale);
@@ -70,23 +72,18 @@
      * Returns whether this printer info attribute is equivalent to the passed
      * in object. To be equivalent, all of the following conditions must be
      * true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PrinterInfo.
-     * <LI>
-     * This printer info attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This printer info attribute's locale and {@code object}'s
-     * locale are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PrinterInfo}.
+     *   <li>This printer info attribute's underlying string and
+     *   {@code object}'s underlying string are equal.
+     *   <li>This printer info attribute's locale and {@code object}'s locale
+     *   are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this printer
-     *          info attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this printer info
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) && object instanceof PrinterInfo);
@@ -95,11 +92,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterInfo, the category is class PrinterInfo itself.
+     * <p>
+     * For class {@code PrinterInfo}, the category is class
+     * {@code PrinterInfo} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterInfo.class;
@@ -108,13 +106,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterInfo, the category name is {@code "printer-info"}.
+     * <p>
+     * For class {@code PrinterInfo}, the category name is
+     * {@code "printer-info"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-info";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterIsAcceptingJobs.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterIsAcceptingJobs.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,26 +30,30 @@
 import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterIsAcceptingJobs is a printing attribute class, an enumeration,
- * that indicates whether the printer is currently able to accept jobs. This
- * value is independent of the {@link PrinterState PrinterState} and {@link
- * PrinterStateReasons PrinterStateReasons} attributes because its value does
- * not affect the current job; rather it affects future jobs. If the value is
- * NOT_ACCEPTING_JOBS, the printer will reject jobs even when the {@link
- * PrinterState PrinterState} is IDLE. If value is ACCEPTING_JOBS, the Printer
- * will accept jobs even when the {@link PrinterState PrinterState} is STOPPED.
- * <P>
- * <B>IPP Compatibility:</B> The IPP boolean value is "true" for ACCEPTING_JOBS
- * and "false" for NOT_ACCEPTING_JOBS. The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * Class {@code PrinterIsAcceptingJobs} is a printing attribute class, an
+ * enumeration, that indicates whether the printer is currently able to accept
+ * jobs. This value is independent of the {@link PrinterState PrinterState} and
+ * {@link PrinterStateReasons PrinterStateReasons} attributes because its value
+ * does not affect the current job; rather it affects future jobs. If the value
+ * is {@code NOT_ACCEPTING_JOBS}, the printer will reject jobs even when the
+ * {@link PrinterState PrinterState} is {@code IDLE}. If value is
+ * {@code ACCEPTING_JOBS}, the Printer will accept jobs even when the
+ * {@link PrinterState PrinterState} is {@code STOPPED}.
+ * <p>
+ * <b>IPP Compatibility:</b> The IPP boolean value is "true" for
+ * {@code ACCEPTING_JOBS} and "false" for {@code NOT_ACCEPTING_JOBS}. The
+ * category name returned by {@code getName()} is the IPP attribute name. The
+ * enumeration's integer value is the IPP enum value. The {@code toString()}
+ * method returns the IPP string representation of the attribute value.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterIsAcceptingJobs extends EnumSyntax
         implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -5052010680537678061L;
 
     /**
@@ -67,31 +72,38 @@
      * Construct a new printer is accepting jobs enumeration value with the
      * given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected PrinterIsAcceptingJobs(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code PrinterIsAcceptingJobs}.
+     */
     private static final String[] myStringTable = {
         "not-accepting-jobs",
         "accepting-jobs"
     };
 
+    /**
+     * The enumeration value table for class {@code PrinterIsAcceptingJobs}.
+     */
     private static final PrinterIsAcceptingJobs[] myEnumValueTable = {
         NOT_ACCEPTING_JOBS,
         ACCEPTING_JOBS
     };
 
     /**
-     * Returns the string table for class PrinterIsAcceptingJobs.
+     * Returns the string table for class {@code PrinterIsAcceptingJobs}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class PrinterIsAcceptingJobs.
+     * Returns the enumeration value table for class
+     * {@code PrinterIsAcceptingJobs}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
@@ -100,12 +112,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterIsAcceptingJobs, the
-     * category is class PrinterIsAcceptingJobs itself.
+     * <p>
+     * For class {@code PrinterIsAcceptingJobs}, the category is class
+     * {@code PrinterIsAcceptingJobs} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterIsAcceptingJobs.class;
@@ -114,14 +126,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterIsAcceptingJobs, the
-     * category name is {@code "printer-is-accepting-jobs"}.
+     * <p>
+     * For class {@code PrinterIsAcceptingJobs}, the category name is
+     * {@code "printer-is-accepting-jobs"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-is-accepting-jobs";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterLocation.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterLocation.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,41 +22,43 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterLocation is a printing attribute class, a text attribute, that
- * identifies the location of the device. This could include things like:
- * {@code "in Room 123A, second floor of building XYZ"}.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * Class {@code PrinterLocation} is a printing attribute class, a text
+ * attribute, that identifies the location of the device. This could include
+ * things like: {@code "in Room 123A, second floor of building XYZ"}.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterLocation extends TextSyntax
     implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -1598610039865566337L;
 
     /**
      * Constructs a new printer location attribute with the given location and
      * locale.
      *
-     * @param  location  Printer location.
-     * @param  locale    Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code location} is null.
+     * @param  location printer location
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code location} is {@code null}
      */
     public PrinterLocation(String location, Locale locale) {
         super (location, locale);
@@ -64,25 +66,20 @@
 
     /**
      * Returns whether this printer location attribute is equivalent to the
-     * passed in object. To be equivalent, all of the following conditions
-     * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PrinterLocation.
-     * <LI>
-     * This printer location attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This printer location attribute's locale and {@code object}'s
-     * locale are equal.
-     * </OL>
+     * passed in object. To be equivalent, all of the following conditions must
+     * be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PrinterLocation}.
+     *   <li>This printer location attribute's underlying string and
+     *   {@code object}'s underlying string are equal.
+     *   <li>This printer location attribute's locale and {@code object}'s
+     *   locale are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this printer
-     *          location attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this printer
+     *         location attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) && object instanceof PrinterLocation);
@@ -91,12 +88,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterLocation, the
-     * category is class PrinterLocation itself.
+     * <p>
+     * For class {@code PrinterLocation}, the category is class
+     * {@code PrinterLocation} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterLocation.class;
@@ -105,14 +102,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterLocation, the
-     * category name is {@code "printer-location"}.
+     * <p>
+     * For class {@code PrinterLocation}, the category name is
+     * {@code "printer-location"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-location";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMakeAndModel.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMakeAndModel.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,39 +22,42 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
+
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterMakeAndModel is a printing attribute class, a text attribute,
- * that the make and model of the printer.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * Class {@code PrinterMakeAndModel} is a printing attribute class, a text
+ * attribute, that the make and model of the printer.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterMakeAndModel extends TextSyntax
         implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 4580461489499351411L;
 
     /**
-     * Constructs a new printer make and model attribute with the given make
-     * and model string and locale.
+     * Constructs a new printer make and model attribute with the given make and
+     * model string and locale.
      *
-     * @param  makeAndModel  Printer make and model string.
-     * @param  locale        Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *    (unchecked exception) Thrown if {@code makeAndModel} is null.
+     * @param  makeAndModel printer make and model string
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code makeAndModel} is {@code null}
      */
     public PrinterMakeAndModel(String makeAndModel, Locale locale) {
         super (makeAndModel, locale);
@@ -64,23 +67,18 @@
      * Returns whether this printer make and model attribute is equivalent to
      * the passed in object. To be equivalent, all of the following conditions
      * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PrinterMakeAndModel.
-     * <LI>
-     * This printer make and model attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This printer make and model attribute's locale and
-     * {@code object}'s locale are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PrinterMakeAndModel}.
+     *   <li>This printer make and model attribute's underlying string and
+     *   {@code object}'s underlying string are equal.
+     *   <li>This printer make and model attribute's locale and {@code object}'s
+     *   locale are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this printer
-     *          make and model attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this printer make
+     *         and model attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) &&
@@ -90,12 +88,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterMakeAndModel, the
-     * category is class PrinterMakeAndModel itself.
+     * <p>
+     * For class {@code PrinterMakeAndModel}, the category is class
+     * {@code PrinterMakeAndModel} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterMakeAndModel.class;
@@ -104,14 +102,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterMakeAndModel, the
-     * category name is {@code "printer-make-and-model"}.
+     * <p>
+     * For class {@code PrinterMakeAndModel}, the category name is
+     * {@code "printer-make-and-model"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-make-and-model";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMessageFromOperator.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMessageFromOperator.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,54 +22,54 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterMessageFromOperator is a printing attribute class, a text
- * attribute, that provides a message from an operator, system administrator,
- * or "intelligent" process to indicate to the end user information about or
- * status of the printer, such as why it is unavailable or when it is
- * expected to be available.
- * <P>
- * A Print Service's attribute set includes zero instances or one instance of
- * a
- * PrinterMessageFromOperator attribute, not more than one instance. A new
- * PrinterMessageFromOperator attribute replaces an existing
- * PrinterMessageFromOperator attribute, if any. In other words,
- * PrinterMessageFromOperator is not intended to be a history log.
- * If it wishes, the client can detect changes to a Print Service's
- * PrinterMessageFromOperator
- * attribute and maintain the client's own history log of the
- * PrinterMessageFromOperator attribute values.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * Class {@code PrinterMessageFromOperator} is a printing attribute class, a
+ * text attribute, that provides a message from an operator, system
+ * administrator, or "intelligent" process to indicate to the end user
+ * information about or status of the printer, such as why it is unavailable or
+ * when it is expected to be available.
+ * <p>
+ * A Print Service's attribute set includes zero instances or one instance of a
+ * {@code PrinterMessageFromOperator} attribute, not more than one instance. A
+ * new {@code PrinterMessageFromOperator} attribute replaces an existing
+ * {@code PrinterMessageFromOperator} attribute, if any. In other words,
+ * {@code PrinterMessageFromOperator} is not intended to be a history log. If it
+ * wishes, the client can detect changes to a Print Service's
+ * {@code PrinterMessageFromOperator} attribute and maintain the client's own
+ * history log of the {@code PrinterMessageFromOperator} attribute values.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterMessageFromOperator   extends TextSyntax
     implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     static final long serialVersionUID = -4486871203218629318L;
 
     /**
-     * Constructs a new printer message from operator attribute with the
-     * given message and locale.
+     * Constructs a new printer message from operator attribute with the given
+     * message and locale.
      *
-     * @param  message  Message.
-     * @param  locale   Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code message} is null.
+     * @param  message the message
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code message} is {@code null}
      */
     public PrinterMessageFromOperator(String message, Locale locale) {
         super (message, locale);
@@ -79,24 +79,19 @@
      * Returns whether this printer message from operator attribute is
      * equivalent to the passed in object. To be equivalent, all of the
      * following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class
-     * PrinterMessageFromOperator.
-     * <LI>
-     * This printer message from operator attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This printer message from operator attribute's locale and
-     * {@code object}'s locale are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code PrinterMessageFromOperator}.
+     *   <li>This printer message from operator attribute's underlying string
+     *   and {@code object}'s underlying string are equal.
+     *   <li>This printer message from operator attribute's locale and
+     *   {@code object}'s locale are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this printer
-     *          message from operator attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this printer
+     *         message from operator attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) &&
@@ -106,12 +101,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterMessageFromOperator,
-     * the category is class PrinterMessageFromOperator itself.
+     * <p>
+     * For class {@code PrinterMessageFromOperator}, the category is class
+     * {@code PrinterMessageFromOperator} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterMessageFromOperator.class;
@@ -120,14 +115,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterMessageFromOperator,
-     * the category name is {@code "printer-message-from-operator"}.
+     * <p>
+     * For class {@code PrinterMessageFromOperator}, the category name is
+     * {@code "printer-message-from-operator"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-message-from-operator";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfo.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfo.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,48 +22,50 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.net.URI;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.URISyntax;
-import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterMoreInfo is a printing attribute class, a URI, that is used to
- * obtain more information about this specific printer. For example, this
- * could be an HTTP type URI referencing an HTML page accessible to a web
- * browser. The information obtained from this URI is intended for end user
- * consumption. Features outside the scope of the Print Service API can be
- * accessed from this URI.
- * The information is intended to be specific to this printer instance and
- * site specific services (e.g. job pricing, services offered, end user
- * assistance).
- * <P>
- * In contrast, the {@link PrinterMoreInfoManufacturer
- * PrinterMoreInfoManufacturer} attribute is used to find out more information
- * about this general kind of printer rather than this specific printer.
- * <P>
- * <B>IPP Compatibility:</B> The string form returned by
- * {@code toString()}  gives the IPP uri value.
- * The category name returned by {@code getName()}
+ * Class {@code PrinterMoreInfo} is a printing attribute class, a {@code URI},
+ * that is used to obtain more information about this specific printer. For
+ * example, this could be an HTTP type {@code URI} referencing an HTML page
+ * accessible to a web browser. The information obtained from this {@code URI}
+ * is intended for end user consumption. Features outside the scope of the Print
+ * Service API can be accessed from this {@code URI}. The information is
+ * intended to be specific to this printer instance and site specific services
+ * (e.g. job pricing, services offered, end user assistance).
+ * <p>
+ * In contrast, the
+ * {@link PrinterMoreInfoManufacturer PrinterMoreInfoManufacturer} attribute is
+ * used to find out more information about this general kind of printer rather
+ * than this specific printer.
+ * <p>
+ * <b>IPP Compatibility:</b> The string form returned by {@code toString()}
+ * gives the IPP uri value. The category name returned by {@code getName()}
  * gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterMoreInfo extends URISyntax
         implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 4555850007675338574L;
 
     /**
-     * Constructs a new printer more info attribute with the specified URI.
+     * Constructs a new printer more info attribute with the specified
+     * {@code URI}.
      *
-     * @param  uri  URI.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code uri} is null.
+     * @param  uri {@code URI}
+     * @throws NullPointerException if {@code uri} is {@code null}
      */
     public PrinterMoreInfo(URI uri) {
         super (uri);
@@ -71,22 +73,18 @@
 
     /**
      * Returns whether this printer more info attribute is equivalent to the
-     * passed in object. To be equivalent, all of the following conditions
-     * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PrinterMoreInfo.
-     * <LI>
-     * This printer more info attribute's URI and {@code object}'s URI
-     * are equal.
-     * </OL>
+     * passed in object. To be equivalent, all of the following conditions must
+     * be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PrinterMoreInfo}.
+     *   <li>This printer more info attribute's {@code URI} and {@code object}'s
+     *   {@code URI} are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this printer
-     *          more info attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this printer more
+     *         info attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) &&
@@ -96,11 +94,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterMoreInfo, the category is class PrinterMoreInfo itself.
+     * <p>
+     * For class {@code PrinterMoreInfo}, the category is class
+     * {@code PrinterMoreInfo} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterMoreInfo.class;
@@ -109,14 +108,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterMoreInfo, the
-     * category name is {@code "printer-more-info"}.
+     * <p>
+     * For class {@code PrinterMoreInfo}, the category name is
+     * {@code "printer-more-info"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-more-info";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,49 +22,49 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.net.URI;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.URISyntax;
-import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterMoreInfoManufacturer is a printing attribute class, a URI,
- * that is used to obtain more information about this type of device.
- * The information obtained from this URI is intended for end user
- * consumption. Features outside the scope of the Print Service API
- * can be accessed from this URI (e.g.,
- * latest firmware, upgrades, service proxies, optional features available,
- * details on color support). The information is intended to be germane to
- * this kind of printer without regard to site specific modifications or
- * services.
- * <P>
- * In contrast, the {@link PrinterMoreInfo PrinterMoreInfo} attribute is used
- * to find out more information about this specific printer rather than this
+ * Class {@code PrinterMoreInfoManufacturer} is a printing attribute class, a
+ * {@code URI}, that is used to obtain more information about this type of
+ * device. The information obtained from this {@code URI} is intended for end
+ * user consumption. Features outside the scope of the Print Service API can be
+ * accessed from this {@code URI} (e.g., latest firmware, upgrades, service
+ * proxies, optional features available, details on color support). The
+ * information is intended to be germane to this kind of printer without regard
+ * to site specific modifications or services.
+ * <p>
+ * In contrast, the {@link PrinterMoreInfo PrinterMoreInfo} attribute is used to
+ * find out more information about this specific printer rather than this
  * general kind of printer.
- * <P>
- * <B>IPP Compatibility:</B> The string form returned by
- * {@code toString()} gives the IPP uri value.
- * The category name returned by {@code getName()}
+ * <p>
+ * <b>IPP Compatibility:</b> The string form returned by {@code toString()}
+ * gives the IPP uri value. The category name returned by {@code getName()}
  * gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterMoreInfoManufacturer extends URISyntax
         implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 3323271346485076608L;
 
     /**
      * Constructs a new printer more info manufacturer attribute with the
-     * specified URI.
+     * specified {@code URI}.
      *
-     * @param  uri  URI.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code uri} is null.
+     * @param  uri {@code URI}
+     * @throws NullPointerException if {@code uri} is {@code null}
      */
     public PrinterMoreInfoManufacturer(URI uri) {
         super (uri);
@@ -74,21 +74,17 @@
      * Returns whether this printer more info manufacturer attribute is
      * equivalent to the passed in object. To be equivalent, all of the
      * following conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class
-     * PrinterMoreInfoManufacturer.
-     * <LI>
-     * This printer more info manufacturer attribute's URI and
-     * {@code object}'s URI are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class
+     *   {@code PrinterMoreInfoManufacturer}.
+     *   <li>This printer more info manufacturer attribute's {@code URI} and
+     *   {@code object}'s {@code URI} are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this printer
-     *          more info manufacturer attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this printer more
+     *         info manufacturer attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) &&
@@ -98,12 +94,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterMoreInfoManufacturer, the category is
-     * class PrinterMoreInfoManufacturer itself.
+     * <p>
+     * For class {@code PrinterMoreInfoManufacturer}, the category is class
+     * {@code PrinterMoreInfoManufacturer} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterMoreInfoManufacturer.class;
@@ -112,14 +108,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterMoreInfoManufacturer, the category name is
+     * <p>
+     * For class {@code PrinterMoreInfoManufacturer}, the category name is
      * {@code "printer-more-info-manufacturer"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-more-info-manufacturer";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterName.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterName.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,43 +22,45 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterName is a printing attribute class, a text attribute, that
- * specifies the name of a printer. It is a name that is more end-user friendly
- * than a URI. An administrator determines a printer's name and sets this
- * attribute to that name. This name may be the last part of the printer's URI
- * or it may be unrelated. In non-US-English locales, a name may contain
- * characters that are not allowed in a URI.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * Class {@code PrinterName} is a printing attribute class, a text attribute,
+ * that specifies the name of a printer. It is a name that is more end-user
+ * friendly than a {@code URI}. An administrator determines a printer's name and
+ * sets this attribute to that name. This name may be the last part of the
+ * printer's {@code URI} or it may be unrelated. In non-US-English locales, a
+ * name may contain characters that are not allowed in a {@code URI}.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterName extends TextSyntax
         implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 299740639137803127L;
 
     /**
      * Constructs a new printer name attribute with the given name and locale.
      *
-     * @param  printerName  Printer name.
-     * @param  locale       Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code printerName} is null.
+     * @param  printerName printer name
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code printerName} is {@code null}
      */
     public PrinterName(String printerName, Locale locale) {
         super (printerName, locale);
@@ -68,23 +70,18 @@
      * Returns whether this printer name attribute is equivalent to the passed
      * in object. To be equivalent, all of the following conditions must be
      * true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PrinterName.
-     * <LI>
-     * This printer name attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This printer name attribute's locale and {@code object}'s locale
-     * are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PrinterName}.
+     *   <li>This printer name attribute's underlying string and
+     *   {@code object}'s underlying string are equal.
+     *   <li>This printer name attribute's locale and {@code object}'s locale
+     *   are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this printer
-     *          name attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this printer name
+     *         attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) && object instanceof PrinterName);
@@ -93,12 +90,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterName, the category is
-     * class PrinterName itself.
+     * <p>
+     * For class {@code PrinterName}, the category is class
+     * {@code PrinterName} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterName.class;
@@ -107,14 +104,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterName, the category
-     * name is {@code "printer-name"}.
+     * <p>
+     * For class {@code PrinterName}, the category name is
+     * {@code "printer-name"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-name";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterResolution.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterResolution.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,71 +22,66 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
+import javax.print.attribute.PrintJobAttribute;
+import javax.print.attribute.PrintRequestAttribute;
 import javax.print.attribute.ResolutionSyntax;
-import javax.print.attribute.DocAttribute;
-import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class PrinterResolution is a printing attribute class that specifies an
- * exact resolution supported by a printer or to be used for a print job.
+ * Class {@code PrinterResolution} is a printing attribute class that specifies
+ * an exact resolution supported by a printer or to be used for a print job.
  * This attribute assumes that printers have a small set of device resolutions
  * at which they can operate rather than a continuum.
  * <p>
- * PrinterResolution is used in multiple ways:
- * <OL TYPE=1>
- * <LI>
- * When a client searches looking for a printer that supports the client's
- * desired resolution exactly (no more, no less), the client specifies
- * an instance of class PrinterResolution indicating the exact resolution the
- * client wants. Only printers supporting that exact resolution will match the
- * search.
+ * {@code PrinterResolution} is used in multiple ways:
+ * <ol type=1>
+ *   <li>When a client searches looking for a printer that supports the client's
+ *   desired resolution exactly (no more, no less), the client specifies an
+ *   instance of class {@code PrinterResolution} indicating the exact resolution
+ *   the client wants. Only printers supporting that exact resolution will match
+ *   the search.
+ *   <li>When a client needs to print a job using the client's desired
+ *   resolution exactly (no more, no less), the client specifies an instance of
+ *   class {@code PrinterResolution} as an attribute of the Print Job. This will
+ *   fail if the Print Job doesn't support that exact resolution, and
+ *   {@code Fidelity} is set to true.
+ * </ol>
+ * If a client wants to locate a printer supporting a resolution greater than
+ * some required minimum, then it may be necessary to exclude this attribute
+ * from a lookup request and to directly query the set of supported resolutions,
+ * and specify the one that most closely meets the client's requirements. In
+ * some cases this may be more simply achieved by specifying a
+ * {@code PrintQuality} attribute which often controls resolution.
+ * <p>
+ * <b>IPP Compatibility:</b> The information needed to construct an IPP
+ * {@code "printer-resolution"} attribute can be obtained by calling methods on
+ * the PrinterResolution object. The category name returned by {@code getName()}
+ * gives the IPP attribute name.
  *
- * <LI>
- * When a client needs to print a job using the client's desired resolution
- * exactly (no more, no less), the client specifies an instance of class
- * PrinterResolution as an attribute of the Print Job. This will fail if the
- * Print Job doesn't support that exact resolution, and Fidelity is set to
- * true.
- * </OL>
- * If a client wants to locate a printer supporting a resolution
- * greater than some required minimum, then it may be necessary to exclude
- * this attribute from a lookup request and to directly query the set of
- * supported resolutions, and specify the one that most closely meets
- * the client's requirements.
- * In some cases this may be more simply achieved by specifying a
- * PrintQuality attribute which often controls resolution.
- * <P>
- * <B>IPP Compatibility:</B> The information needed to construct an IPP
- * {@code "printer-resolution"} attribute can be obtained by calling
- * methods on the PrinterResolution object. The category name returned by
- * {@code getName()} gives the IPP attribute name.
- *
- * @author  David Mendenhall
- * @author  Alan Kaminsky
+ * @author David Mendenhall
+ * @author Alan Kaminsky
  */
 public final class PrinterResolution    extends ResolutionSyntax
         implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 13090306561090558L;
 
     /**
      * Construct a new printer resolution attribute from the given items.
      *
-     * @param  crossFeedResolution
-     *     Cross feed direction resolution.
-     * @param  feedResolution
-     *     Feed direction resolution.
-     * @param  units
-     *    Unit conversion factor, e.g. {@code ResolutionSyntax.DPI}
-     * or {@code ResolutionSyntax.DPCM}.
-     *
-     * @exception  IllegalArgumentException
-     *     (unchecked exception) Thrown if {@code crossFeedResolution < 1} or
-     *     {@code feedResolution < 1} or {@code units < 1}.
+     * @param  crossFeedResolution cross feed direction resolution
+     * @param  feedResolution feed direction resolution
+     * @param  units unit conversion factor, e.g. {@code ResolutionSyntax.DPI}
+     *         or {@code ResolutionSyntax.DPCM}
+     * @throws IllegalArgumentException if {@code crossFeedResolution < 1} or
+     *         {@code feedResolution < 1} or {@code units < 1}
      */
     public PrinterResolution(int crossFeedResolution, int feedResolution,
                              int units) {
@@ -95,25 +90,20 @@
 
     /**
      * Returns whether this printer resolution attribute is equivalent to the
-     * passed in object. To be equivalent, all of the following conditions
-     * must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PrinterResolution.
-     * <LI>
-     * This attribute's cross feed direction resolution is equal to
-     * {@code object}'s cross feed direction resolution.
-     * <LI>
-     * This attribute's feed direction resolution is equal to
-     * {@code object}'s feed direction resolution.
-     * </OL>
+     * passed in object. To be equivalent, all of the following conditions must
+     * be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PrinterResolution}.
+     *   <li>This attribute's cross feed direction resolution is equal to
+     *   {@code object}'s cross feed direction resolution.
+     *   <li>This attribute's feed direction resolution is equal to
+     *   {@code object}'s feed direction resolution.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this printer
-     *          resolution attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this printer
+     *         resolution attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -123,27 +113,27 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterResolution, the category is class PrinterResolution itself.
+     * <p>
+     * For class {@code PrinterResolution}, the category is class
+     * {@code PrinterResolution} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterResolution.class;
-                }
+    }
 
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterResolution, the
-     * category name is {@code "printer-resolution"}.
+     * <p>
+     * For class {@code PrinterResolution}, the category name is
+     * {@code "printer-resolution"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-resolution";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterState.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterState.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,25 +30,28 @@
 import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterState is a printing attribute class, an enumeration, that
- * identifies the current state of a printer. Class PrinterState defines
- * standard printer state values. A Print Service implementation only needs
- * to report those printer states which are appropriate for the particular
+ * Class {@code PrinterState} is a printing attribute class, an enumeration,
+ * that identifies the current state of a printer. Class {@code PrinterState}
+ * defines standard printer state values. A Print Service implementation only
+ * needs to report those printer states which are appropriate for the particular
  * implementation; it does not have to report every defined printer state. The
  * {@link PrinterStateReasons PrinterStateReasons} attribute augments the
- * PrinterState attribute to give more detailed information about the printer
- * in  given printer state.
- * <P>
- * <B>IPP Compatibility:</B> The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * {@code PrinterState} attribute to give more detailed information about the
+ * printer in given printer state.
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterState extends EnumSyntax
 implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -649578618346507718L;
 
     /**
@@ -61,8 +65,7 @@
     public static final PrinterState IDLE = new PrinterState(3);
 
     /**
-     * Indicates that jobs are processing;
-     * new jobs will wait before processing.
+     * Indicates that jobs are processing; new jobs will wait before processing.
      */
     public static final PrinterState PROCESSING = new PrinterState(4);
 
@@ -75,12 +78,15 @@
      * Construct a new printer state enumeration value with the given integer
      * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected PrinterState(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code PrinterState}.
+     */
     private static final String[] myStringTable = {
         "unknown",
         null,
@@ -90,6 +96,9 @@
         "stopped"
     };
 
+    /**
+     * The enumeration value table for class {@code PrinterState}.
+     */
     private static final PrinterState[] myEnumValueTable = {
         UNKNOWN,
         null,
@@ -100,14 +109,14 @@
     };
 
     /**
-     * Returns the string table for class PrinterState.
+     * Returns the string table for class {@code PrinterState}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class PrinterState.
+     * Returns the enumeration value table for class {@code PrinterState}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
@@ -116,11 +125,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterState, the category is class PrinterState itself.
+     * <p>
+     * For class {@code PrinterState}, the category is class
+     * {@code PrinterState} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterState.class;
@@ -129,13 +139,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterState, the category name is {@code "printer-state"}.
+     * <p>
+     * For class {@code PrinterState}, the category name is
+     * {@code "printer-state"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-state";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReason.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReason.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,50 +22,51 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.Attribute;
 
 /**
- * Class PrinterStateReason is a printing attribute class, an enumeration,
- * that provides additional information about the printer's current state,
- * i.e., information that augments the value of the printer's
- * {@link PrinterState PrinterState} attribute.
- * Class PrinterStateReason defines standard printer
- * state reason values. A Print Service implementation only needs to report
- * those printer state reasons which are appropriate for the particular
- * implementation; it does not have to report every defined printer state
- * reason.
- * <P>
- * Instances of PrinterStateReason do not appear in a Print Service's
- * attribute set directly.
- * Rather, a {@link PrinterStateReasons PrinterStateReasons}
- * attribute appears in the Print Service's attribute set. The {@link
- * PrinterStateReasons PrinterStateReasons} attribute contains zero, one, or
- * more than one PrinterStateReason objects which pertain to the
- * Print Service's status, and each PrinterStateReason object is
- * associated with a {@link Severity Severity} level of REPORT (least severe),
- * WARNING, or ERROR (most severe). The printer adds a PrinterStateReason
- * object to the Print Service's
+ * Class {@code PrinterStateReason} is a printing attribute class, an
+ * enumeration, that provides additional information about the printer's current
+ * state, i.e., information that augments the value of the printer's
+ * {@link PrinterState PrinterState} attribute. Class PrinterStateReason defines
+ * standard printer state reason values. A Print Service implementation only
+ * needs to report those printer state reasons which are appropriate for the
+ * particular implementation; it does not have to report every defined printer
+ * state reason.
+ * <p>
+ * Instances of {@code PrinterStateReason} do not appear in a Print Service's
+ * attribute set directly. Rather, a
+ * {@link PrinterStateReasons PrinterStateReasons} attribute appears in the
+ * Print Service's attribute set. The
+ * {@link PrinterStateReasons PrinterStateReasons} attribute contains zero, one,
+ * or more than one {@code PrinterStateReason} objects which pertain to the
+ * Print Service's status, and each PrinterStateReason object is associated with
+ * a {@link Severity Severity} level of {@code REPORT} (least severe),
+ * {@code WARNING}, or {@code ERROR} (most severe). The printer adds a
+ * {@code PrinterStateReason} object to the Print Service's
  * {@link PrinterStateReasons PrinterStateReasons} attribute when the
- * corresponding condition becomes true of the printer, and the printer
- * removes the PrinterStateReason object again when the corresponding
- * condition becomes false, regardless of whether the Print Service's overall
+ * corresponding condition becomes true of the printer, and the printer removes
+ * the {@code PrinterStateReason} object again when the corresponding condition
+ * becomes false, regardless of whether the Print Service's overall
  * {@link PrinterState PrinterState} also changed.
- * <P>
- * <B>IPP Compatibility:</B>
- * The string values returned by each individual {@link PrinterStateReason} and
- * associated {@link Severity} object's {@code toString()}
- * methods, concatenated together with a hyphen ({@code "-"}) in
- * between, gives the IPP keyword value for a {@link PrinterStateReasons}.
- * The category name returned by {@code getName()} gives the IPP
- * attribute name.
+ * <p>
+ * <b>IPP Compatibility:</b> The string values returned by each individual
+ * {@link PrinterStateReason} and associated {@link Severity} object's
+ * {@code toString()} methods, concatenated together with a hyphen ({@code "-"})
+ * in between, gives the IPP keyword value for a {@link PrinterStateReasons}.
+ * The category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class PrinterStateReason extends EnumSyntax implements Attribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -1623720656201472593L;
 
     /**
@@ -87,51 +88,48 @@
 
     /**
      * Someone has paused the printer, but the device(s) are taking an
-     * appreciable time to stop. Later, when all output has stopped,
-     * the {@link  PrinterState PrinterState} becomes STOPPED,
-     * and the PAUSED value replaces
-     * the MOVING_TO_PAUSED value in the {@link PrinterStateReasons
-     * PrinterStateReasons} attribute. This value must be supported if the
-     * printer can be paused and the implementation takes significant time to
-     * pause a device in certain circumstances.
+     * appreciable time to stop. Later, when all output has stopped, the
+     * {@link PrinterState PrinterState} becomes {@code STOPPED}, and the
+     * {@code PAUSED} value replaces the {@code MOVING_TO_PAUSED} value in the
+     * {@link PrinterStateReasons PrinterStateReasons} attribute. This value
+     * must be supported if the printer can be paused and the implementation
+     * takes significant time to pause a device in certain circumstances.
      */
     public static final PrinterStateReason
         MOVING_TO_PAUSED = new PrinterStateReason(3);
 
     /**
-     * Someone has paused the printer and the printer's {@link PrinterState
-     * PrinterState} is STOPPED. In this state, a printer must not produce
-     * printed output, but it must perform other operations requested by a
-     * client. If a printer had been printing a job when the printer was
-     * paused,
-     * the Printer must resume printing that job when the printer is no longer
-     * paused and leave no evidence in the printed output of such a pause.
-     * This value must be supported if the printer can be paused.
+     * Someone has paused the printer and the printer's
+     * {@link PrinterState PrinterState} is {@code STOPPED}. In this state, a
+     * printer must not produce printed output, but it must perform other
+     * operations requested by a client. If a printer had been printing a job
+     * when the printer was paused, the {@code Printer} must resume printing
+     * that job when the printer is no longer paused and leave no evidence in
+     * the printed output of such a pause. This value must be supported if the
+     * printer can be paused.
      */
     public static final PrinterStateReason
         PAUSED = new PrinterStateReason(4);
 
     /**
-     * Someone has removed a printer from service, and the device may be
-     * powered down or physically removed.
-     * In this state, a printer must not produce
-     * printed output, and unless the printer is realized by a print server
-     * that is still active, the printer must perform no other operations
-     * requested by a client.
-     * If a printer had been printing a job when it was shut down,
+     * Someone has removed a printer from service, and the device may be powered
+     * down or physically removed. In this state, a printer must not produce
+     * printed output, and unless the printer is realized by a print server that
+     * is still active, the printer must perform no other operations requested
+     * by a client. If a printer had been printing a job when it was shut down,
      * the printer need not resume printing that job when the printer is no
      * longer shut down. If the printer resumes printing such a job, it may
      * leave evidence in the printed output of such a shutdown, e.g. the part
      * printed before the shutdown may be printed a second time after the
      * shutdown.
-         */
+     */
     public static final PrinterStateReason
         SHUTDOWN = new PrinterStateReason(5);
 
     /**
      * The printer has scheduled a job on the output device and is in the
-     * process of connecting to a shared network output device (and might not
-     * be able to actually start printing the job for an arbitrarily long time
+     * process of connecting to a shared network output device (and might not be
+     * able to actually start printing the job for an arbitrarily long time
      * depending on the usage of the output device by other servers on the
      * network).
      */
@@ -146,14 +144,13 @@
         TIMED_OUT = new PrinterStateReason(7);
 
     /**
-     * The printer is in the process of stopping the device and will be
-     * stopped in a while.
-     * When the device is stopped, the printer will change the
-     * {@link PrinterState PrinterState} to STOPPED. The STOPPING reason is
-     * never an error, even for a printer with a single output device. When an
-     * output device ceases accepting jobs, the printer's {@link
-     * PrinterStateReasons PrinterStateReasons} will have this reason while
-     * the output device completes printing.
+     * The printer is in the process of stopping the device and will be stopped
+     * in a while. When the device is stopped, the printer will change the
+     * {@link PrinterState PrinterState} to {@code STOPPED}. The
+     * {@code STOPPING} reason is never an error, even for a printer with a
+     * single output device. When an output device ceases accepting jobs, the
+     * printer's {@link PrinterStateReasons PrinterStateReasons} will have this
+     * reason while the output device completes printing.
      */
     public static final PrinterStateReason
         STOPPING = new PrinterStateReason(8);
@@ -161,10 +158,9 @@
     /**
      * When a printer controls more than one output device, this reason
      * indicates that one or more output devices are stopped. If the reason's
-     * severity is a report, fewer than half of the output devices are
-     * stopped.
-     * If the reason's severity is a warning, half or more but fewer than
-     * all of the output devices are stopped.
+     * severity is a report, fewer than half of the output devices are stopped.
+     * If the reason's severity is a warning, half or more but fewer than all of
+     * the output devices are stopped.
      */
     public static final PrinterStateReason
         STOPPED_PARTLY = new PrinterStateReason(9);
@@ -182,12 +178,10 @@
         TONER_EMPTY = new PrinterStateReason(11);
 
     /**
-     * The limit of persistent storage allocated for spooling has been
-     * reached.
+     * The limit of persistent storage allocated for spooling has been reached.
      * The printer is temporarily unable to accept more jobs. The printer will
-     * remove this reason when it is able to accept more jobs.
-     * This value should  be used by a non-spooling printer that only
-     * accepts one or a small number
+     * remove this reason when it is able to accept more jobs. This value should
+     * be used by a non-spooling printer that only accepts one or a small number
      * jobs at a time or a spooling printer that has filled the spool space.
      */
     public static final PrinterStateReason
@@ -236,8 +230,7 @@
         OUTPUT_TRAY_MISSING = new PrinterStateReason(19);
 
     /**
-     * One or more output areas are almost full
-     * (e.g. tray, stacker, collator).
+     * One or more output areas are almost full (e.g. tray, stacker, collator).
      */
     public static final PrinterStateReason
         OUTPUT_AREA_ALMOST_FULL = new PrinterStateReason(20);
@@ -317,15 +310,18 @@
         INTERPRETER_RESOURCE_UNAVAILABLE = new PrinterStateReason(32);
 
     /**
-     * Construct a new printer state reason enumeration value with
-     * the given integer value.
+     * Construct a new printer state reason enumeration value with the given
+     * integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected PrinterStateReason(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code PrinterStateReason}.
+     */
     private static final String[] myStringTable = {
         "other",
         "media-needed",
@@ -362,6 +358,9 @@
         "interpreter-resource-unavailable"
     };
 
+    /**
+     * The enumeration value table for class {@code PrinterStateReason}.
+     */
     private static final PrinterStateReason[] myEnumValueTable = {
         OTHER,
         MEDIA_NEEDED,
@@ -399,29 +398,28 @@
     };
 
     /**
-     * Returns the string table for class PrinterStateReason.
+     * Returns the string table for class {@code PrinterStateReason}.
      */
     protected String[] getStringTable() {
         return myStringTable.clone();
     }
 
     /**
-     * Returns the enumeration value table for class PrinterStateReason.
+     * Returns the enumeration value table for class {@code PrinterStateReason}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
     }
 
-
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterStateReason and any vendor-defined subclasses, the
-     * category is class PrinterStateReason itself.
+     * <p>
+     * For class {@code PrinterStateReason} and any vendor-defined subclasses,
+     * the category is class {@code PrinterStateReason} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterStateReason.class;
@@ -430,14 +428,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterStateReason and any vendor-defined subclasses, the
-     * category name is {@code "printer-state-reason"}.
+     * <p>
+     * For class {@code PrinterStateReason} and any vendor-defined subclasses,
+     * the category name is {@code "printer-state-reason"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-state-reason";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReasons.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReasons.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,69 +22,72 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.AbstractSet;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.NoSuchElementException;
-import java.util.HashMap;
 import java.util.Set;
 
 import javax.print.attribute.Attribute;
 import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterStateReasons is a printing attribute class, a set of
- * enumeration values, that provides additional information about the
- * printer's current state, i.e., information that augments the value of the
- * printer's {@link PrinterState PrinterState} attribute.
- * <P>
- * Instances of {@link PrinterStateReason PrinterStateReason} do not appear in
- *  a Print Service's attribute set directly. Rather, a PrinterStateReasons
+ * Class {@code PrinterStateReasons} is a printing attribute class, a set of
+ * enumeration values, that provides additional information about the printer's
+ * current state, i.e., information that augments the value of the printer's
+ * {@link PrinterState PrinterState} attribute.
+ * <p>
+ * Instances of {@link PrinterStateReason PrinterStateReason} do not appear in a
+ * Print Service's attribute set directly. Rather, a {@code PrinterStateReasons}
  * attribute appears in the Print Service's attribute set. The
- * PrinterStateReasons attribute contains zero, one, or more than one {@link
- * PrinterStateReason PrinterStateReason} objects which pertain to the Print
- * Service's status, and each {@link PrinterStateReason PrinterStateReason}
- * object is associated with a {@link Severity Severity} level of REPORT
- *  (least severe), WARNING, or ERROR (most severe). The printer adds a {@link
- * PrinterStateReason PrinterStateReason} object to the Print Service's
- * PrinterStateReasons attribute when the corresponding condition becomes true
- * of the printer, and the printer removes the {@link PrinterStateReason
- * PrinterStateReason} object again when the corresponding condition becomes
- * false, regardless of whether the Print Service's overall
- * {@link PrinterState PrinterState} also changed.
- * <P>
- * Class PrinterStateReasons inherits its implementation from class {@link
- * java.util.HashMap java.util.HashMap}. Each entry in the map consists of a
+ * {@code PrinterStateReasons} attribute contains zero, one, or more than one
+ * {@link PrinterStateReason PrinterStateReason} objects which pertain to the
+ * Print Service's status, and each
+ * {@link PrinterStateReason PrinterStateReason} object is associated with a
+ * {@link Severity Severity} level of {@code REPORT} (least severe),
+ * {@code WARNING}, or {@code ERROR} (most severe). The printer adds a
+ * {@link PrinterStateReason PrinterStateReason} object to the Print Service's
+ * {@code PrinterStateReasons} attribute when the corresponding condition
+ * becomes true of the printer, and the printer removes the
+ * {@link PrinterStateReason PrinterStateReason} object again when the
+ * corresponding condition becomes false, regardless of whether the Print
+ * Service's overall {@link PrinterState PrinterState} also changed.
+ * <p>
+ * Class PrinterStateReasons inherits its implementation from class
+ * {@link HashMap java.util.HashMap}. Each entry in the map consists of a
  * {@link PrinterStateReason PrinterStateReason} object (key) mapping to a
  * {@link Severity Severity} object (value):
- * <P>
+ * <p>
  * Unlike most printing attributes which are immutable once constructed, class
- * PrinterStateReasons is designed to be mutable; you can add {@link
- * PrinterStateReason PrinterStateReason} objects to an existing
- * PrinterStateReasons object and remove them again. However, like class
- *  {@link java.util.HashMap java.util.HashMap}, class PrinterStateReasons is
- * not multiple thread safe. If a PrinterStateReasons object will be used by
+ * {@code PrinterStateReasons} is designed to be mutable; you can add
+ * {@link PrinterStateReason PrinterStateReason} objects to an existing
+ * {@code PrinterStateReasons} object and remove them again. However, like class
+ * {@link HashMap java.util.HashMap}, class {@code PrinterStateReasons} is not
+ * multiple thread safe. If a {@code PrinterStateReasons} object will be used by
  * multiple threads, be sure to synchronize its operations (e.g., using a
  * synchronized map view obtained from class {@link java.util.Collections
  * java.util.Collections}).
- * <P>
- * <B>IPP Compatibility:</B> The string values returned by each individual
+ * <p>
+ * <b>IPP Compatibility:</b> The string values returned by each individual
  * {@link PrinterStateReason PrinterStateReason} object's and the associated
- * {@link Severity Severity} object's {@code toString()} methods,
- * concatenated
- * together with a hyphen ({@code "-"}) in between, gives the IPP keyword
- * value. The category name returned by {@code getName()} gives the IPP
- * attribute name.
+ * {@link Severity Severity} object's {@code toString()} methods, concatenated
+ * together with a hyphen ({@code "-"}) in between, gives the IPP keyword value.
+ * The category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class PrinterStateReasons
     extends HashMap<PrinterStateReason,Severity>
     implements PrintServiceAttribute
 {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -3731791085163619457L;
 
     /**
@@ -96,13 +99,11 @@
     }
 
     /**
-     * super a new, empty printer state reasons attribute; the underlying
+     * Construct a new, empty printer state reasons attribute; the underlying
      * hash map has the given initial capacity and the default load factor.
      *
-     * @param  initialCapacity  Initial capacity.
-     *
-     * @throws IllegalArgumentException if the initial capacity is less
-     *     than zero.
+     * @param  initialCapacity initial capacity
+     * @throws IllegalArgumentException if the initial capacity is negative
      */
     public PrinterStateReasons(int initialCapacity) {
         super (initialCapacity);
@@ -112,11 +113,9 @@
      * Construct a new, empty printer state reasons attribute; the underlying
      * hash map has the given initial capacity and load factor.
      *
-     * @param  initialCapacity  Initial capacity.
-     * @param  loadFactor       Load factor.
-     *
-     * @throws IllegalArgumentException if the initial capacity is less
-     *     than zero.
+     * @param  initialCapacity initial capacity
+     * @param  loadFactor load factor
+     * @throws IllegalArgumentException if the initial capacity is negative
      */
     public PrinterStateReasons(int initialCapacity, float loadFactor) {
         super (initialCapacity, loadFactor);
@@ -127,19 +126,15 @@
      * {@link PrinterStateReason PrinterStateReason}-to-{@link Severity
      * Severity} mappings as the given map. The underlying hash map's initial
      * capacity and load factor are as specified in the superclass constructor
-     * {@link java.util.HashMap#HashMap(java.util.Map)
-     * HashMap(Map)}.
-     *
-     * @param  map  Map to copy.
+     * {@link HashMap#HashMap(Map) HashMap(Map)}.
      *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code map} is null or if any
-     *     key or value in {@code map} is null.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if any key in {@code map} is not
-     *   an instance of class {@link PrinterStateReason PrinterStateReason} or
-     *     if any value in {@code map} is not an instance of class
-     *     {@link Severity Severity}.
+     * @param  map map to copy
+     * @throws NullPointerException if {@code map} is {@code null} or if any key
+     *         or value in {@code map} is {@code null}
+     * @throws ClassCastException if any key in {@code map} is not an instance
+     *         of class {@link PrinterStateReason PrinterStateReason} or if any
+     *         value in {@code map} is not an instance of class
+     *         {@link Severity Severity}
      */
     public PrinterStateReasons(Map<PrinterStateReason,Severity> map) {
         this();
@@ -149,27 +144,23 @@
 
     /**
      * Adds the given printer state reason to this printer state reasons
-     * attribute, associating it with the given severity level. If this
-     * printer state reasons attribute previously contained a mapping for the
-     * given printer state reason, the old value is replaced.
-     *
-     * @param  reason    Printer state reason. This must be an instance of
-     *                    class {@link PrinterStateReason PrinterStateReason}.
-     * @param  severity  Severity of the printer state reason. This must be
-     *                      an instance of class {@link Severity Severity}.
+     * attribute, associating it with the given severity level. If this printer
+     * state reasons attribute previously contained a mapping for the given
+     * printer state reason, the old value is replaced.
      *
-     * @return  Previous severity associated with the given printer state
-     *          reason, or {@code null} if the given printer state reason was
-     *          not present.
-     *
-     * @throws  NullPointerException
-     *     (unchecked exception) Thrown if {@code reason} is null or
-     *     {@code severity} is null.
-     * @throws  ClassCastException
-     *     (unchecked exception) Thrown if {@code reason} is not an
-     *   instance of class {@link PrinterStateReason PrinterStateReason} or if
-     *     {@code severity} is not an instance of class {@link Severity
-     *     Severity}.
+     * @param  reason printer state reason. This must be an instance of class
+     *         {@link PrinterStateReason PrinterStateReason}
+     * @param  severity severity of the printer state reason. This must be an
+     *         instance of class {@link Severity Severity}
+     * @return previous severity associated with the given printer state reason,
+     *         or {@code null} if the given printer state reason was not
+     *         present
+     * @throws NullPointerException if {@code reason} is {@code null} or
+     *         {@code severity} is {@code null}
+     * @throws ClassCastException if {@code reason} is not an instance of class
+     *         {@link PrinterStateReason PrinterStateReason} or if
+     *         {@code severity} is not an instance of class
+     *         {@link Severity Severity}
      * @since 1.5
      */
     public Severity put(PrinterStateReason reason, Severity severity) {
@@ -185,12 +176,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterStateReasons, the
-     * category is class PrinterStateReasons itself.
+     * <p>
+     * For class {@code PrinterStateReasons}, the category is class
+     * {@code PrinterStateReasons} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterStateReasons.class;
@@ -199,11 +190,11 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterStateReasons, the
-     * category name is {@code "printer-state-reasons"}.
+     * <p>
+     * For class {@code PrinterStateReasons}, the category name is
+     * {@code "printer-state-reasons"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-state-reasons";
@@ -211,24 +202,21 @@
 
     /**
      * Obtain an unmodifiable set view of the individual printer state reason
-     * attributes at the given severity level in this PrinterStateReasons
-     * attribute. Each element in the set view is a {@link PrinterStateReason
-     * PrinterStateReason} object. The only elements in the set view are the
-     * {@link PrinterStateReason PrinterStateReason} objects that map to the
-     * given severity value. The set view is backed by this
-     * PrinterStateReasons attribute, so changes to this PrinterStateReasons
-     * attribute are reflected  in the set view.
-     * The set view does not support element insertion or
-     * removal. The set view's iterator does not support element removal.
+     * attributes at the given severity level in this
+     * {@code PrinterStateReasons} attribute. Each element in the set view is a
+     * {@link PrinterStateReason PrinterStateReason} object. The only elements
+     * in the set view are the {@link PrinterStateReason PrinterStateReason}
+     * objects that map to the given severity value. The set view is backed by
+     * this {@code PrinterStateReasons} attribute, so changes to this
+     * {@code PrinterStateReasons} attribute are reflected in the set view. The
+     * set view does not support element insertion or removal. The set view's
+     * iterator does not support element removal.
      *
-     * @param  severity  Severity level.
-     *
-     * @return  Set view of the individual {@link PrinterStateReason
-     *          PrinterStateReason} attributes at the given {@link Severity
-     *          Severity} level.
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code severity} is null.
+     * @param  severity severity level
+     * @return set view of the individual
+     *         {@link PrinterStateReason PrinterStateReason} attributes at the
+     *         given {@link Severity Severity} level
+     * @throws NullPointerException if {@code severity} is {@code null}
      */
     public Set<PrinterStateReason> printerStateReasonSet(Severity severity) {
         if (severity == null) {
@@ -305,5 +293,4 @@
             throw new UnsupportedOperationException();
         }
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterURI.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterURI.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, 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
@@ -22,41 +22,41 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.net.URI;
-import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintServiceAttribute;
 import javax.print.attribute.URISyntax;
-import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class PrinterURI is a printing attribute class, a URI, that specifies the
- * globally unique name of a printer.  If it has such a name, an administrator
- * determines a printer's URI and sets this attribute to that name.
- * <P>
- * <B>IPP Compatibility:</B>  This implements the
- * IPP printer-uri attribute. The string form returned by
- * {@code toString()}  gives the IPP printer-uri value.
- * The category name returned by {@code getName()}
- * gives the IPP attribute name.
+ * Class {@code PrinterURI} is a printing attribute class, a {@code URI}, that
+ * specifies the globally unique name of a printer. If it has such a name, an
+ * administrator determines a printer's {@code URI} and sets this attribute to
+ * that name.
+ * <p>
+ * <b>IPP Compatibility:</b> This implements the IPP printer-uri attribute. The
+ * string form returned by {@code toString()} gives the IPP printer-uri value.
+ * The category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Robert Herriot
+ * @author Robert Herriot
  */
-
 public final class PrinterURI extends URISyntax
         implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 7923912792485606497L;
 
     /**
-     * Constructs a new PrinterURI attribute with the specified URI.
+     * Constructs a new {@code PrinterURI} attribute with the specified
+     * {@code URI}.
      *
-     * @param  uri  URI of the printer
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code uri} is null.
+     * @param  uri {@code URI} of the printer
+     * @throws NullPointerException if {@code uri} is {@code null}
      */
     public PrinterURI(URI uri) {
         super (uri);
@@ -66,34 +66,30 @@
      * Returns whether this printer name attribute is equivalent to the passed
      * in object. To be equivalent, all of the following conditions must be
      * true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class PrinterURI.
-     * <LI>
-     * This PrinterURI attribute's underlying URI and
-     * {@code object}'s underlying URI are equal.
-     * </OL>
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code PrinterURI}.
+     *   <li>This {@code PrinterURI} attribute's underlying {@code URI} and
+     *   {@code object}'s underlying {@code URI} are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this PrinterURI
-     *          attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this
+     *         {@code PrinterURI} attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) && object instanceof PrinterURI);
     }
 
-   /**
+    /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class PrinterURI and any vendor-defined subclasses, the category is
-     * class PrinterURI itself.
+     * <p>
+     * For class {@code PrinterURI} and any vendor-defined subclasses, the
+     * category is class {@code PrinterURI} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return PrinterURI.class;
@@ -102,14 +98,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class PrinterURI and any vendor-defined subclasses, the category
-     * name is {@code "printer-uri"}.
+     * <p>
+     * For class {@code PrinterURI} and any vendor-defined subclasses, the
+     * category name is {@code "printer-uri"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "printer-uri";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/QueuedJobCount.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/QueuedJobCount.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
@@ -29,29 +30,29 @@
 import javax.print.attribute.PrintServiceAttribute;
 
 /**
- * Class QueuedJobCount is an integer valued printing attribute that indicates
- * the number of jobs in the printer whose {@link JobState JobState} is either
- * PENDING, PENDING_HELD, PROCESSING, or PROCESSING_STOPPED.
- * <P>
- * <B>IPP Compatibility:</B> The integer value gives the IPP integer value.
- * The category name returned by {@code getName()} gives the IPP
- * attribute name.
+ * Class {@code QueuedJobCount} is an integer valued printing attribute that
+ * indicates the number of jobs in the printer whose {@link JobState JobState}
+ * is either {@code PENDING}, {@code PENDING_HELD}, {@code PROCESSING}, or
+ * {@code PROCESSING_STOPPED}.
+ * <p>
+ * <b>IPP Compatibility:</b> The integer value gives the IPP integer value. The
+ * category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class QueuedJobCount extends IntegerSyntax
     implements PrintServiceAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 7499723077864047742L;
 
     /**
-     * Construct a new queued job count attribute with the given integer
-     * value.
+     * Construct a new queued job count attribute with the given integer value.
      *
-     * @param  value  Integer value.
-     *
-     * @exception  IllegalArgumentException
-     *   (Unchecked exception) Thrown if {@code value} is less than 0.
+     * @param  value Integer value
+     * @throws IllegalArgumentException if {@code value} is negative
      */
     public QueuedJobCount(int value) {
         super (value, 0, Integer.MAX_VALUE);
@@ -59,22 +60,18 @@
 
     /**
      * Returns whether this queued job count attribute is equivalent to the
-     * passed in object. To be equivalent, all of the following conditions
-     * mus  be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class QueuedJobCount.
-     * <LI>
-     * This queued job count attribute's value and {@code object}'s
-     * value are equal.
-     * </OL>
+     * passed in object. To be equivalent, all of the following conditions mus
+     * be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code QueuedJobCount}.
+     *   <li>This queued job count attribute's value and {@code object}'s value
+     *   are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this queued job
-     *          count attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this queued job
+     *         count attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals (object) &&
@@ -84,11 +81,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class QueuedJobCount, the category is class QueuedJobCount itself.
+     * <p>
+     * For class {@code QueuedJobCount}, the category is class
+     * {@code QueuedJobCount} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return QueuedJobCount.class;
@@ -97,14 +95,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class QueuedJobCount, the
-     * category name is {@code "queued-job-count"}.
+     * <p>
+     * For class {@code QueuedJobCount}, the category name is
+     * {@code "queued-job-count"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "queued-job-count";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,45 +22,50 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.Attribute;
 
 /**
- * Class ReferenceUriSchemesSupported is a printing attribute class
- * an enumeration, that indicates a "URI scheme," such as "http:" or "ftp:",
- * that a printer can use to retrieve print data stored at a URI location.
- * If a printer supports doc flavors with a print data representation class of
+ * Class {@code ReferenceUriSchemesSupported} is a printing attribute class an
+ * enumeration, that indicates a "URI scheme," such as "http:" or "ftp:", that a
+ * printer can use to retrieve print data stored at a {@code URI} location. If a
+ * printer supports doc flavors with a print data representation class of
  * {@code "java.net.URL"}, the printer uses instances of class
- * ReferenceUriSchemesSupported to advertise the URI schemes it can accept.
- * The acceptable URI schemes are included as service attributes in the
- * lookup service; this lets clients search the
- * for printers that can get print data using a certain URI scheme. The
- * acceptable URI schemes can also be queried using the capability methods in
- * interface {@code PrintService}. However,
- * ReferenceUriSchemesSupported attributes are used solely for determining
- * acceptable URI schemes, they are never included in a doc's,
- * print request's, print job's, or print service's attribute set.
- * <P>
+ * {@code ReferenceUriSchemesSupported} to advertise the {@code URI} schemes it
+ * can accept. The acceptable {@code URI} schemes are included as service
+ * attributes in the lookup service; this lets clients search the for printers
+ * that can get print data using a certain {@code URI} scheme. The acceptable
+ * {@code URI} schemes can also be queried using the capability methods in
+ * interface {@code PrintService}. However, {@code ReferenceUriSchemesSupported}
+ * attributes are used solely for determining acceptable {@code URI} schemes,
+ * they are never included in a doc's, print request's, print job's, or print
+ * service's attribute set.
+ * <p>
  * The Internet Assigned Numbers Authority maintains the
- * <A HREF="http://www.iana.org/assignments/uri-schemes.html">official
- * list of URI schemes</A>.
+ * <a href="http://www.iana.org/assignments/uri-schemes.html">official list of
+ * URI schemes</a>.
  * <p>
- * Class ReferenceUriSchemesSupported defines enumeration values for widely
- * used URI schemes. A printer that supports additional URI schemes
- * can define them in a subclass of class ReferenceUriSchemesSupported.
- * <P>
- * <B>IPP Compatibility:</B>  The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
+ * Class {@code ReferenceUriSchemesSupported} defines enumeration values for
+ * widely used {@code URI} schemes. A printer that supports additional
+ * {@code URI} schemes can define them in a subclass of class
+ * {@code ReferenceUriSchemesSupported}.
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public class ReferenceUriSchemesSupported
     extends EnumSyntax implements Attribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -8989076942813442805L;
 
     /**
@@ -105,15 +110,18 @@
     public static final ReferenceUriSchemesSupported FILE = new ReferenceUriSchemesSupported(7);
 
     /**
-     * Construct a new reference URI scheme enumeration value with the given
-     * integer value.
+     * Construct a new reference {@code URI} scheme enumeration value with the
+     * given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected ReferenceUriSchemesSupported(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code ReferenceUriSchemesSupported}.
+     */
     private static final String[] myStringTable = {
         "ftp",
         "http",
@@ -125,6 +133,10 @@
         "file",
     };
 
+    /**
+     * The enumeration value table for class
+     * {@code ReferenceUriSchemesSupported}.
+     */
     private static final ReferenceUriSchemesSupported[] myEnumValueTable = {
         FTP,
         HTTP,
@@ -137,7 +149,7 @@
     };
 
     /**
-     * Returns the string table for class ReferenceUriSchemesSupported.
+     * Returns the string table for class {@code ReferenceUriSchemesSupported}.
      */
     protected String[] getStringTable() {
         return myStringTable.clone();
@@ -145,7 +157,7 @@
 
     /**
      * Returns the enumeration value table for class
-     * ReferenceUriSchemesSupported.
+     * {@code ReferenceUriSchemesSupported}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return (EnumSyntax[])myEnumValueTable.clone();
@@ -154,12 +166,13 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class ReferenceUriSchemesSupported and any vendor-defined
-     * subclasses, the category is class ReferenceUriSchemesSupported itself.
+     * <p>
+     * For class {@code ReferenceUriSchemesSupported} and any vendor-defined
+     * subclasses, the category is class {@code ReferenceUriSchemesSupported}
+     * itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return ReferenceUriSchemesSupported.class;
@@ -168,15 +181,14 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class ReferenceUriSchemesSupported and any vendor-defined
+     * <p>
+     * For class {@code ReferenceUriSchemesSupported} and any vendor-defined
      * subclasses, the category name is
      * {@code "reference-uri-schemes-supported"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "reference-uri-schemes-supported";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/RequestingUserName.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/RequestingUserName.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,77 +22,73 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import java.util.Locale;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.PrintRequestAttribute;
 import javax.print.attribute.TextSyntax;
-import javax.print.attribute.PrintRequestAttribute;
 
 /**
- * Class RequestingUserName is a printing attribute class, a text attribute,
- * that specifies the name of the end user that submitted the print job. A
- * requesting user name is an arbitrary string defined by the client. The
- * printer does not put the client-specified RequestingUserName attribute into
- * the Print Job's attribute set; rather, the printer puts in a {@link
- * JobOriginatingUserName JobOriginatingUserName} attribute.
- * This means that services which support specifying a username with this
- * attribute should also report a JobOriginatingUserName in the job's
- * attribute set. Note that many print services may have a way to independently
- * authenticate the user name, and so may state support for a
- * requesting user name, but in practice will then report the user name
- * authenticated by the service rather than that specified via this
- * attribute.
- * <P>
- * <B>IPP Compatibility:</B> The string value gives the IPP name value. The
+ * Class {@code RequestingUserName} is a printing attribute class, a text
+ * attribute, that specifies the name of the end user that submitted the print
+ * job. A requesting user name is an arbitrary string defined by the client. The
+ * printer does not put the client-specified {@code RequestingUserName}
+ * attribute into the Print Job's attribute set; rather, the printer puts in a
+ * {@link JobOriginatingUserName JobOriginatingUserName} attribute. This means
+ * that services which support specifying a username with this attribute should
+ * also report a {@code JobOriginatingUserName} in the job's attribute set. Note
+ * that many print services may have a way to independently authenticate the
+ * user name, and so may state support for a requesting user name, but in
+ * practice will then report the user name authenticated by the service rather
+ * than that specified via this attribute.
+ * <p>
+ * <b>IPP Compatibility:</b> The string value gives the IPP name value. The
  * locale gives the IPP natural language. The category name returned by
  * {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class RequestingUserName   extends TextSyntax
     implements PrintRequestAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -2683049894310331454L;
 
     /**
-     * Constructs a new requesting user name attribute with the given user
-     * name and locale.
+     * Constructs a new requesting user name attribute with the given user name
+     * and locale.
      *
-     * @param  userName  User name.
-     * @param  locale    Natural language of the text string. null
-     * is interpreted to mean the default locale as returned
-     * by {@code Locale.getDefault()}
-     *
-     * @exception  NullPointerException
-     *     (unchecked exception) Thrown if {@code userName} is null.
+     * @param  userName user name
+     * @param  locale natural language of the text string. {@code null} is
+     *         interpreted to mean the default locale as returned by
+     *         {@code Locale.getDefault()}
+     * @throws NullPointerException if {@code userName} is {@code null}
      */
     public RequestingUserName(String userName, Locale locale) {
         super (userName, locale);
     }
 
     /**
-     * Returns whether this requesting user name attribute is equivalent to
-     * the passed in object. To be equivalent, all of the following
-     * conditions must be true:
-     * <OL TYPE=1>
-     * <LI>
-     * {@code object} is not null.
-     * <LI>
-     * {@code object} is an instance of class RequestingUserName.
-     * <LI>
-     * This requesting user name attribute's underlying string and
-     * {@code object}'s underlying string are equal.
-     * <LI>
-     * This requesting user name attribute's locale and
-     * {@code object}'s locale are equal.
-     * </OL>
+     * Returns whether this requesting user name attribute is equivalent to the
+     * passed in object. To be equivalent, all of the following conditions must
+     * be true:
+     * <ol type=1>
+     *   <li>{@code object} is not {@code null}.
+     *   <li>{@code object} is an instance of class {@code RequestingUserName}.
+     *   <li>This requesting user name attribute's underlying string and
+     *   {@code object}'s underlying string are equal.
+     *   <li>This requesting user name attribute's locale and {@code object}'s
+     *   locale are equal.
+     * </ol>
      *
-     * @param  object  Object to compare to.
-     *
-     * @return  True if {@code object} is equivalent to this requesting
-     *          user name attribute, false otherwise.
+     * @param  object {@code Object} to compare to
+     * @return {@code true} if {@code object} is equivalent to this requesting
+     *         user name attribute, {@code false} otherwise
      */
     public boolean equals(Object object) {
         return (super.equals(object) &&
@@ -102,12 +98,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class RequestingUserName, the
-     * category is class RequestingUserName itself.
+     * <p>
+     * For class {@code RequestingUserName}, the category is class
+     * {@code RequestingUserName} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return RequestingUserName.class;
@@ -116,14 +112,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class RequestingUserName, the
-     * category name is {@code "requesting-user-name"}.
+     * <p>
+     * For class {@code RequestingUserName}, the category name is
+     * {@code "requesting-user-name"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "requesting-user-name";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Severity.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Severity.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,54 +22,53 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
+import javax.print.attribute.Attribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.Attribute;
 
 /**
- * Class Severity is a printing attribute class, an enumeration, that denotes
- * the severity of a {@link PrinterStateReason PrinterStateReason} attribute.
- * <P>
- * Instances of Severity do not appear in a Print Service's attribute set
- * directly. Rather, a {@link PrinterStateReasons PrinterStateReasons}
+ * Class {@code Severity} is a printing attribute class, an enumeration, that
+ * denotes the severity of a {@link PrinterStateReason PrinterStateReason}
+ * attribute.
+ * <p>
+ * Instances of {@code Severity} do not appear in a Print Service's attribute
+ * set directly. Rather, a {@link PrinterStateReasons PrinterStateReasons}
  * attribute appears in the Print Service's attribute set.
- *  The {@link PrinterStateReasons
- * PrinterStateReasons} attribute contains zero, one, or more than one {@link
- * PrinterStateReason PrinterStateReason} objects which pertain to the Print
- * Service's status, and each {@link PrinterStateReason PrinterStateReason}
- * object is associated with a Severity level of REPORT (least severe),
- * WARNING, or ERROR (most severe).
- * The printer adds a {@link PrinterStateReason
- * PrinterStateReason} object to the Print Service's
+ * The {@link PrinterStateReasons PrinterStateReasons} attribute contains zero,
+ * one, or more than one {@link PrinterStateReason PrinterStateReason} objects
+ * which pertain to the Print Service's status, and each
+ * {@link PrinterStateReason PrinterStateReason} object is associated with a
+ * Severity level of {@code REPORT} (least severe), {@code WARNING}, or
+ * {@code ERROR} (most severe). The printer adds a
+ * {@link PrinterStateReason PrinterStateReason} object to the Print Service's
  * {@link PrinterStateReasons PrinterStateReasons} attribute when the
- * corresponding condition becomes true
- * of the printer, and the printer removes the {@link PrinterStateReason
- * PrinterStateReason} object again when the corresponding condition becomes
- * false, regardless of whether the Print Service's overall
- * {@link PrinterState PrinterState} also changed.
- * <P>
- * <B>IPP Compatibility:</B>
- * {@code Severity.toString()} returns either "error", "warning", or
- * "report".  The string values returned by
- * each individual {@link PrinterStateReason} and
- * associated {@link Severity} object's {@code toString()}
- * methods, concatenated together with a hyphen ({@code "-"}) in
- * between, gives the IPP keyword value for a {@link PrinterStateReasons}.
- * The category name returned by {@code getName()} gives the IPP
- * attribute name.
+ * corresponding condition becomes true of the printer, and the printer removes
+ * the {@link PrinterStateReason PrinterStateReason} object again when the
+ * corresponding condition becomes false, regardless of whether the Print
+ * Service's overall {@link PrinterState PrinterState} also changed.
+ * <p>
+ * <b>IPP Compatibility:</b> {@code Severity.toString()} returns either "error",
+ * "warning", or "report". The string values returned by each individual
+ * {@link PrinterStateReason} and associated {@link Severity} object's
+ * {@code toString()} methods, concatenated together with a hyphen ({@code "-"})
+ * in between, gives the IPP keyword value for a {@link PrinterStateReasons}.
+ * The category name returned by {@code getName()} gives the IPP attribute name.
  *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
 public final class Severity extends EnumSyntax implements Attribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 8781881462717925380L;
 
     /**
      * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
-     * "report" (least severe). An implementation may choose to omit some or
-     * all reports.
-     * Some reports specify finer granularity about the printer state;
+     * "report" (least severe). An implementation may choose to omit some or all
+     * reports. Some reports specify finer granularity about the printer state;
      * others serve as a precursor to a warning. A report must contain nothing
      * that could affect the printed output.
      */
@@ -78,36 +77,41 @@
     /**
      * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
      * "warning." An implementation may choose to omit some or all warnings.
-     * Warnings serve as a precursor to an error. A warning must contain
-     * nothing  that prevents a job from completing, though in some cases the
-     * output may be of lower quality.
+     * Warnings serve as a precursor to an error. A warning must contain nothing
+     * that prevents a job from completing, though in some cases the output may
+     * be of lower quality.
      */
     public static final Severity WARNING = new Severity (1);
 
     /**
      * Indicates that the {@link PrinterStateReason PrinterStateReason} is an
-     * "error" (most severe). An implementation must include all errors.
-     * If this attribute contains one or more errors, the printer's
-     * {@link PrinterState PrinterState} must be STOPPED.
+     * "error" (most severe). An implementation must include all errors. If this
+     * attribute contains one or more errors, the printer's
+     * {@link PrinterState PrinterState} must be {@code STOPPED}.
      */
     public static final Severity ERROR = new Severity (2);
 
     /**
-     * Construct a new severity enumeration value with the given integer
-     * value.
+     * Construct a new severity enumeration value with the given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected Severity(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code Severity}.
+     */
     private static final String[] myStringTable = {
         "report",
         "warning",
         "error"
     };
 
+    /**
+     * The enumeration value table for class {@code Severity}.
+     */
     private static final Severity[] myEnumValueTable = {
         REPORT,
         WARNING,
@@ -115,28 +119,28 @@
     };
 
     /**
-     * Returns the string table for class Severity.
+     * Returns the string table for class {@code Severity}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class Severity.
+     * Returns the enumeration value table for class {@code Severity}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
     }
 
-
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class Severity, the category is class Severity itself.
+     * <p>
+     * For class {@code Severity}, the category is class
+     * {@code Severity} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return Severity.class;
@@ -145,13 +149,12 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class Severit, the category name is {@code "severity"}.
+     * <p>
+     * For class {@code Severity}, the category name is {@code "severity"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "severity";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/SheetCollate.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/SheetCollate.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,146 +22,134 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.DocAttribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class SheetCollate is a printing attribute class, an enumeration, that
- * specifies whether or not the media sheets of each copy of each printed
+ * Class {@code SheetCollate} is a printing attribute class, an enumeration,
+ * that specifies whether or not the media sheets of each copy of each printed
  * document in a job are to be in sequence, when multiple copies of the document
- * are specified by the {@link Copies Copies} attribute. When SheetCollate is
- * COLLATED, each copy of each document is printed with the print-stream sheets
- * in sequence. When SheetCollate is UNCOLLATED, each print-stream sheet is
- * printed a number of times equal to the value of the {@link Copies Copies}
- * attribute in succession. For example, suppose a document produces two media
- * sheets as output, {@link Copies Copies} is 6, and SheetCollate is UNCOLLATED;
- * in this case six copies of the first media sheet are printed followed by
- * six copies of the second media sheet.
- * <P>
+ * are specified by the {@link Copies Copies} attribute. When
+ * {@code SheetCollate} is {@code COLLATED}, each copy of each document is
+ * printed with the print-stream sheets in sequence. When {@code SheetCollate}
+ * is {@code UNCOLLATED}, each print-stream sheet is printed a number of times
+ * equal to the value of the {@link Copies Copies} attribute in succession. For
+ * example, suppose a document produces two media sheets as output,
+ * {@link Copies Copies} is 6, and {@code SheetCollate} is UNCOLLATED; in this
+ * case six copies of the first media sheet are printed followed by six copies
+ * of the second media sheet.
+ * <p>
  * Whether the effect of sheet collation is achieved by placing copies of a
  * document in multiple output bins or in the same output bin with
- * implementation defined document separation is implementation dependent.
- * Also whether it is achieved by making multiple passes over the job or by
- * using an output sorter is implementation dependent.
- * <P>
- * If a printer does not support the SheetCollate attribute (meaning the client
- * cannot specify any particular sheet collation), the printer must behave as
- * though SheetCollate were always set to COLLATED.
- * <P>
- * The SheetCollate attribute interacts with the {@link MultipleDocumentHandling
- * MultipleDocumentHandling} attribute. The {@link MultipleDocumentHandling
- * MultipleDocumentHandling} attribute describes the collation of entire
- * documents, and the SheetCollate attribute describes the semantics of
- * collating individual pages within a document.
- * <P>
- * The effect of a SheetCollate attribute on a multidoc print job (a job with
- * multiple documents) depends on whether all the docs have the same sheet
- * collation specified or whether different docs have different sheet
- * collations specified, and on the (perhaps defaulted) value of the {@link
- * MultipleDocumentHandling MultipleDocumentHandling} attribute.
- * <UL>
- * <LI>
- * If all the docs have the same sheet collation specified, then the following
- * combinations of SheetCollate and {@link MultipleDocumentHandling
- * MultipleDocumentHandling} are permitted, and the printer reports an error
- * when the job is submitted if any other combination is specified:
- * <UL>
- * <LI>
- * SheetCollate = COLLATED, {@link MultipleDocumentHandling
- * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
- * combined into one output document. Multiple copies of the output document
- * will be produced with pages in collated order, i.e. pages 1, 2, 3, . . .,
- * 1, 2, 3, . . .
- *
- * <LI>
- * SheetCollate = COLLATED, {@link MultipleDocumentHandling
- * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs
- * will be combined into one output document, and the first impression of each
- * input doc will always start on a new media sheet. Multiple copies of the
- * output document will be produced with pages in collated order, i.e. pages
- * 1, 2, 3, . . ., 1, 2, 3, . . .
- *
- * <LI>
- * SheetCollate = COLLATED, {@link MultipleDocumentHandling
- * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
- * input doc will remain a separate output document. Multiple copies of each
- * output document (call them A, B, . . .) will be produced with each document's
- * pages in collated order, but the documents themselves in uncollated order,
- * i.e. pages A1, A2, A3, . . ., A1, A2, A3, . . ., B1, B2, B3, . . ., B1, B2,
- * B3, . . .
+ * implementation defined document separation is implementation dependent. Also
+ * whether it is achieved by making multiple passes over the job or by using an
+ * output sorter is implementation dependent.
+ * <p>
+ * If a printer does not support the {@code SheetCollate} attribute (meaning the
+ * client cannot specify any particular sheet collation), the printer must
+ * behave as though {@code SheetCollate} were always set to {@code COLLATED}.
+ * <p>
+ * The {@code SheetCollate} attribute interacts with the
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute. The
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute describes
+ * the collation of entire documents, and the {@code SheetCollate} attribute
+ * describes the semantics of collating individual pages within a document.
+ * <p>
+ * The effect of a {@code SheetCollate} attribute on a multidoc print job (a job
+ * with multiple documents) depends on whether all the docs have the same sheet
+ * collation specified or whether different docs have different sheet collations
+ * specified, and on the (perhaps defaulted) value of the
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute.
+ * <ul>
+ *   <li>If all the docs have the same sheet collation specified, then the
+ *   following combinations of {@code SheetCollate} and
+ *   {@link MultipleDocumentHandling MultipleDocumentHandling} are permitted,
+ *   and the printer reports an error when the job is submitted if any other
+ *   combination is specified:
+ *   <ul>
+ *     <li>SheetCollate = COLLATED, {@link MultipleDocumentHandling
+ *     MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
+ *     combined into one output document. Multiple copies of the output document
+ *     will be produced with pages in collated order, i.e. pages 1, 2, 3, . . .,
+ *     1, 2, 3, . . .
+ *     <li>SheetCollate = COLLATED, {@link MultipleDocumentHandling
+ *     MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input
+ *     docs will be combined into one output document, and the first impression
+ *     of each input doc will always start on a new media sheet. Multiple copies
+ *     of the output document will be produced with pages in collated order,
+ *     i.e. pages 1, 2, 3, . . ., 1, 2, 3, . . .
+ *     <li>SheetCollate = COLLATED, {@link MultipleDocumentHandling
+ *     MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
+ *     input doc will remain a separate output document. Multiple copies of each
+ *     output document (call them A, B, . . .) will be produced with each
+ *     document's pages in collated order, but the documents themselves in
+ *     uncollated order, i.e. pages A1, A2, A3, . . ., A1, A2, A3, . . ., B1,
+ *     B2, B3, . . ., B1, B2, B3, . . .
+ *     <li>SheetCollate = COLLATED, {@link MultipleDocumentHandling
+ *     MultipleDocumentHandling} = SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each
+ *     input doc will remain a separate output document. Multiple copies of each
+ *     output document (call them A, B, . . .) will be produced with each
+ *     document's pages in collated order, with the documents themselves also in
+ *     collated order, i.e. pages A1, A2, A3, . . ., B1, B2, B3, . . ., A1, A2,
+ *     A3, . . ., B1, B2, B3, . . .
+ *     <li>SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
+ *     MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
+ *     combined into one output document. Multiple copies of the output document
+ *     will be produced with pages in uncollated order, i.e. pages 1, 1, . . .,
+ *     2, 2, . . ., 3, 3, . . .
+ *     <li>SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
+ *     MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input
+ *     docs will be combined into one output document, and the first impression
+ *     of each input doc will always start on a new media sheet. Multiple copies
+ *     of the output document will be produced with pages in uncollated order,
+ *     i.e. pages 1, 1, . . ., 2, 2, . . ., 3, 3, . . .
+ *     <li>SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
+ *     MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
+ *     input doc will remain a separate output document. Multiple copies of each
+ *     output document (call them A, B, . . .) will be produced with each
+ *     document's pages in uncollated order, with the documents themselves also
+ *     in uncollated order, i.e. pages A1, A1, . . ., A2, A2, . . ., A3, A3, . .
+ *     ., B1, B1, . . ., B2, B2, . . ., B3, B3, . . .
+ *   </ul>
+ *   <li>If different docs have different sheet collations specified, then only
+ *   one value of {@link MultipleDocumentHandling MultipleDocumentHandling} is
+ *   permitted, and the printer reports an error when the job is submitted if
+ *   any other value is specified:
+ *   <ul>
+ *     <li>{@link MultipleDocumentHandling MultipleDocumentHandling} =
+ *     SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will remain a
+ *     separate output document. Multiple copies of each output document (call
+ *     them A, B, . . .) will be produced with each document's pages in collated
+ *     or uncollated order as the corresponding input doc's SheetCollate
+ *     attribute specifies, and with the documents themselves in uncollated
+ *     order. If document A had SheetCollate = UNCOLLATED and document B had
+ *     SheetCollate = COLLATED, the following pages would be produced: A1, A1, .
+ *     . ., A2, A2, . . ., A3, A3, . . ., B1, B2, B3, . . ., B1, B2, B3, . . .
+ *   </ul>
+ * </ul>
+ * <p>
+ * <b>IPP Compatibility:</b> SheetCollate is not an IPP attribute at present.
  *
- * <LI>
- * SheetCollate = COLLATED, {@link MultipleDocumentHandling
- * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input
- * doc will remain a separate output document. Multiple copies of each output
- * document (call them A, B, . . .) will be produced with each document's pages
- * in collated order, with the documents themselves also in collated order, i.e.
- * pages A1, A2, A3, . . ., B1, B2, B3, . . ., A1, A2, A3, . . ., B1, B2, B3,
- * . . .
- *
- * <LI>
- * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
- * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be
- * combined into one output document. Multiple copies of the output document
- * will be produced with pages in uncollated order, i.e. pages 1, 1, . . .,
- * 2, 2, . . ., 3, 3, . . .
- *
- * <LI>
- * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
- * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs
- * will be combined into one output document, and the first impression of each
- * input doc will always start on a new media sheet. Multiple copies of the
- * output document will be produced with pages in uncollated order, i.e. pages
- * 1, 1, . . ., 2, 2, . . ., 3, 3, . . .
- *
- * <LI>
- * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling
- * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each
- * input doc will remain a separate output document. Multiple copies of each
- * output document (call them A, B, . . .) will be produced with each document's
- * pages in uncollated order, with the documents themselves also in uncollated
- * order, i.e. pages A1, A1, . . ., A2, A2, . . ., A3, A3, . . ., B1, B1, . . .,
- * B2, B2, . . ., B3, B3, . . .
- * </UL>
- *
- * <LI>
- * If different docs have different sheet collations specified, then only one
- * value of {@link MultipleDocumentHandling MultipleDocumentHandling} is
- * permitted, and the printer reports an error when the job is submitted if any
- * other value is specified:
- * <UL>
- * <LI>
- * {@link MultipleDocumentHandling MultipleDocumentHandling} =
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will remain a separate
- * output document. Multiple copies of each output document (call them A, B,
- * . . .) will be produced with each document's pages in collated or uncollated
- * order as the corresponding input doc's SheetCollate attribute specifies, and
- * with the documents themselves in uncollated order. If document A had
- * SheetCollate = UNCOLLATED and document B had SheetCollate = COLLATED, the
- * following pages would be produced: A1, A1, . . ., A2, A2, . . ., A3, A3,
- * . . ., B1, B2, B3, . . ., B1, B2, B3, . . .
- * </UL>
- * </UL>
- * <P>
- * <B>IPP Compatibility:</B> SheetCollate is not an IPP attribute at present.
- *
- * @see  MultipleDocumentHandling
- *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
+ * @see MultipleDocumentHandling
  */
 public final class SheetCollate extends EnumSyntax
     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 7080587914259873003L;
 
     /**
-     * Sheets within a document appear in uncollated order when multiple
-     * copies are printed.
+     * Sheets within a document appear in uncollated order when multiple copies
+     * are printed.
      */
     public static final SheetCollate UNCOLLATED = new SheetCollate(0);
 
@@ -175,31 +163,37 @@
      * Construct a new sheet collate enumeration value with the given integer
      * value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected SheetCollate(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code SheetCollate}.
+     */
     private static final String[] myStringTable = {
         "uncollated",
         "collated"
     };
 
+    /**
+     * The enumeration value table for class {@code SheetCollate}.
+     */
     private static final SheetCollate[] myEnumValueTable = {
         UNCOLLATED,
         COLLATED
     };
 
     /**
-     * Returns the string table for class SheetCollate.
+     * Returns the string table for class {@code SheetCollate}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class SheetCollate.
+     * Returns the enumeration value table for class {@code SheetCollate}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
@@ -208,11 +202,12 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class SheetCollate, the category is class SheetCollate itself.
+     * <p>
+     * For class {@code SheetCollate}, the category is class
+     * {@code SheetCollate} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return SheetCollate.class;
@@ -221,13 +216,13 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class SheetCollate, the category name is {@code "sheet-collate"}.
+     * <p>
+     * For class {@code SheetCollate}, the category name is
+     * {@code "sheet-collate"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "sheet-collate";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Sides.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Sides.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -22,104 +22,96 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package javax.print.attribute.standard;
 
 import javax.print.attribute.Attribute;
+import javax.print.attribute.DocAttribute;
 import javax.print.attribute.EnumSyntax;
-import javax.print.attribute.DocAttribute;
+import javax.print.attribute.PrintJobAttribute;
 import javax.print.attribute.PrintRequestAttribute;
-import javax.print.attribute.PrintJobAttribute;
 
 /**
- * Class Sides is a printing attribute class, an enumeration, that specifies
- * how print-stream pages are to be imposed upon the sides of an instance of a
- * selected medium, i.e., an impression.
- * <P>
- * The effect of a Sides attribute on a multidoc print job (a job with multiple
- * documents) depends on whether all the docs have the same sides values
- * specified or whether different docs have different sides values specified,
- * and on the (perhaps defaulted) value of the {@link MultipleDocumentHandling
- * MultipleDocumentHandling} attribute.
- * <UL>
- * <LI>
- * If all the docs have the same sides value <I>n</I> specified, then any value
- * of {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense,
- * and the printer's processing depends on the {@link MultipleDocumentHandling
- * MultipleDocumentHandling} value:
- * <UL>
- * <LI>
- * SINGLE_DOCUMENT -- All the input docs will be combined together into one
- * output document. Each media sheet will consist of <I>n</I> impressions from
- * the output document.
- *
- * <LI>
- * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
- * into one output document. Each media sheet will consist of <I>n</I>
- * impressions from the output document. However, the first impression of each
- * input doc will always start on a new media sheet; this means the last media
- * sheet of an input doc may have only one impression on it.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
- * Each media sheet will consist of <I>n</I> impressions from the input doc.
- * Since the input docs are separate, the first impression of each input doc
- * will always start on a new media sheet; this means the last media sheet of
- * an input doc may have only one impression on it.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
- * Each media sheet will consist of <I>n</I> impressions from the input doc.
- * Since the input docs are separate, the first impression of each input doc
- * will always start on a new media sheet; this means the last media sheet of
- * an input doc may have only one impression on it.
- * </UL>
+ * Class {@code Sides} is a printing attribute class, an enumeration, that
+ * specifies how print-stream pages are to be imposed upon the sides of an
+ * instance of a selected medium, i.e., an impression.
+ * <p>
+ * The effect of a {@code Sides} attribute on a multidoc print job (a job with
+ * multiple documents) depends on whether all the docs have the same sides
+ * values specified or whether different docs have different sides values
+ * specified, and on the (perhaps defaulted) value of the
+ * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute.
+ * <ul>
+ *   <li>If all the docs have the same sides value <i>n</i> specified, then any
+ *   value of {@link MultipleDocumentHandling MultipleDocumentHandling} makes
+ *   sense, and the printer's processing depends on the
+ *   {@link MultipleDocumentHandling MultipleDocumentHandling} value:
+ *   <ul>
+ *     <li>{@code SINGLE_DOCUMENT} -- All the input docs will be combined
+ *     together into one output document. Each media sheet will consist of
+ *     <i>n</i> impressions from the output document.
+ *     <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be
+ *     combined together into one output document. Each media sheet will consist
+ *     of <i>n</i> impressions from the output document. However, the first
+ *     impression of each input doc will always start on a new media sheet; this
+ *     means the last media sheet of an input doc may have only one impression
+ *     on it.
+ *     <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will
+ *     remain separate. Each media sheet will consist of <i>n</i> impressions
+ *     from the input doc. Since the input docs are separate, the first
+ *     impression of each input doc will always start on a new media sheet; this
+ *     means the last media sheet of an input doc may have only one impression
+ *     on it.
+ *     <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will
+ *     remain separate. Each media sheet will consist of <i>n</i> impressions
+ *     from the input doc. Since the input docs are separate, the first
+ *     impression of each input doc will always start on a new media sheet; this
+ *     means the last media sheet of an input doc may have only one impression
+ *     on it.
+ *   </ul>
+ *   <ul>
+ *     <li>{@code SINGLE_DOCUMENT} -- All the input docs will be combined
+ *     together into one output document. Each media sheet will consist of
+ *     <i>n<sub>i</sub></i> impressions from the output document, where <i>i</i>
+ *     is the number of the input doc corresponding to that point in the output
+ *     document. When the next input doc has a different sides value from the
+ *     previous input doc, the first print-stream page of the next input doc
+ *     goes at the start of the next media sheet, possibly leaving only one
+ *     impression on the previous media sheet.
+ *     <li>{@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be
+ *     combined together into one output document. Each media sheet will consist
+ *     of <i>n</i> impressions from the output document. However, the first
+ *     impression of each input doc will always start on a new media sheet; this
+ *     means the last impression of an input doc may have only one impression on
+ *     it.
+ *     <li>{@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will
+ *     remain separate. For input doc <i>i,</i> each media sheet will consist of
+ *     <i>n<sub>i</sub></i> impressions from the input doc. Since the input docs
+ *     are separate, the first impression of each input doc will always start on
+ *     a new media sheet; this means the last media sheet of an input doc may
+ *     have only one impression on it.
+ *     <li>{@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will
+ *     remain separate. For input doc <i>i,</i> each media sheet will consist of
+ *     <i>n<sub>i</sub></i> impressions from the input doc. Since the input docs
+ *     are separate, the first impression of each input doc will always start on
+ *     a new media sheet; this means the last media sheet of an input doc may
+ *     have only one impression on it.
+ *   </ul>
+ * </ul>
+ * <p>
+ * <b>IPP Compatibility:</b> The category name returned by {@code getName()} is
+ * the IPP attribute name. The enumeration's integer value is the IPP enum
+ * value. The {@code toString()} method returns the IPP string representation of
+ * the attribute value.
  *
- * <UL>
- * <LI>
- * SINGLE_DOCUMENT -- All the input docs will be combined together into one
- * output document. Each media sheet will consist of <I>n<SUB>i</SUB></I>
- * impressions from the output document, where <I>i</I> is the number of the
- * input doc corresponding to that point in the output document. When the next
- * input doc has a different sides value from the previous input doc, the first
- * print-stream page of the next input doc goes at the start of the next media
- * sheet, possibly leaving only one impression on the previous media sheet.
- *
- * <LI>
- * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together
- * into one output document. Each media sheet will consist of <I>n</I>
- * impressions from the output document. However, the first impression of each
- * input doc will always start on a new media sheet; this means the last
- * impression of an input doc may have only one impression on it.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate.
- * For input doc <I>i,</I> each media sheet will consist of <I>n<SUB>i</SUB></I>
- * impressions from the input doc. Since the input docs are separate, the first
- * impression of each input doc will always start on a new media sheet; this
- * means the last media sheet of an input doc may have only one impression on
- * it.
- *
- * <LI>
- * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate.
- * For input doc <I>i,</I> each media sheet will consist of <I>n<SUB>i</SUB></I>
- * impressions from the input doc. Since the input docs are separate, the first
- * impression of each input doc will always start on a new media sheet; this
- * means the last media sheet of an input doc may have only one impression on
- * it.
- * </UL>
- * </UL>
- * <P>
- * <B>IPP Compatibility:</B> The category name returned by
- * {@code getName()} is the IPP attribute name.  The enumeration's
- * integer value is the IPP enum value.  The {@code toString()} method
- * returns the IPP string representation of the attribute value.
- *
- * @author  Alan Kaminsky
+ * @author Alan Kaminsky
  */
-
 public final class Sides extends EnumSyntax
     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -6890309414893262822L;
 
     /**
@@ -130,49 +122,55 @@
 
     /**
      * Imposes each consecutive pair of print-stream pages upon front and back
-     * sides of consecutive media sheets, such that the orientation of each
-     * pair of print-stream pages on the medium would be correct for the
-     * reader as if for binding on the long edge. This imposition is also
-     * known as "duplex" (see {@link #DUPLEX DUPLEX}).
+     * sides of consecutive media sheets, such that the orientation of each pair
+     * of print-stream pages on the medium would be correct for the reader as if
+     * for binding on the long edge. This imposition is also known as "duplex"
+     * (see {@link #DUPLEX DUPLEX}).
      */
     public static final Sides TWO_SIDED_LONG_EDGE = new Sides(1);
 
     /**
      * Imposes each consecutive pair of print-stream pages upon front and back
-     * sides of consecutive media sheets, such that the orientation of each
-     * pair of print-stream pages on the medium would be correct for the
-     * reader as if for binding on the short edge. This imposition is also
-     * known as "tumble" (see {@link #TUMBLE TUMBLE}).
+     * sides of consecutive media sheets, such that the orientation of each pair
+     * of print-stream pages on the medium would be correct for the reader as if
+     * for binding on the short edge. This imposition is also known as "tumble"
+     * (see {@link #TUMBLE TUMBLE}).
      */
     public static final Sides TWO_SIDED_SHORT_EDGE = new Sides(2);
 
     /**
-     * An alias for "two sided long edge" (see {@link #TWO_SIDED_LONG_EDGE
-     * TWO_SIDED_LONG_EDGE}).
+     * An alias for "two sided long edge" (see
+     * {@link #TWO_SIDED_LONG_EDGE TWO_SIDED_LONG_EDGE}).
      */
     public static final Sides DUPLEX = TWO_SIDED_LONG_EDGE;
 
     /**
-     * An alias for "two sided short edge" (see {@link #TWO_SIDED_SHORT_EDGE
-     * TWO_SIDED_SHORT_EDGE}).
+     * An alias for "two sided short edge" (see
+     * {@link #TWO_SIDED_SHORT_EDGE TWO_SIDED_SHORT_EDGE}).
      */
     public static final Sides TUMBLE = TWO_SIDED_SHORT_EDGE;
 
     /**
      * Construct a new sides enumeration value with the given integer value.
      *
-     * @param  value  Integer value.
+     * @param  value Integer value
      */
     protected Sides(int value) {
         super (value);
     }
 
+    /**
+     * The string table for class {@code Sides}.
+     */
     private static final String[] myStringTable = {
         "one-sided",
         "two-sided-long-edge",
         "two-sided-short-edge"
     };
 
+    /**
+     * The enumeration value table for class {@code Sides}.
+     */
     private static final Sides[] myEnumValueTable = {
         ONE_SIDED,
         TWO_SIDED_LONG_EDGE,
@@ -180,14 +178,14 @@
     };
 
     /**
-     * Returns the string table for class Sides.
+     * Returns the string table for class {@code Sides}.
      */
     protected String[] getStringTable() {
         return myStringTable;
     }
 
     /**
-     * Returns the enumeration value table for class Sides.
+     * Returns the enumeration value table for class {@code Sides}.
      */
     protected EnumSyntax[] getEnumValueTable() {
         return myEnumValueTable;
@@ -196,11 +194,11 @@
     /**
      * Get the printing attribute class which is to be used as the "category"
      * for this printing attribute value.
-     * <P>
-     * For class Sides, the category is class Sides itself.
+     * <p>
+     * For class {@code Sides}, the category is class {@code Sides} itself.
      *
-     * @return  Printing attribute class (category), an instance of class
-     *          {@link java.lang.Class java.lang.Class}.
+     * @return printing attribute class (category), an instance of class
+     *         {@link Class java.lang.Class}
      */
     public final Class<? extends Attribute> getCategory() {
         return Sides.class;
@@ -209,13 +207,12 @@
     /**
      * Get the name of the category of which this attribute value is an
      * instance.
-     * <P>
-     * For class Sides, the category name is {@code "sides"}.
+     * <p>
+     * For class {@code Sides}, the category name is {@code "sides"}.
      *
-     * @return  Attribute category name.
+     * @return attribute category name
      */
     public final String getName() {
         return "sides";
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -24,8 +24,8 @@
  */
 
 /**
- * Package javax.print.attribute.standard contains classes for specific printing
- * attributes. The parent package, <a href="../package-summary.html">
+ * Package {@code javax.print.attribute.standard} contains classes for specific
+ * printing attributes. The parent package, <a href="../package-summary.html">
  * javax.print.attribute</a>, provides classes and interfaces that describe the
  * types of Java Print Service attributes and how they can be collected into
  * attribute sets.
@@ -43,19 +43,19 @@
  * support them. These support requirements are recorded in the documentation
  * for each attribute class.
  * <p>
- * Package javax.print.attribute.standard contains standard printing attributes
- * and standard printing attribute values that are widely used in the printing
- * domain. A print service vendor can provide new vendor-specific printing
- * attributes in addition to the standard ones. A vendor can also provide
- * vendor-specific extensions (subclasses) of the standard printing attributes
- * -- for example, to provide additional vendor-specific values for an existing
- * standard attribute. Of course, if a vendor wants clients to be able to use
- * any added or extended attributes, the vendor must publish the new attribute
- * classes.
+ * Package {@code javax.print.attribute.standard} contains standard printing
+ * attributes and standard printing attribute values that are widely used in the
+ * printing domain. A print service vendor can provide new vendor-specific
+ * printing attributes in addition to the standard ones. A vendor can also
+ * provide vendor-specific extensions (subclasses) of the standard printing
+ * attributes -- for example, to provide additional vendor-specific values for
+ * an existing standard attribute. Of course, if a vendor wants clients to be
+ * able to use any added or extended attributes, the vendor must publish the new
+ * attribute classes.
  * <p>
  * Many of the standard attribute classes extend one of the abstract syntax
- * classes of the javax.print.attribute package. These abstract syntax classes
- * each represent a different type. The <a href="../EnumSyntax.html">
+ * classes of the {@code javax.print.attribute} package. These abstract syntax
+ * classes each represent a different type. The <a href="../EnumSyntax.html">
  * EnumSyntax</a> class, for example, represents a type-safe enumeration. The
  * abstract syntax class provides a wrapper for the attribute value.
  * <p>
@@ -73,9 +73,9 @@
  * attribute classes in package javax.print.attribute.standard, just the ones
  * that pertain to the application.
  * <p>
- * The attribute classes in package javax.print.attribute.standard are based on
- * the Internet Printing Protocol (IPP) attributes as defined in the Internet
- * RFC document, <i>RFC 2911 Internet Printing Protocol/1.1: Model and
+ * The attribute classes in package {@code javax.print.attribute.standard} are
+ * based on the Internet Printing Protocol (IPP) attributes as defined in the
+ * Internet RFC document, <i>RFC 2911 Internet Printing Protocol/1.1: Model and
  * Semantics</i> dated September 2000. See
  * <a href="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911</a> for more
  * information. The descriptive text for each attribute class was taken largely
@@ -152,485 +152,418 @@
  * indicates the supported values for that attribute category.
  * <table border=1 cellpadding=2 cellspacing=1 summary="Lists all printing
  * attributes as described in above text">
- *     <tr style="background-color:#E5E5E5">
- *         <th valign="bottom">Attribute Class</th>
- *         <th valign="bottom">Doc<br>Attribute</th>
- *         <th valign="bottom">Print<br>Request<br>Attribute</th>
- *         <th valign="bottom">Print<br>Job<br>Attribute</th>
- *         <th valign="bottom">Print<br>Service<br>Attribute</th>
- *         <th valign="bottom">SupportedValuesAttribute</th>
- *     </tr>
- *     <tr>
- *         <td><a href="Compression.html">Compression</a></td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="DocumentName.html">DocumentName</a></td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="Chromaticity.html">Chromaticity</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="Copies.html">Copies</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td><a href="CopiesSupported.html">CopiesSupported</a></td>
- *     </tr>
- *     <tr>
- *         <td><a href="Finishings.html">Finishings</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobHoldUntil.html">JobHoldUntil</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobImpressions.html">JobImpressions</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td><a href="JobImpressionsSupported.html">
- *             JobImpressionsSupported</a></td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobKOctets.html">JobKOctets</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td><a href="JobKOctetsSupported.html">JobKOctetsSupported</a></td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobMediaSheets.html">JobMediaSheets</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td><a href="JobMediaSheetsSupported.html">
- *             JobMediaSheetsSupported</a></td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobName.html">JobName</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobPriority.html">JobPriority</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td><a href="JobPrioritySupported.html">JobPrioritySupported</a></td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobSheets.html">JobSheets</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="Media.html">Media</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="MediaSize.html">MediaSize</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="MultipleDocumentHandling.html">
- *             MultipleDocumentHandling</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="NumberUp.html">NumberUp</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td><a href="NumberUpSupported.html">NumberUpSupported</a></td>
- *     </tr>
- *     <tr>
- *         <td><a href="OrientationRequested.html">OrientationRequested</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PageRanges.html">PageRanges</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PresentationDirection.html">
- *             PresentationDirection</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterResolution.html">PrinterResolution</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrintQuality.html">PrintQuality</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="RequestingUserName.html">RequestingUserName</a></td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="SheetCollate.html">SheetCollate</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="Sides.html">Sides</a></td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="DateTimeAtCompleted.html">DateTimeAtCompleted</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="DateTimeAtCreation.html">DateTimeAtCreation</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="DateTimeAtProcessing.html">DateTimeAtProcessing</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobImpressionsCompleted.html">
- *             JobImpressionsCompleted</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobKOctetsProcessed.html">JobKOctetsProcessed</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobMediaSheetsCompleted.html">
- *             JobMediaSheetsCompleted</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobMessageFromOperator.html">
- *             JobMessageFromOperator</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobOriginatingUserName.html">
- *             JobOriginatingUserName</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="JobState.html">JobState</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         </tr>
- *     <tr>
- *         <td><a href="JobStateReasons.html">JobStateReasons</a><br>
- *             Contains zero or more --</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td>-- <a href="JobStateReason.html">JobStateReason</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="NumberOfDocuments.html">NumberOfDocuments</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="NumberOfInterveningJobs.html">
- *             NumberOfInterveningJobs</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="OutputDeviceAssigned.html">OutputDeviceAssigned</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="ColorSupported.html">ColorSupported</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PagesPerMinute.html">PagesPerMinute</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PagesPerMinuteColor.html">PagesPerMinuteColor</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PDLOverrideSupported.html">PDLOverrideSupported</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterIsAcceptingJobs.html">
- *             PrinterIsAcceptingJobs</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterInfo.html">PrinterInfo</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterLocation.html">PrinterLocation</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterMessageFromOperator.html">
- *             PrinterMessageFromOperator</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterMakeAndModel.html">PrinterMakeAndModel</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterMoreInfo.html">PrinterMoreInfo</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterMoreInfoManufacturer.html">
- *             PrinterMoreInfoManufacturer</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterName.html">PrinterName</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterState.html">PrinterState</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="PrinterStateReasons.html">PrinterStateReasons</a><br>
- *             Contains zero or more --</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td>-- <a href="PrinterStateReason.html">PrinterStateReason</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td>-- <a href="Severity.html">Severity</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="QueuedJobCount.html">QueuedJobCount</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td align="center">X</td>
- *         <td>&nbsp;</td>
- *     </tr>
- *     <tr>
- *         <td><a href="ReferenceUriSchemesSupported.html">
- *             ReferenceUriSchemesSupported</a></td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *         <td>&nbsp;</td>
- *     </tr>
+ *   <tr style="background-color:#E5E5E5">
+ *     <th valign="bottom">Attribute Class
+ *     <th valign="bottom">Doc<br>Attribute
+ *     <th valign="bottom">Print<br>Request<br>Attribute
+ *     <th valign="bottom">Print<br>Job<br>Attribute
+ *     <th valign="bottom">Print<br>Service<br>Attribute
+ *     <th valign="bottom">SupportedValuesAttribute
+ *   <tr>
+ *     <td><a href="Compression.html">Compression</a>
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="DocumentName.html">DocumentName</a>
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="Chromaticity.html">Chromaticity</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="Copies.html">Copies</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td><a href="CopiesSupported.html">CopiesSupported</a>
+ *   <tr>
+ *     <td><a href="Finishings.html">Finishings</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobHoldUntil.html">JobHoldUntil</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobImpressions.html">JobImpressions</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td><a href="JobImpressionsSupported.html">JobImpressionsSupported</a>
+ *   <tr>
+ *     <td><a href="JobKOctets.html">JobKOctets</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td><a href="JobKOctetsSupported.html">JobKOctetsSupported</a>
+ *   <tr>
+ *     <td><a href="JobMediaSheets.html">JobMediaSheets</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td><a href="JobMediaSheetsSupported.html">JobMediaSheetsSupported</a>
+ *   <tr>
+ *     <td><a href="JobName.html">JobName</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobPriority.html">JobPriority</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td><a href="JobPrioritySupported.html">JobPrioritySupported</a>
+ *   <tr>
+ *     <td><a href="JobSheets.html">JobSheets</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="Media.html">Media</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="MediaSize.html">MediaSize</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="MultipleDocumentHandling.html">MultipleDocumentHandling</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="NumberUp.html">NumberUp</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td><a href="NumberUpSupported.html">NumberUpSupported</a>
+ *   <tr>
+ *     <td><a href="OrientationRequested.html">OrientationRequested</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PageRanges.html">PageRanges</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PresentationDirection.html">PresentationDirection</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterResolution.html">PrinterResolution</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrintQuality.html">PrintQuality</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="RequestingUserName.html">RequestingUserName</a>
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="SheetCollate.html">SheetCollate</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="Sides.html">Sides</a>
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="DateTimeAtCompleted.html">DateTimeAtCompleted</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="DateTimeAtCreation.html">DateTimeAtCreation</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="DateTimeAtProcessing.html">DateTimeAtProcessing</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobImpressionsCompleted.html">JobImpressionsCompleted</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobKOctetsProcessed.html">JobKOctetsProcessed</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobMediaSheetsCompleted.html">JobMediaSheetsCompleted</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobMessageFromOperator.html">JobMessageFromOperator</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobOriginatingUserName.html">JobOriginatingUserName</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobState.html">JobState</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="JobStateReasons.html">JobStateReasons</a><br>
+ *             Contains zero or more --
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td>-- <a href="JobStateReason.html">JobStateReason</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="NumberOfDocuments.html">NumberOfDocuments</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="NumberOfInterveningJobs.html">NumberOfInterveningJobs</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="OutputDeviceAssigned.html">OutputDeviceAssigned</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="ColorSupported.html">ColorSupported</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PagesPerMinute.html">PagesPerMinute</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PagesPerMinuteColor.html">PagesPerMinuteColor</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PDLOverrideSupported.html">PDLOverrideSupported</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterIsAcceptingJobs.html">PrinterIsAcceptingJobs</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterInfo.html">PrinterInfo</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterLocation.html">PrinterLocation</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterMessageFromOperator.html">
+ *             PrinterMessageFromOperator</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterMakeAndModel.html">PrinterMakeAndModel</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterMoreInfo.html">PrinterMoreInfo</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterMoreInfoManufacturer.html">
+ *             PrinterMoreInfoManufacturer</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterName.html">PrinterName</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterState.html">PrinterState</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="PrinterStateReasons.html">PrinterStateReasons</a><br>
+ *             Contains zero or more --
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td>-- <a href="PrinterStateReason.html">PrinterStateReason</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td>-- <a href="Severity.html">Severity</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="QueuedJobCount.html">QueuedJobCount</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td align="center">X
+ *     <td>&nbsp;
+ *   <tr>
+ *     <td><a href="ReferenceUriSchemesSupported.html">
+ *             ReferenceUriSchemesSupported</a>
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
+ *     <td>&nbsp;
  * </table>
  * <p>
- * Please note: In the javax.print APIs, a null reference parameter to methods
- * is incorrect unless explicitly documented on the method as having a
- * meaningful interpretation. Usage to the contrary is incorrect coding and may
- * result in a run time exception either immediately or at some later time.
- * IllegalArgumentException and NullPointerException are examples of typical and
- * acceptable run time exceptions for such cases.
+ * Please note: In the {@code javax.print} APIs, a {@code null} reference
+ * parameter to methods is incorrect unless explicitly documented on the method
+ * as having a meaningful interpretation. Usage to the contrary is incorrect
+ * coding and may result in a run time exception either immediately or at some
+ * later time. {@code IllegalArgumentException} and {@code NullPointerException}
+ * are examples of typical and acceptable run time exceptions for such cases.
  *
  * @since 1.4
  */
--- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintEvent.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintEvent.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -26,29 +26,31 @@
 package javax.print.event;
 
 /**
- *
- * Class PrintEvent is the super class of all Print Service API events.
+ * Class {@code PrintEvent} is the super class of all Print Service API events.
  */
-
 public class PrintEvent extends java.util.EventObject {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = 2286914924430763847L;
 
     /**
-     * Constructs a PrintEvent object.
-     * @param source is the source of the event
-     * @throws IllegalArgumentException if {@code source} is
-     *         {@code null}.
+     * Constructs a {@code PrintEvent} object.
+     *
+     * @param  source is the source of the event
+     * @throws IllegalArgumentException if {@code source} is {@code null}
      */
     public PrintEvent (Object source) {
         super(source);
     }
 
     /**
+     * Returns a string representation of this {@code PrintEvent}.
+     *
      * @return a message describing the event
      */
     public String toString() {
         return ("PrintEvent on " + getSource().toString());
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAdapter.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAdapter.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -26,27 +26,23 @@
 package javax.print.event;
 
 /**
-  * An abstract adapter class for receiving print job events.
-  * The methods in this class are empty.
-  * This class exists as a convenience for creating listener objects.
-  * Extend this class to create a {@link PrintJobEvent} listener and override
-  * the methods for the events of interest.  Unlike the
-  * {@link java.awt.event.ComponentListener ComponentListener}
-  * interface, this abstract interface provides null methods so that you
-  * only need to define the methods you need, rather than all of the methods.
-  *
-  */
-
+ * An abstract adapter class for receiving print job events. The methods in this
+ * class are empty. This class exists as a convenience for creating listener
+ * objects. Extend this class to create a {@link PrintJobEvent} listener and
+ * override the methods for the events of interest. Unlike the
+ * {@link java.awt.event.ComponentListener ComponentListener} interface, this
+ * abstract interface provides empty methods so that you only need to define the
+ * methods you need, rather than all of the methods.
+ */
 public abstract class PrintJobAdapter implements PrintJobListener {
 
     /**
-     * Called to notify the client that data has been successfully
-     * transferred to the print service, and the client may free
-     * local resources allocated for that data.  The client should
-     * not assume that the data has been completely printed after
-     * receiving this event.
+     * Called to notify the client that data has been successfully transferred
+     * to the print service, and the client may free local resources allocated
+     * for that data. The client should not assume that the data has been
+     * completely printed after receiving this event.
      *
-     * @param pje the event being notified
+     * @param  pje the event being notified
      */
     public void printDataTransferCompleted(PrintJobEvent pje)  {
     }
@@ -54,52 +50,46 @@
     /**
      * Called to notify the client that the job completed successfully.
      *
-     * @param pje the event being notified
+     * @param  pje the event being notified
      */
     public void printJobCompleted(PrintJobEvent pje)  {
     }
 
-
     /**
-     * Called to notify the client that the job failed to complete
-     * successfully and will have to be resubmitted.
+     * Called to notify the client that the job failed to complete successfully
+     * and will have to be resubmitted.
      *
-     * @param pje the event being notified
+     * @param  pje the event being notified
      */
     public void printJobFailed(PrintJobEvent pje)  {
     }
 
     /**
-     * Called to notify the client that the job was canceled
-     * by user or program.
+     * Called to notify the client that the job was canceled by user or program.
      *
-     * @param pje the event being notified
+     * @param  pje the event being notified
      */
     public void printJobCanceled(PrintJobEvent pje) {
     }
 
-
     /**
-     * Called to notify the client that no more events will be delivered.
-     * One cause of this event being generated is if the job
-     * has successfully completed, but the printing system
-     * is limited in capability and cannot verify this.
-     * This event is required to be delivered if none of the other
+     * Called to notify the client that no more events will be delivered. One
+     * cause of this event being generated is if the job has successfully
+     * completed, but the printing system is limited in capability and cannot
+     * verify this. This event is required to be delivered if none of the other
      * terminal events (completed/failed/canceled) are delivered.
      *
-     * @param pje the event being notified
+     * @param  pje the event being notified
      */
     public void printJobNoMoreEvents(PrintJobEvent pje)  {
     }
 
-
     /**
-     * Called to notify the client that some possibly user rectifiable
-     * problem occurs (eg printer out of paper).
+     * Called to notify the client that some possibly user rectifiable problem
+     * occurs (eg printer out of paper).
      *
-     * @param pje the event being notified
+     * @param  pje the event being notified
      */
     public void printJobRequiresAttention(PrintJobEvent pje)  {
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeEvent.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeEvent.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -30,23 +30,28 @@
 import javax.print.attribute.PrintJobAttributeSet;
 
 /**
- * Class PrintJobAttributeEvent encapsulates an event a PrintService
- * reports to let the client know that one or more printing attributes for a
- * PrintJob have changed.
+ * Class {@code PrintJobAttributeEvent} encapsulates an event a
+ * {@code PrintService} reports to let the client know that one or more printing
+ * attributes for a {@code PrintJob} have changed.
  */
-
 public class PrintJobAttributeEvent extends PrintEvent {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -6534469883874742101L;
 
+    /**
+     * The printing service attributes that changed.
+     */
     private PrintJobAttributeSet attributes;
 
     /**
-     * Constructs a PrintJobAttributeEvent object.
-     * @param source the print job generating  this event
-     * @param attributes the attribute changes being reported
-     * @throws IllegalArgumentException if {@code source} is
-     *         {@code null}.
+     * Constructs a {@code PrintJobAttributeEvent} object.
+     *
+     * @param  source the print job generating this event
+     * @param  attributes the attribute changes being reported
+     * @throws IllegalArgumentException if {@code source} is {@code null}
      */
     public PrintJobAttributeEvent (DocPrintJob source,
                                    PrintJobAttributeSet attributes)  {
@@ -55,28 +60,24 @@
         this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
     }
 
-
     /**
-     * Determine the Print Job to which this print job event pertains.
+     * Determine the {@code PrintJob} to which this print job event pertains.
      *
-     * @return  Print Job object.
+     * @return {@code PrintJob} object
      */
     public DocPrintJob getPrintJob() {
 
         return (DocPrintJob) getSource();
     }
 
-
     /**
      * Determine the printing attributes that changed and their new values.
      *
-     * @return  Attributes containing the new values for the print job
-     * attributes that changed. The returned set may not be modifiable.
+     * @return attributes containing the new values for the print job attributes
+     *         that changed. The returned set may not be modifiable.
      */
     public PrintJobAttributeSet getAttributes() {
 
         return attributes;
-
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeListener.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeListener.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -26,21 +26,19 @@
 package javax.print.event;
 
 /**
-  * Implementations of this interface are attached to a
-  * {@link javax.print.DocPrintJob DocPrintJob} to monitor
-  * the status of attribute changes associated with the print job.
-  *
-  */
+ * Implementations of this interface are attached to a
+ * {@link javax.print.DocPrintJob DocPrintJob} to monitor the status of
+ * attribute changes associated with the print job.
+ */
 public interface PrintJobAttributeListener {
 
     /**
-     * Notifies the listener of a change in some print job attributes.
-     * One example of an occurrence triggering this event is if the
-     * {@link javax.print.attribute.standard.JobState JobState}
-     * attribute changed from
-     * {@code PROCESSING} to {@code PROCESSING_STOPPED}.
-     * @param pjae the event.
+     * Notifies the listener of a change in some print job attributes. One
+     * example of an occurrence triggering this event is if the
+     * {@link javax.print.attribute.standard.JobState JobState} attribute
+     * changed from {@code PROCESSING} to {@code PROCESSING_STOPPED}.
+     *
+     * @param  pjae the event being notified
      */
     public void attributeUpdate(PrintJobAttributeEvent pjae) ;
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobEvent.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobEvent.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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,98 +28,95 @@
 import javax.print.DocPrintJob;
 
 /**
- *
- * Class {@code PrintJobEvent} encapsulates common events a print job
- * reports to let a listener know of progress in the processing of the
- * {@link DocPrintJob}.
- *
+ * Class {@code PrintJobEvent} encapsulates common events a print job reports to
+ * let a listener know of progress in the processing of the {@link DocPrintJob}.
  */
-
 public class PrintJobEvent extends PrintEvent {
 
-   private static final long serialVersionUID = -1711656903622072997L;
-
-   private int reason;
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
+    private static final long serialVersionUID = -1711656903622072997L;
 
-   /**
-    * The job was canceled by the {@link javax.print.PrintService PrintService}.
-    */
-   public static final int JOB_CANCELED   = 101;
+    /**
+     * The reason of this event.
+     */
+    private int reason;
 
-   /**
-    * The document cis completely printed.
-    */
-   public static final int JOB_COMPLETE       = 102;
+    /**
+     * The job was canceled by the
+     * {@link javax.print.PrintService PrintService}.
+     */
+    public static final int JOB_CANCELED = 101;
 
-   /**
-    * The print service reports that the job cannot be completed.
-    * The application must resubmit the job.
-    */
+    /**
+     * The document is completely printed.
+     */
+    public static final int JOB_COMPLETE = 102;
 
-   public static final int JOB_FAILED         = 103;
+    /**
+     * The print service reports that the job cannot be completed. The
+     * application must resubmit the job.
+     */
+    public static final int JOB_FAILED = 103;
 
-   /**
-    * The print service indicates that a - possibly transient - problem
-    * may require external intervention before the print service can
-    * continue.  One example of an event that can
-    * generate this message is when the printer runs out of paper.
-    */
-   public static final int REQUIRES_ATTENTION = 104;
+    /**
+     * The print service indicates that a - possibly transient - problem may
+     * require external intervention before the print service can continue. One
+     * example of an event that can generate this message is when the printer
+     * runs out of paper.
+     */
+    public static final int REQUIRES_ATTENTION = 104;
 
-   /**
-    * Not all print services may be capable of delivering interesting
-    * events, or even telling when a job is complete. This message indicates
-    * the print job has no further information or communication
-    * with the print service. This message should always be delivered
-    * if a terminal event (completed/failed/canceled) is not delivered.
-    * For example, if messages such as JOB_COMPLETE have NOT been received
-    * before receiving this message, the only inference that should be drawn
-    * is that the print service does not support delivering such an event.
-    */
-   public static final int NO_MORE_EVENTS    = 105;
+    /**
+     * Not all print services may be capable of delivering interesting events,
+     * or even telling when a job is complete. This message indicates the print
+     * job has no further information or communication with the print service.
+     * This message should always be delivered if a terminal event
+     * (completed/failed/canceled) is not delivered. For example, if messages
+     * such as {@code JOB_COMPLETE} have NOT been received before receiving this
+     * message, the only inference that should be drawn is that the print
+     * service does not support delivering such an event.
+     */
+    public static final int NO_MORE_EVENTS = 105;
 
-   /**
-    * The job is not necessarily printed yet, but the data has been transferred
-    * successfully from the client to the print service. The client may
-    * free data resources.
-    */
-   public static final int DATA_TRANSFER_COMPLETE    = 106;
+    /**
+     * The job is not necessarily printed yet, but the data has been transferred
+     * successfully from the client to the print service. The client may free
+     * data resources.
+     */
+    public static final int DATA_TRANSFER_COMPLETE = 106;
 
-   /**
+    /**
      * Constructs a {@code PrintJobEvent} object.
      *
-     * @param source  a {@code DocPrintJob} object
-     * @param reason  an int specifying the reason.
-     * @throws IllegalArgumentException if {@code source} is
-     *         {@code null}.
+     * @param  source a {@code DocPrintJob} object
+     * @param  reason an int specifying the reason
+     * @throws IllegalArgumentException if {@code source} is {@code null}
      */
-
     public PrintJobEvent( DocPrintJob source, int reason) {
 
         super(source);
         this.reason = reason;
-   }
+    }
 
     /**
      * Gets the reason for this event.
-     * @return  reason int.
+     *
+     * @return reason int
      */
     public int getPrintEventType() {
         return reason;
     }
 
     /**
-     * Determines the {@code DocPrintJob} to which this print job
-     * event pertains.
+     * Determines the {@code DocPrintJob} to which this print job event
+     * pertains.
      *
-     * @return  the {@code DocPrintJob} object that represents the
-     *          print job that reports the events encapsulated by this
-     *          {@code PrintJobEvent}.
-     *
+     * @return the {@code DocPrintJob} object that represents the print job that
+     *         reports the events encapsulated by this {@code PrintJobEvent}
      */
     public DocPrintJob getPrintJob() {
         return (DocPrintJob) getSource();
     }
-
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobListener.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobListener.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -26,70 +26,66 @@
 package javax.print.event;
 
 /**
-  * Implementations of this listener interface should be attached to a
-  * {@link javax.print.DocPrintJob DocPrintJob} to monitor the status of
-  * the printer job.
-  * These callback methods may be invoked on the thread processing the
-  * print job, or a service created notification thread. In either case
-  * the client should not perform lengthy processing in these callbacks.
-  */
-
+ * Implementations of this listener interface should be attached to a
+ * {@link javax.print.DocPrintJob DocPrintJob} to monitor the status of the
+ * printer job. These callback methods may be invoked on the thread processing
+ * the print job, or a service created notification thread. In either case the
+ * client should not perform lengthy processing in these callbacks.
+ */
 public interface PrintJobListener {
 
     /**
-     * Called to notify the client that data has been successfully
-     * transferred to the print service, and the client may free
-     * local resources allocated for that data.  The client should
-     * not assume that the data has been completely printed after
-     * receiving this event.
-     * If this event is not received the client should wait for a terminal
-     * event (completed/canceled/failed) before freeing the resources.
-     * @param pje the job generating this event
+     * Called to notify the client that data has been successfully transferred
+     * to the print service, and the client may free local resources allocated
+     * for that data. The client should not assume that the data has been
+     * completely printed after receiving this event. If this event is not
+     * received the client should wait for a terminal event
+     * (completed/canceled/failed) before freeing the resources.
+     *
+     * @param  pje the job generating this event
      */
     public void printDataTransferCompleted(PrintJobEvent pje) ;
 
-
     /**
      * Called to notify the client that the job completed successfully.
-     * @param pje the job generating this event
+     *
+     * @param  pje the job generating this event
      */
     public void printJobCompleted(PrintJobEvent pje) ;
 
-
     /**
-     * Called to notify the client that the job failed to complete
-     * successfully and will have to be resubmitted.
-     * @param pje the job generating this event
+     * Called to notify the client that the job failed to complete successfully
+     * and will have to be resubmitted.
+     *
+     * @param  pje the job generating this event
      */
     public void printJobFailed(PrintJobEvent pje) ;
 
-
     /**
-     * Called to notify the client that the job was canceled
-     * by a user or a program.
-     * @param pje the job generating this event
+     * Called to notify the client that the job was canceled by a user or a
+     * program.
+     *
+     * @param  pje the job generating this event
      */
     public void printJobCanceled(PrintJobEvent pje) ;
 
-
     /**
-     * Called to notify the client that no more events will be delivered.
-     * One cause of this event being generated is if the job
-     * has successfully completed, but the printing system
-     * is limited in capability and cannot verify this.
-     * This event is required to be delivered if none of the other
+     * Called to notify the client that no more events will be delivered. One
+     * cause of this event being generated is if the job has successfully
+     * completed, but the printing system is limited in capability and cannot
+     * verify this. This event is required to be delivered if none of the other
      * terminal events (completed/failed/canceled) are delivered.
-     * @param pje the job generating this event
+     *
+     * @param  pje the job generating this event
      */
     public void printJobNoMoreEvents(PrintJobEvent pje) ;
 
-
     /**
-     * Called to notify the client that an error has occurred that the
-     * user might be able to fix.  One example of an error that can
-     * generate this event is when the printer runs out of paper.
-     * @param pje the job generating this event
+     * Called to notify the client that an error has occurred that the user
+     * might be able to fix. One example of an error that can generate this
+     * event is when the printer runs out of paper.
+     *
+     * @param  pje the job generating this event
      */
     public void printJobRequiresAttention(PrintJobEvent pje) ;
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeEvent.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeEvent.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, 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
@@ -30,25 +30,28 @@
 import javax.print.attribute.PrintServiceAttributeSet;
 
 /**
- *
- * Class PrintServiceAttributeEvent encapsulates an event a
- * Print Service instance reports to let the client know of
- * changes in the print service state.
+ * Class {@code PrintServiceAttributeEvent} encapsulates an event a Print
+ * Service instance reports to let the client know of changes in the print
+ * service state.
  */
-
 public class PrintServiceAttributeEvent extends PrintEvent {
 
+    /**
+     * Use serialVersionUID from JDK 1.4 for interoperability.
+     */
     private static final long serialVersionUID = -7565987018140326600L;
 
+    /**
+     * The printing service attributes that changed.
+     */
     private PrintServiceAttributeSet attributes;
 
     /**
-     * Constructs a PrintServiceAttributeEvent object.
+     * Constructs a {@code PrintServiceAttributeEvent} object.
      *
-     * @param source the print job generating  this event
-     * @param attributes the attribute changes being reported
-     * @throws IllegalArgumentException if {@code source} is
-     *         {@code null}.
+     * @param  source the print job generating this event
+     * @param  attributes the attribute changes being reported
+     * @throws IllegalArgumentException if {@code source} is {@code null}
      */
     public PrintServiceAttributeEvent(PrintService source,
                                       PrintServiceAttributeSet attributes) {
@@ -57,28 +60,25 @@
         this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
     }
 
-
     /**
      * Returns the print service.
-
-     * @return  Print Service object.
+     *
+     * @return {@code PrintService} object
      */
     public PrintService getPrintService() {
 
         return (PrintService) getSource();
     }
 
-
     /**
      * Determine the printing service attributes that changed and their new
      * values.
      *
-     * @return  Attributes containing the new values for the service
-     * attributes that changed. The returned set may be unmodifiable.
+     * @return attributes containing the new values for the service attributes
+     *         that changed. The returned set may be unmodifiable.
      */
     public PrintServiceAttributeSet getAttributes() {
 
         return attributes;
     }
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeListener.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeListener.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2001, 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
@@ -26,23 +26,22 @@
 package javax.print.event;
 
 /**
-  * Implementations of this listener interface are attached to a
-  * {@link javax.print.PrintService PrintService} to monitor
-  * the status of the print service.
-  * <p>
-  * To monitor a particular job see {@link PrintJobListener} and
-  * {@link PrintJobAttributeListener}.
-  */
-
+ * Implementations of this listener interface are attached to a
+ * {@link javax.print.PrintService PrintService} to monitor the status of the
+ * print service.
+ * <p>
+ * To monitor a particular job see {@link PrintJobListener} and
+ * {@link PrintJobAttributeListener}.
+ */
 public interface PrintServiceAttributeListener {
 
     /**
-     * Called to notify a listener of an event in the print service.
-     * The service will call this method on an event notification thread.
-     * The client should not perform lengthy processing in this callback
-     * or subsequent event notifications may be blocked.
-     * @param psae the event being notified
+     * Called to notify a listener of an event in the print service. The service
+     * will call this method on an event notification thread. The client should
+     * not perform lengthy processing in this callback or subsequent event
+     * notifications may be blocked.
+     *
+     * @param  psae the event being notified
      */
     public void attributeUpdate(PrintServiceAttributeEvent psae) ;
-
 }
--- a/jdk/src/java.desktop/share/classes/javax/print/event/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/event/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -24,17 +24,18 @@
  */
 
 /**
- * Package javax.print.event contains event classes and listener interfaces.
+ * Package {@code javax.print.event} contains event classes and listener
+ * interfaces.
  * <p>
  * They may be used to monitor both print services (such as printers going
  * on-line &amp; off-line), and the progress of a specific print job.
  * <p>
- * Please note: In the javax.print APIs, a null reference parameter to methods
- * is incorrect unless explicitly documented on the method as having a
- * meaningful interpretation. Usage to the contrary is incorrect coding and may
- * result in a run time exception either immediately or at some later time.
- * IllegalArgumentException and NullPointerException are examples of typical and
- * acceptable run time exceptions for such cases.
+ * Please note: In the {@code javax.print} APIs, a {@code null} reference
+ * parameter to methods is incorrect unless explicitly documented on the method
+ * as having a meaningful interpretation. Usage to the contrary is incorrect
+ * coding and may result in a run time exception either immediately or at some
+ * later time. {@code IllegalArgumentException} and {@code NullPointerException}
+ * are examples of typical and acceptable run time exceptions for such cases.
  *
  * @since 1.4
  */
--- a/jdk/src/java.desktop/share/classes/javax/print/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/print/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -28,10 +28,10 @@
  * Service API. The Java Print Service API enables client and server
  * applications to:
  * <ul>
- *     <li>Discover and select print services based on their capabilities</li>
- *     <li>Specify the format of print data</li>
- *     <li>Submit print jobs to services that support the document type to be
- *     printed.</li>
+ *   <li>Discover and select print services based on their capabilities
+ *   <li>Specify the format of print data
+ *   <li>Submit print jobs to services that support the document type to be
+ *   printed.
  * </ul>
  *
  * <h3>Print Service Discovery</h3>
@@ -51,15 +51,15 @@
  * <h3>Attribute Definitions</h3>
  * The {@link javax.print.attribute} and {@link javax.print.attribute.standard}
  * packages define print attributes, which describe the capabilities of a print
- * service, specify the requirements of a print job, and track the progress of
- * a print job.
+ * service, specify the requirements of a print job, and track the progress of a
+ * print job.
  * <p>
  * The {@code javax.print.attribute} package describes the types of attributes
  * and how they can be collected into sets. The
  * {@code javax.print.attribute.standard} package enumerates all of the standard
  * attributes supported by the API, most of which are implementations of
  * attributes specified in the IETF Specification,
- * <a href="http://www.ietf.org/rfc/rfc2911.txt"> RFC 2911 Internet Printing
+ * <a href="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911 Internet Printing
  * Protocol, 1.1: Model and Semantics</a>, dated September 2000. The attributes
  * specified in {@code javax.print.attribute.standard} include common
  * capabilities, such as: resolution, copies, media sizes, job priority, and
@@ -78,16 +78,16 @@
  * A typical application using the Java Print Service API performs these steps
  * to process a print request:
  * <ol>
- *     <li>Chooses a {@code DocFlavor}.</li>
- *     <li>Creates a set of attributes.</li>
- *     <li>Locates a print service that can handle the print request as
- *     specified by the {@code DocFlavor} and the attribute set.</li>
- *     <li>Creates a {@link javax.print.Doc Doc} object encapsulating the
- *     {@code DocFlavor} and the actual print data, which can take many forms
- *     including: a Postscript file, a JPEG image, a URL, or plain text.</li>
- *     <li>Gets a print job, represented by
- *     {@link javax.print.DocPrintJob DocPrintJob}, from the print service.</li>
- *     <li>Calls the print method of the print job.</li>
+ *   <li>Chooses a {@code DocFlavor}.
+ *   <li>Creates a set of attributes.
+ *   <li>Locates a print service that can handle the print request as specified
+ *   by the {@code DocFlavor} and the attribute set.
+ *   <li>Creates a {@link javax.print.Doc Doc} object encapsulating the
+ *   {@code DocFlavor} and the actual print data, which can take many forms
+ *   including: a Postscript file, a JPEG image, a {@code URL}, or plain text.
+ *   <li>Gets a print job, represented by
+ *   {@link javax.print.DocPrintJob DocPrintJob}, from the print service.
+ *   <li>Calls the print method of the print job.
  * </ol>
  * The following code sample demonstrates a typical use of the Java Print
  * Service API: locating printers that can print five double-sided copies of a
@@ -119,13 +119,13 @@
  * }
  * }</pre>
  * </blockquote>
- * <P>
- * Please note: In the javax.print APIs, a null reference parameter to methods
- * is incorrect unless explicitly documented on the method as having a
- * meaningful interpretation. Usage to the contrary is incorrect coding and may
- * result in a run time exception either immediately or at some later time.
- * IllegalArgumentException and NullPointerException are examples of typical and
- * acceptable run time exceptions for such cases.
+ * <p>
+ * Please note: In the {@code javax.print} APIs, a {@code null} reference
+ * parameter to methods is incorrect unless explicitly documented on the method
+ * as having a meaningful interpretation. Usage to the contrary is incorrect
+ * coding and may result in a run time exception either immediately or at some
+ * later time. {@code IllegalArgumentException} and {@code NullPointerException}
+ * are examples of typical and acceptable run time exceptions for such cases.
  *
  * @since 1.4
  */
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/InvalidMidiDataException.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/InvalidMidiDataException.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,9 @@
  */
 public class InvalidMidiDataException extends Exception {
 
+    /**
+     * Use serialVersionUID from JDK 1.3 for interoperability.
+     */
     private static final long serialVersionUID = 2780771756789932067L;
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,8 +54,8 @@
 
     /**
      * Status byte for {@code MetaMessage} (0xFF, or 255), which is used in MIDI
-     * files. It has the same value as SYSTEM_RESET, which is used in the
-     * real-time "MIDI wire" protocol.
+     * files. It has the same value as {@link ShortMessage#SYSTEM_RESET}, which
+     * is used in the real-time "MIDI wire" protocol.
      *
      * @see MidiMessage#getStatus
      */
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,11 +64,11 @@
  * {@code MidiDevice} instance, the following rules apply:
  *
  * <ul>
- * <li>After an explicit open (either before or after implicit opens), the
- * device will not be closed by implicit closing. The only way to close an
- * explicitly opened device is an explicit close.</li>
- * <li>An explicit close always closes the device, even if it also has been
- * opened implicitly. A subsequent implicit close has no further effect.</li>
+ *   <li>After an explicit open (either before or after implicit opens), the
+ *   device will not be closed by implicit closing. The only way to close an
+ *   explicitly opened device is an explicit close.
+ *   <li>An explicit close always closes the device, even if it also has been
+ *   opened implicitly. A subsequent implicit close has no further effect.
  * </ul>
  *
  * To detect if a MidiDevice represents a hardware MIDI port, the following
@@ -76,7 +76,7 @@
  *
  * <pre>{@code
  * MidiDevice device = ...;
- * if ( ! (device instanceof Sequencer) && ! (device instanceof Synthesizer)) {
+ * if (!(device instanceof Sequencer) && !(device instanceof Synthesizer)) {
  *   // we're now sure that device represents a MIDI port
  *   // ...
  * }
@@ -112,7 +112,8 @@
      * resources and allow applications to exit cleanly.
      * <p>
      * Note that some devices, once closed, cannot be reopened. Attempts to
-     * reopen such a device will always result in a MidiUnavailableException.
+     * reopen such a device will always result in a
+     * {@code MidiUnavailableException}.
      *
      * @throws MidiUnavailableException thrown if the device cannot be opened
      *         due to resource restrictions
@@ -198,7 +199,8 @@
 
     /**
      * Returns all currently active, non-closed receivers connected with this
-     * MidiDevice. A receiver can be removed from the device by closing it.
+     * {@code MidiDevice}. A receiver can be removed from the device by closing
+     * it.
      * <p>
      * Usually the returned receivers implement the {@code MidiDeviceReceiver}
      * interface.
@@ -231,7 +233,8 @@
 
     /**
      * Returns all currently active, non-closed transmitters connected with this
-     * MidiDevice. A transmitter can be removed from the device by closing it.
+     * {@code MidiDevice}. A transmitter can be removed from the device by
+     * closing it.
      * <p>
      * Usually the returned transmitters implement the
      * {@code MidiDeviceTransmitter} interface.
@@ -288,12 +291,12 @@
         }
 
         /**
-         * Reports whether two objects are equal. Returns {@code true} if the
-         * objects are identical.
+         * Indicates whether the specified object is equal to this info object,
+         * returning {@code true} if the objects are the same.
          *
-         * @param  obj the reference object with which to compare this object
-         * @return {@code true} if this object is the same as the {@code obj}
-         *         argument; {@code false} otherwise
+         * @param  obj the reference object with which to compare
+         * @return {@code true} if the specified object is equal to this info
+         *         object; {@code false} otherwise
          */
         @Override
         public final boolean equals(Object obj) {
@@ -301,7 +304,9 @@
         }
 
         /**
-         * Finalizes the hashcode method.
+         * Returns a hash code value for this info object.
+         *
+         * @return a hash code value for this info object
          */
         @Override
         public final int hashCode() {
@@ -353,5 +358,5 @@
         public final String toString() {
             return name;
         }
-    } // class Info
+    }
 }
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceReceiver.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceReceiver.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,9 +35,11 @@
 public interface MidiDeviceReceiver extends Receiver {
 
     /**
-     * Obtains a MidiDevice object which is an owner of this Receiver.
+     * Obtains a {@code MidiDevice} object which is an owner of this
+     * {@code Receiver}.
      *
-     * @return a MidiDevice object which is an owner of this Receiver
+     * @return a {@code MidiDevice} object which is an owner of this
+     *         {@code Receiver}
      */
     MidiDevice getMidiDevice();
 }
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceTransmitter.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceTransmitter.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,9 +35,11 @@
 public interface MidiDeviceTransmitter extends Transmitter {
 
     /**
-     * Obtains a MidiDevice object which is an owner of this Transmitter.
+     * Obtains a {@code MidiDevice} object which is an owner of this
+     * {@code Transmitter}.
      *
-     * @return a MidiDevice object which is an owner of this Transmitter
+     * @return a {@code MidiDevice} object which is an owner of this
+     *         {@code Transmitter}
      */
     MidiDevice getMidiDevice();
 }
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiFileFormat.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiFileFormat.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,37 +44,31 @@
  * implementations:
  *
  * <table border=1>
-    <caption>MIDI File Format Properties</caption>
- *  <tr>
- *   <th>Property key</th>
- *   <th>Value type</th>
- *   <th>Description</th>
- *  </tr>
- *  <tr>
- *   <td>&quot;author&quot;</td>
- *   <td>{@link java.lang.String String}</td>
- *   <td>name of the author of this file</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;title&quot;</td>
- *   <td>{@link java.lang.String String}</td>
- *   <td>title of this file</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;copyright&quot;</td>
- *   <td>{@link java.lang.String String}</td>
- *   <td>copyright message</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;date&quot;</td>
- *   <td>{@link java.util.Date Date}</td>
- *   <td>date of the recording or release</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;comment&quot;</td>
- *   <td>{@link java.lang.String String}</td>
- *   <td>an arbitrary text</td>
- *  </tr>
+ * <caption>MIDI File Format Properties</caption>
+ *   <tr>
+ *     <th>Property key
+ *     <th>Value type
+ *     <th>Description
+ *   <tr>
+ *     <td>&quot;author&quot;
+ *     <td>{@link String String}
+ *     <td>name of the author of this file
+ *   <tr>
+ *     <td>&quot;title&quot;
+ *     <td>{@link String String}
+ *     <td>title of this file
+ *   <tr>
+ *     <td>&quot;copyright&quot;
+ *     <td>{@link String String}
+ *     <td>copyright message
+ *   <tr>
+ *     <td>&quot;date&quot;
+ *     <td>{@link java.util.Date Date}
+ *     <td>date of the recording or release
+ *   <tr>
+ *     <td>&quot;comment&quot;
+ *     <td>{@link String String}
+ *     <td>an arbitrary text
  * </table>
  *
  * @author Kara Kytle
@@ -135,10 +129,10 @@
      * @param  divisionType the timing division type (PPQ or one of the SMPTE
      *         types)
      * @param  resolution the timing resolution
-     * @param  bytes the length of the MIDI file in bytes, or UNKNOWN_LENGTH if
-     *         not known
+     * @param  bytes the length of the MIDI file in bytes, or
+     *         {@link #UNKNOWN_LENGTH} if not known
      * @param  microseconds the duration of the file in microseconds, or
-     *         UNKNOWN_LENGTH if not known
+     *         {@link #UNKNOWN_LENGTH} if not known
      * @see #UNKNOWN_LENGTH
      * @see Sequence#PPQ
      * @see Sequence#SMPTE_24
@@ -163,10 +157,10 @@
      * @param  divisionType the timing division type (PPQ or one of the SMPTE
      *         types)
      * @param  resolution the timing resolution
-     * @param  bytes the length of the MIDI file in bytes, or UNKNOWN_LENGTH if
-     *         not known
+     * @param  bytes the length of the MIDI file in bytes, or
+     *         {@code UNKNOWN_LENGTH} if not known
      * @param  microseconds the duration of the file in microseconds, or
-     *         UNKNOWN_LENGTH if not known
+     *         {@code UNKNOWN_LENGTH} if not known
      * @param  properties a {@code Map<String,Object>} object with properties
      * @see #UNKNOWN_LENGTH
      * @see Sequence#PPQ
@@ -224,7 +218,8 @@
     /**
      * Obtains the length of the MIDI file, expressed in 8-bit bytes.
      *
-     * @return the number of bytes in the file, or UNKNOWN_LENGTH if not known
+     * @return the number of bytes in the file, or {@code UNKNOWN_LENGTH} if not
+     *         known
      * @see #UNKNOWN_LENGTH
      */
     public int getByteLength() {
@@ -234,8 +229,8 @@
     /**
      * Obtains the length of the MIDI file, expressed in microseconds.
      *
-     * @return the file's duration in microseconds, or UNKNOWN_LENGTH if not
-     *         known
+     * @return the file's duration in microseconds, or {@code UNKNOWN_LENGTH} if
+     *         not known
      * @see Sequence#getMicrosecondLength()
      * @see #getByteLength
      * @see #UNKNOWN_LENGTH
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java	Sat Sep 09 14:36:45 2017 +0200
@@ -38,29 +38,29 @@
  * The base {@code MidiMessage} class provides access to three types of
  * information about a MIDI message:
  * <ul>
- * <li>The messages's status byte</li>
- * <li>The total length of the message in bytes (the status byte plus any data
- * bytes)</li>
- * <li>A byte array containing the complete message</li>
+ *   <li>The messages's status byte
+ *   <li>The total length of the message in bytes (the status byte plus any data
+ *   bytes)
+ *   <li>A byte array containing the complete message
  * </ul>
  *
  * {@code MidiMessage} includes methods to get, but not set, these values.
  * Setting them is a subclass responsibility.
  * <p>
- * <a id="integersVsBytes"></a> The MIDI standard expresses MIDI data in
- * bytes. However, because Java<sup>TM</sup> uses signed bytes, the Java Sound
- * API uses integers instead of bytes when expressing MIDI data. For example,
- * the {@link #getStatus()} method of {@code MidiMessage} returns MIDI status
- * bytes as integers. If you are processing MIDI data that originated outside
- * Java Sound and now is encoded as signed bytes, the bytes can be
- * converted to integers using this conversion:
+ * <a id="integersVsBytes"></a>The MIDI standard expresses MIDI data in bytes.
+ * However, because Java&trade; uses signed bytes, the Java Sound API uses
+ * integers instead of bytes when expressing MIDI data. For example, the
+ * {@link #getStatus()} method of {@code MidiMessage} returns MIDI status bytes
+ * as integers. If you are processing MIDI data that originated outside Java
+ * Sound and now is encoded as signed bytes, the bytes can be converted to
+ * integers using this conversion:
  * <p style="text-align:center">
  * {@code int i = (int)(byte & 0xFF)}
  * <p>
  * If you simply need to pass a known MIDI byte value as a method parameter, it
  * can be expressed directly as an integer, using (for example) decimal or
  * hexadecimal notation. For instance, to pass the "active sensing" status byte
- * as the first argument to ShortMessage's
+ * as the first argument to {@code ShortMessage}'s
  * {@link ShortMessage#setMessage(int) setMessage(int)} method, you can express
  * it as 254 or 0xFE.
  *
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java	Sat Sep 09 14:36:45 2017 +0200
@@ -57,7 +57,7 @@
  * one or more {@code MidiSystem} methods to learn what devices are installed
  * and to obtain the ones needed in that application.
  * <p>
- * The class also has methods for reading files, streams, and  URLs that contain
+ * The class also has methods for reading files, streams, and URLs that contain
  * standard MIDI file data or soundbanks. You can query the {@code MidiSystem}
  * for the format of a specified MIDI file.
  * <p>
@@ -77,33 +77,28 @@
  * <table class="striped">
  * <caption>MIDI System Property Keys</caption>
  * <thead>
- *  <tr>
- *   <th>Property Key</th>
- *   <th>Interface</th>
- *   <th>Affected Method</th>
- *  </tr>
+ *   <tr>
+ *     <th>Property Key
+ *     <th>Interface
+ *     <th>Affected Method
  * </thead>
  * <tbody>
- *  <tr>
- *   <td>{@code javax.sound.midi.Receiver}</td>
- *   <td>{@link Receiver}</td>
- *   <td>{@link #getReceiver}</td>
- *  </tr>
- *  <tr>
- *   <td>{@code javax.sound.midi.Sequencer}</td>
- *   <td>{@link Sequencer}</td>
- *   <td>{@link #getSequencer}</td>
- *  </tr>
- *  <tr>
- *   <td>{@code javax.sound.midi.Synthesizer}</td>
- *   <td>{@link Synthesizer}</td>
- *   <td>{@link #getSynthesizer}</td>
- *  </tr>
- *  <tr>
- *   <td>{@code javax.sound.midi.Transmitter}</td>
- *   <td>{@link Transmitter}</td>
- *   <td>{@link #getTransmitter}</td>
- *  </tr>
+ *   <tr>
+ *     <td>{@code javax.sound.midi.Receiver}
+ *     <td>{@link Receiver}
+ *     <td>{@link #getReceiver}
+ *   <tr>
+ *     <td>{@code javax.sound.midi.Sequencer}
+ *     <td>{@link Sequencer}
+ *     <td>{@link #getSequencer}
+ *   <tr>
+ *     <td>{@code javax.sound.midi.Synthesizer}
+ *     <td>{@link Synthesizer}
+ *     <td>{@link #getSynthesizer}
+ *   <tr>
+ *     <td>{@code javax.sound.midi.Transmitter}
+ *     <td>{@link Transmitter}
+ *     <td>{@link #getTransmitter}
  * </tbody>
  * </table>
  *
@@ -567,8 +562,7 @@
      * @return an {@code MidiFileFormat} object describing the MIDI file format
      * @throws InvalidMidiDataException if the stream does not point to valid
      *         MIDI file data recognized by the system
-     * @throws IOException if an I/O exception occurs while accessing the
-     *         stream
+     * @throws IOException if an I/O exception occurs while accessing the stream
      * @throws NullPointerException if {@code stream} is {@code null}
      * @see #getMidiFileFormat(URL)
      * @see #getMidiFileFormat(File)
@@ -1027,21 +1021,42 @@
     }
 
     // HELPER METHODS
+
+    /**
+     * Obtains the list of MidiDeviceProviders installed on the system.
+     *
+     * @return the list of MidiDeviceProviders installed on the system
+     */
     @SuppressWarnings("unchecked")
     private static List<MidiDeviceProvider> getMidiDeviceProviders() {
         return (List<MidiDeviceProvider>) getProviders(MidiDeviceProvider.class);
     }
 
+    /**
+     * Obtains the list of SoundbankReaders installed on the system.
+     *
+     * @return the list of SoundbankReaders installed on the system
+     */
     @SuppressWarnings("unchecked")
     private static List<SoundbankReader> getSoundbankReaders() {
         return (List<SoundbankReader>) getProviders(SoundbankReader.class);
     }
 
+    /**
+     * Obtains the list of MidiFileWriters installed on the system.
+     *
+     * @return the list of MidiFileWriters installed on the system
+     */
     @SuppressWarnings("unchecked")
     private static List<MidiFileWriter> getMidiFileWriters() {
         return (List<MidiFileWriter>) getProviders(MidiFileWriter.class);
     }
 
+    /**
+     * Obtains the list of MidiFileReaders installed on the system.
+     *
+     * @return the list of MidiFileReaders installed on the system
+     */
     @SuppressWarnings("unchecked")
     private static List<MidiFileReader> getMidiFileReaders() {
         return (List<MidiFileReader>) getProviders(MidiFileReader.class);
@@ -1056,6 +1071,7 @@
      *
      * @param  deviceClass The requested device type, one of Synthesizer.class,
      *         Sequencer.class, Receiver.class or Transmitter.class
+     * @return default MidiDevice of the specified type
      * @throws MidiUnavailableException on failure
      */
     private static MidiDevice getDefaultDeviceWrapper(Class<?> deviceClass)
@@ -1074,6 +1090,7 @@
      *
      * @param  deviceClass The requested device type, one of Synthesizer.class,
      *         Sequencer.class, Receiver.class or Transmitter.class
+     * @return default MidiDevice of the specified type.
      * @throws IllegalArgumentException on failure
      */
     private static MidiDevice getDefaultDevice(Class<?> deviceClass) {
@@ -1098,9 +1115,12 @@
             }
         }
 
-        /* Provider class not specified or cannot be found, or
-           provider class specified, and no appropriate device available or
-           provider class and instance specified and instance cannot be found or is not appropriate */
+        /*
+         *  - Provider class not specified or cannot be found, or
+         *  - provider class specified, and no appropriate device available, or
+         *  - provider class and instance specified and instance cannot be found
+         *    or is not appropriate
+         */
         if (instanceName != null) {
             device = getNamedDevice(instanceName, providers, deviceClass);
             if (device != null) {
@@ -1108,8 +1128,10 @@
             }
         }
 
-        /* No default are specified, or if something is specified, everything
-           failed. */
+        /*
+         * No defaults are specified, or if something is specified, everything
+         * failed
+         */
         device = getFirstDevice(providers, deviceClass);
         if (device != null) {
             return device;
@@ -1176,6 +1198,17 @@
      * @param  provider The MidiDeviceProvider to check for MidiDevices
      * @param  deviceClass The requested device type, one of Synthesizer.class,
      *         Sequencer.class, Receiver.class or Transmitter.class
+     * @param  allowSynthesizer if true, Synthesizers are considered
+     *         appropriate. Otherwise only pure MidiDevices are considered
+     *         appropriate (unless allowSequencer is true). This flag only has
+     *         an effect for deviceClass Receiver and Transmitter. For other
+     *         device classes (Sequencer and Synthesizer), this flag has no
+     *         effect.
+     * @param  allowSequencer if true, Sequencers are considered appropriate.
+     *         Otherwise only pure MidiDevices are considered appropriate
+     *         (unless allowSynthesizer is true). This flag only has an effect
+     *         for deviceClass Receiver and Transmitter. For other device
+     *         classes (Sequencer and Synthesizer), this flag has no effect.
      * @return A MidiDevice matching the requirements, or null if none is found
      */
     private static MidiDevice getNamedDevice(String deviceName,
@@ -1237,6 +1270,17 @@
      *         MidiDevices
      * @param  deviceClass The requested device type, one of Synthesizer.class,
      *         Sequencer.class, Receiver.class or Transmitter.class
+     * @param  allowSynthesizer if true, Synthesizers are considered
+     *         appropriate. Otherwise only pure MidiDevices are considered
+     *         appropriate (unless allowSequencer is true). This flag only has
+     *         an effect for deviceClass Receiver and Transmitter. For other
+     *         device classes (Sequencer and Synthesizer), this flag has no
+     *         effect.
+     * @param  allowSequencer if true, Sequencers are considered appropriate.
+     *         Otherwise only pure MidiDevices are considered appropriate
+     *         (unless allowSynthesizer is true). This flag only has an effect
+     *         for deviceClass Receiver and Transmitter. For other device
+     *         classes (Sequencer and Synthesizer), this flag has no effect.
      * @return A Mixer matching the requirements, or null if none is found
      */
     private static MidiDevice getNamedDevice(String deviceName,
@@ -1294,6 +1338,17 @@
      * @param  provider The MidiDeviceProvider to check for MidiDevices
      * @param  deviceClass The requested device type, one of Synthesizer.class,
      *         Sequencer.class, Receiver.class or Transmitter.class
+     * @param  allowSynthesizer if true, Synthesizers are considered
+     *         appropriate. Otherwise only pure MidiDevices are considered
+     *         appropriate (unless allowSequencer is true). This flag only has
+     *         an effect for deviceClass Receiver and Transmitter. For other
+     *         device classes (Sequencer and Synthesizer), this flag has no
+     *         effect.
+     * @param  allowSequencer if true, Sequencers are considered appropriate.
+     *         Otherwise only pure MidiDevices are considered appropriate
+     *         (unless allowSynthesizer is true). This flag only has an effect
+     *         for deviceClass Receiver and Transmitter. For other device
+     *         classes (Sequencer and Synthesizer), this flag has no effect.
      * @return A MidiDevice is considered appropriate, or null if no appropriate
      *         device is found
      */
@@ -1351,6 +1406,17 @@
      * @param  providers The List of MidiDeviceProviders to search
      * @param  deviceClass The requested device type, one of Synthesizer.class,
      *         Sequencer.class, Receiver.class or Transmitter.class
+     * @param  allowSynthesizer if true, Synthesizers are considered
+     *         appropriate. Otherwise only pure MidiDevices are considered
+     *         appropriate (unless allowSequencer is true). This flag only has
+     *         an effect for deviceClass Receiver and Transmitter. For other
+     *         device classes (Sequencer and Synthesizer), this flag has no
+     *         effect.
+     * @param  allowSequencer if true, Sequencers are considered appropriate.
+     *         Otherwise only pure MidiDevices are considered appropriate
+     *         (unless allowSynthesizer is true). This flag only has an effect
+     *         for deviceClass Receiver and Transmitter. For other device
+     *         classes (Sequencer and Synthesizer), this flag has no effect.
      * @return A MidiDevice that is considered appropriate, or null if none is
      *         found
      */
@@ -1379,6 +1445,8 @@
      * respectively.
      *
      * @param  device the MidiDevice to test
+     * @param  deviceClass The requested device type, one of Synthesizer.class,
+     *         Sequencer.class, Receiver.class or Transmitter.class
      * @param  allowSynthesizer if true, Synthesizers are considered
      *         appropriate. Otherwise only pure MidiDevices are considered
      *         appropriate (unless allowSequencer is true). This flag only has
@@ -1429,10 +1497,15 @@
      * Obtains the set of services currently installed on the system using the
      * SPI mechanism in 1.3.
      *
+     * @param  providerClass The type of providers requested. This should be one
+     *         of AudioFileReader.class, AudioFileWriter.class,
+     *         FormatConversionProvider.class, MixerProvider.class,
+     *         MidiDeviceProvider.class, MidiFileReader.class,
+     *         MidiFileWriter.class or SoundbankReader.class.
      * @return a List of instances of providers for the requested service. If no
      *         providers are available, a List of length 0 will be returned.
      */
-     private static List<?> getProviders(Class<?> providerClass) {
-         return JDK13Services.getProviders(providerClass);
+    private static List<?> getProviders(Class<?> providerClass) {
+        return JDK13Services.getProviders(providerClass);
     }
 }
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiUnavailableException.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiUnavailableException.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,9 @@
  */
 public class MidiUnavailableException extends Exception {
 
+    /**
+     * Use serialVersionUID from JDK 1.3 for interoperability.
+     */
     private static final long serialVersionUID = 6093809578628944323L;
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Receiver.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Receiver.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,7 +64,7 @@
      * closed, too. For a detailed description of open/close behaviour see the
      * class description of {@link MidiDevice MidiDevice}.
      *
-     * @see javax.sound.midi.MidiSystem#getReceiver
+     * @see MidiSystem#getReceiver
      */
     @Override
     void close();
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,22 +38,22 @@
  * The {@code Sequencer} interface includes methods for the following basic MIDI
  * sequencer operations:
  * <ul>
- * <li>obtaining a sequence from MIDI file data</li>
- * <li>starting and stopping playback</li>
- * <li>moving to an arbitrary position in the sequence</li>
- * <li>changing the tempo (speed) of playback</li>
- * <li>synchronizing playback to an internal clock or to received MIDI
- * messages</li>
- * <li>controlling the timing of another device</li>
+ *   <li>obtaining a sequence from MIDI file data
+ *   <li>starting and stopping playback
+ *   <li>moving to an arbitrary position in the sequence
+ *   <li>changing the tempo (speed) of playback
+ *   <li>synchronizing playback to an internal clock or to received MIDI
+ *   messages
+ *   <li>controlling the timing of another device
  * </ul>
  * In addition, the following operations are supported, either directly, or
  * indirectly through objects that the {@code Sequencer} has access to:
  * <ul>
- * <li>editing the data by adding or deleting individual MIDI events or entire
- * tracks</li>
- * <li>muting or soloing individual tracks in the sequence</li>
- * <li>notifying listener objects about any meta-events or control-change events
- * encountered while playing back the sequence.</li>
+ *   <li>editing the data by adding or deleting individual MIDI events or entire
+ *   tracks
+ *   <li>muting or soloing individual tracks in the sequence
+ *   <li>notifying listener objects about any meta-events or control-change
+ *   events encountered while playing back the sequence
  * </ul>
  *
  * @author Kara Kytle
@@ -694,12 +694,13 @@
         }
 
         /**
-         * Determines whether two objects are equal. Returns {@code true} if the
-         * objects are identical.
+         * Indicates whether the specified object is equal to this
+         * synchronization mode, returning {@code true} if the objects are the
+         * same.
          *
          * @param  obj the reference object with which to compare
-         * @return {@code true} if this object is the same as the {@code obj}
-         *         argument, {@code false} otherwise
+         * @return {@code true} if the specified object is equal to this
+         *         synchronization mode; {@code false} otherwise
          */
         @Override
         public final boolean equals(Object obj) {
@@ -708,7 +709,9 @@
         }
 
         /**
-         * Finalizes the hashcode method.
+         * Returns a hash code value for this synchronization mode.
+         *
+         * @return a hash code value for this synchronization mode
          */
         @Override
         public final int hashCode() {
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, 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
@@ -303,9 +303,8 @@
      * @param  status the MIDI status byte
      * @param  data1 the first data byte
      * @param  data2 the second data byte
-     * @throws InvalidMidiDataException if the status byte, or all data
-     *         bytes belonging to the message, do not specify a valid MIDI
-     *         message
+     * @throws InvalidMidiDataException if the status byte, or all data bytes
+     *         belonging to the message, do not specify a valid MIDI message
      * @see #setMessage(int, int, int, int)
      * @see #setMessage(int)
      */
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/SoundbankResource.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/SoundbankResource.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,24 +31,24 @@
  * A {@code SoundbankResource} represents any audio resource stored in a
  * {@link Soundbank}. Common soundbank resources include:
  * <ul>
- * <li>Instruments. An instrument may be specified in a variety of ways.
- * However, all soundbanks have some mechanism for defining instruments. In
- * doing so, they may reference other resources stored in the soundbank. Each
- * instrument has a {@code Patch} which specifies the MIDI program and bank by
- * which it may be referenced in MIDI messages. Instrument information may be
- * stored in {@link Instrument} objects.</li>
- * <li>Audio samples. A sample typically is a sampled audio waveform which
- * contains a short sound recording whose duration is a fraction of a second, or
- * at most a few seconds. These audio samples may be used by a
- * {@link Synthesizer} to synthesize sound in response to MIDI commands, or
- * extracted for use by an application. (The terminology reflects musicians' use
- * of the word "sample" to refer collectively to a series of contiguous audio
- * samples or frames, rather than to a single, instantaneous sample.) The data
- * class for an audio sample will be an object that encapsulates the audio
- * sample data itself and information about how to interpret it (the format of
- * the audio data), such as an {@link AudioInputStream}.</li>
- * <li>Embedded sequences. A sound bank may contain built-in song data stored in
- * a data object such as a {@link Sequence}.</li>
+ *   <li>Instruments. An instrument may be specified in a variety of ways.
+ *   However, all soundbanks have some mechanism for defining instruments. In
+ *   doing so, they may reference other resources stored in the soundbank.
+ *   Each instrument has a {@code Patch} which specifies the MIDI program and
+ *   bank by which it may be referenced in MIDI messages. Instrument information
+ *   may be stored in {@link Instrument} objects.
+ *   <li>Audio samples. A sample typically is a sampled audio waveform which
+ *   contains a short sound recording whose duration is a fraction of a
+ *   second, or at most a few seconds. These audio samples may be used by a
+ *   {@link Synthesizer} to synthesize sound in response to MIDI commands, or
+ *   extracted for use by an application. (The terminology reflects musicians'
+ *   use of the word "sample" to refer collectively to a series of contiguous
+ *   audio samples or frames, rather than to a single, instantaneous sample.)
+ *   The data class for an audio sample will be an object that encapsulates
+ *   the audio sample data itself and information about how to interpret it
+ *   (the format of the audio data), such as an {@link AudioInputStream}.
+ *   <li>Embedded sequences. A sound bank may contain built-in song data stored
+ *   in a data object such as a {@link Sequence}.
  * </ul>
  * Synthesizers that use wavetable synthesis or related techniques play back the
  * audio in a sample when synthesizing notes, often when emulating the
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Synthesizer.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Synthesizer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,8 +49,8 @@
  * be used by every synthesizer, even if the synthesis technique is compatible.
  * To see whether the instruments from a certain soundbank can be played by a
  * given synthesizer, invoke the
- * {@link #isSoundbankSupported(Soundbank) isSoundbankSupported}
- * method of {@code Synthesizer}.
+ * {@link #isSoundbankSupported(Soundbank) isSoundbankSupported} method of
+ * {@code Synthesizer}.
  * <p>
  * "Loading" an instrument means that that instrument becomes available for
  * synthesizing notes. The instrument is loaded into the bank and program
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, 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
@@ -40,8 +40,8 @@
  * As dictated by the Standard MIDI Files specification, two status byte values
  * are legal for a {@code SysexMessage} read from a MIDI file:
  * <ul>
- * <li>0xF0: System Exclusive message (same as in MIDI wire protocol)</li>
- * <li>0xF7: Special System Exclusive message</li>
+ *   <li>0xF0: System Exclusive message (same as in MIDI wire protocol)
+ *   <li>0xF7: Special System Exclusive message
  * </ul>
  * When Java Sound is used to handle system exclusive data that is being
  * received using MIDI wire protocol, it should place the data in one or more
@@ -49,8 +49,8 @@
  * is not known in advance; the end of the system exclusive data is marked by an
  * end-of-exclusive flag (0xF7) in the MIDI wire byte stream.
  * <ul>
- * <li>0xF0: System Exclusive message (same as in MIDI wire protocol)</li>
- * <li>0xF7: End of Exclusive (EOX)</li>
+ *   <li>0xF0: System Exclusive message (same as in MIDI wire protocol)
+ *   <li>0xF7: End of Exclusive (EOX)
  * </ul>
  * The first {@code SysexMessage} object containing data for a particular system
  * exclusive message should have the status value 0xF0. If this message contains
@@ -148,7 +148,7 @@
      *         should be non-negative and less than or equal to
      *         {@code data.length}
      * @throws InvalidMidiDataException if the parameter values do not specify a
-     *         valid MIDI meta message
+     *         valid MIDI system exclusive message
      * @see #setMessage(byte[], int)
      * @see #setMessage(int, byte[], int)
      * @see #getData()
@@ -178,6 +178,8 @@
      * @param  data the system exclusive message data
      * @param  length the length of the valid message data in the array,
      *         including the status byte
+     * @throws InvalidMidiDataException if the parameter values do not specify a
+     *         valid MIDI system exclusive message
      */
     @Override
     public void setMessage(byte[] data, int length) throws InvalidMidiDataException {
@@ -195,7 +197,7 @@
      * @param  data the system exclusive message data
      * @param  length the length of the valid message data in the array
      * @throws InvalidMidiDataException if the status byte is invalid for a
-     *         sysex message
+     *         system exclusive message
      */
     public void setMessage(int status, byte[] data, int length) throws InvalidMidiDataException {
         if ( (status != 0xF0) && (status != 0xF7) ) {
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Track.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Track.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,10 +64,14 @@
 
     // TODO: use arrays for faster access
 
-    // the list containing the events
+    /**
+     * The list containing the events.
+     */
     private final ArrayList<MidiEvent> eventsList = new ArrayList<>();
 
-    // use a hashset to detect duplicate events in add(MidiEvent)
+    /**
+     * Use a hashset to detect duplicate events in add(MidiEvent).
+     */
     private final HashSet<MidiEvent> set = new HashSet<>();
 
     private final MidiEvent eotEvent;
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Transmitter.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Transmitter.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@
      * open/close behaviour see the class description of
      * {@link MidiDevice MidiDevice}.
      *
-     * @see javax.sound.midi.MidiSystem#getTransmitter
+     * @see MidiSystem#getTransmitter
      */
     @Override
     void close();
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java	Sat Sep 09 14:36:45 2017 +0200
@@ -51,8 +51,8 @@
  * given type of {@code Synthesizer} always has a fixed number of voices, equal
  * to the maximum number of simultaneous notes it is capable of sounding.
  * <p>
- * <a id="description_of_active"></a> If the voice is not currently processing
- * a MIDI note, it is considered inactive. A voice is inactive when it has been
+ * <a id="description_of_active"></a>If the voice is not currently processing a
+ * MIDI note, it is considered inactive. A voice is inactive when it has been
  * given no note-on commands, or when every note-on command received has been
  * terminated by a corresponding note-off (or by an "all notes off" message).
  * For example, this happens when a synthesizer capable of playing 16
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -30,8 +30,8 @@
  * <h2>Related Documentation</h2>
  * For more information on using Java Sound see:
  * <ul>
- *     <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
- *     The Java Sound Tutorial</a></li>
+ *   <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
+ *   The Java Sound Tutorial</a>
  * </ul>
  *
  * @since 1.3
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileReader.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileReader.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, 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
@@ -54,8 +54,8 @@
      * stream's read pointer to its original position. If the input stream does
      * not support this, this method may fail with an {@code IOException}.
      *
-     * @param  stream the input stream from which file format information
-     *         should be extracted
+     * @param  stream the input stream from which file format information should
+     *         be extracted
      * @return a {@code MidiFileFormat} object describing the MIDI file format
      * @throws InvalidMidiDataException if the stream does not point to valid
      *         MIDI file data recognized by the system
@@ -68,14 +68,14 @@
             throws InvalidMidiDataException, IOException;
 
     /**
-     * Obtains the MIDI file format of the URL provided. The URL must point to
-     * valid MIDI file data.
+     * Obtains the MIDI file format of the {@code URL} provided. The {@code URL}
+     * must point to valid MIDI file data.
      *
-     * @param  url the URL from which file format information should be
+     * @param  url the {@code URL} from which file format information should be
      *         extracted
      * @return a {@code MidiFileFormat} object describing the MIDI file format
-     * @throws InvalidMidiDataException if the URL does not point to valid MIDI
-     *         file data recognized by the system
+     * @throws InvalidMidiDataException if the {@code URL} does not point to
+     *         valid MIDI file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @throws NullPointerException if {@code url} is {@code null}
      */
@@ -104,10 +104,10 @@
      * it. These parsers must be able to mark the stream, read enough data to
      * determine whether they support the stream, and, if not, reset the
      * stream's read pointer to its original position. If the input stream does
-     * not support this, this method may fail with an IOException.
+     * not support this, this method may fail with an {@code IOException}.
      *
-     * @param  stream the input stream from which the {@code Sequence} should
-     *         be constructed
+     * @param  stream the input stream from which the {@code Sequence} should be
+     *         constructed
      * @return a {@code Sequence} object based on the MIDI file data contained
      *         in the input stream
      * @throws InvalidMidiDataException if the stream does not point to valid
@@ -121,14 +121,15 @@
             throws InvalidMidiDataException, IOException;
 
     /**
-     * Obtains a MIDI sequence from the URL provided. The URL must point to
-     * valid MIDI file data.
+     * Obtains a MIDI sequence from the {@code URL} provided. The {@code URL}
+     * must point to valid MIDI file data.
      *
-     * @param  url the URL for which the {@code Sequence} should be constructed
+     * @param  url the {@code URL} for which the {@code Sequence} should be
+     *         constructed
      * @return a {@code Sequence} object based on the MIDI file data pointed to
-     *         by the URL
-     * @throws InvalidMidiDataException if the URL does not point to valid MIDI
-     *         file data recognized by the system
+     *         by the {@code URL}
+     * @throws InvalidMidiDataException if the {@code URL} does not point to
+     *         valid MIDI file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @throws NullPointerException if {@code url} is {@code null}
      */
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileWriter.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileWriter.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, 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
@@ -54,8 +54,7 @@
      * Obtains the file types that this file writer can write from the sequence
      * specified.
      *
-     * @param  sequence the sequence for which MIDI file type support is
-     *         queried
+     * @param  sequence the sequence for which MIDI file type support is queried
      * @return array of file types. If no file types are supported, returns an
      *         array of length 0.
      * @throws NullPointerException if {@code sequence} is {@code null}
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/SoundbankReader.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/SoundbankReader.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, 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
@@ -39,18 +39,18 @@
  * subclasses of {@code SoundbankReader} parse a given soundbank file, producing
  * a {@link Soundbank} object that can be loaded into a {@link Synthesizer}.
  *
+ * @author Kara Kytle
  * @since 1.3
- * @author Kara Kytle
  */
 public abstract class SoundbankReader {
 
     /**
-     * Obtains a soundbank object from the URL provided.
+     * Obtains a soundbank object from the {@code URL} provided.
      *
-     * @param  url URL representing the soundbank
+     * @param  url {@code URL} representing the soundbank
      * @return soundbank object
-     * @throws InvalidMidiDataException if the URL does not point to valid MIDI
-     *         soundbank data recognized by this soundbank reader
+     * @throws InvalidMidiDataException if the {@code URL} does not point to
+     *         valid MIDI soundbank data recognized by this soundbank reader
      * @throws IOException if an I/O error occurs
      * @throws NullPointerException if {@code url} is {@code null}
      */
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -30,8 +30,8 @@
  * <h2>Related Documentation</h2>
  * For more information on using Java Sound see:
  * <ul>
- *     <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
- *     The Java Sound Tutorial</a></li>
+ *   <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
+ *   The Java Sound Tutorial</a>
  * </ul>
  *
  * @since 1.3
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -51,45 +51,37 @@
  * implementations:
  *
  * <table border=1>
- *  <caption>Audio File Format Properties</caption>
- *  <tr>
- *   <th>Property key</th>
- *   <th>Value type</th>
- *   <th>Description</th>
- *  </tr>
- *  <tr>
- *   <td>&quot;duration&quot;</td>
- *   <td>{@link java.lang.Long Long}</td>
- *   <td>playback duration of the file in microseconds</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;author&quot;</td>
- *   <td>{@link java.lang.String String}</td>
- *   <td>name of the author of this file</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;title&quot;</td>
- *   <td>{@link java.lang.String String}</td>
- *   <td>title of this file</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;copyright&quot;</td>
- *   <td>{@link java.lang.String String}</td>
- *   <td>copyright message</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;date&quot;</td>
- *   <td>{@link java.util.Date Date}</td>
- *   <td>date of the recording or release</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;comment&quot;</td>
- *   <td>{@link java.lang.String String}</td>
- *   <td>an arbitrary text</td>
- *  </tr>
+ * <caption>Audio File Format Properties</caption>
+ *   <tr>
+ *     <th>Property key
+ *     <th>Value type
+ *     <th>Description
+ *   <tr>
+ *     <td>&quot;duration&quot;
+ *     <td>{@link Long Long}
+ *     <td>playback duration of the file in microseconds
+ *   <tr>
+ *     <td>&quot;author&quot;
+ *     <td>{@link String String}
+ *     <td>name of the author of this file
+ *   <tr>
+ *     <td>&quot;title&quot;
+ *     <td>{@link String String}
+ *     <td>title of this file
+ *   <tr>
+ *     <td>&quot;copyright&quot;
+ *     <td>{@link String String}
+ *     <td>copyright message
+ *   <tr>
+ *     <td>&quot;date&quot;
+ *     <td>{@link java.util.Date Date}
+ *     <td>date of the recording or release
+ *   <tr>
+ *     <td>&quot;comment&quot;
+ *     <td>{@link String String}
+ *     <td>an arbitrary text
  * </table>
  *
- *
  * @author David Rivas
  * @author Kara Kytle
  * @author Florian Bomers
@@ -351,7 +343,12 @@
         }
 
         /**
-         * Finalizes the equals method.
+         * Indicates whether the specified object is equal to this file type,
+         * returning {@code true} if the objects are equal.
+         *
+         * @param  obj the reference object with which to compare
+         * @return {@code true} if the specified object is equal to this file
+         *         type; {@code false} otherwise
          */
         @Override
         public final boolean equals(final Object obj) {
@@ -365,7 +362,9 @@
         }
 
         /**
-         * Finalizes the hashCode method.
+         * Returns a hash code value for this file type.
+         *
+         * @return a hash code value for this file type
          */
         @Override
         public final int hashCode() {
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java	Sat Sep 09 14:36:45 2017 +0200
@@ -40,6 +40,7 @@
  * data line expects to receive for output. For a target (capture) data line,
  * the audio format specifies the kind of the data that can be read from the
  * line.
+ * <p>
  * Sound files also have audio formats, of course. The {@link AudioFileFormat}
  * class encapsulates an {@code AudioFormat} in addition to other, file-specific
  * information. Similarly, an {@link AudioInputStream} has an
@@ -92,29 +93,24 @@
  * <table class="striped">
  * <caption>Audio Format Properties</caption>
  * <thead>
- *  <tr>
- *   <th>Property key</th>
- *   <th>Value type</th>
- *   <th>Description</th>
- *  </tr>
+ *   <tr>
+ *     <th>Property key
+ *     <th>Value type
+ *     <th>Description
  * </thead>
  * <tbody>
- *  <tr>
- *   <td>&quot;bitrate&quot;</td>
- *   <td>{@link java.lang.Integer Integer}</td>
- *   <td>average bit rate in bits per second</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;vbr&quot;</td>
- *   <td>{@link java.lang.Boolean Boolean}</td>
- *   <td>{@code true}, if the file is encoded in variable bit
- *       rate (VBR)</td>
- *  </tr>
- *  <tr>
- *   <td>&quot;quality&quot;</td>
- *   <td>{@link java.lang.Integer Integer}</td>
- *   <td>encoding/conversion quality, 1..100</td>
- *  </tr>
+ *   <tr>
+ *     <td>&quot;bitrate&quot;
+ *     <td>{@link java.lang.Integer Integer}
+ *     <td>average bit rate in bits per second
+ *   <tr>
+ *     <td>&quot;vbr&quot;
+ *     <td>{@link java.lang.Boolean Boolean}
+ *     <td>{@code true}, if the file is encoded in variable bit rate (VBR)
+ *   <tr>
+ *     <td>&quot;quality&quot;
+ *     <td>{@link java.lang.Integer Integer}
+ *     <td>encoding/conversion quality, 1..100
  * </tbody>
  * </table>
  * <p>
@@ -183,8 +179,8 @@
      * @param  encoding the audio encoding technique
      * @param  sampleRate the number of samples per second
      * @param  sampleSizeInBits the number of bits in each sample
-     * @param  channels the number of channels (1 for mono, 2 for stereo,
-     *         and so on)
+     * @param  channels the number of channels (1 for mono, 2 for stereo, and so
+     *         on)
      * @param  frameSize the number of bytes in each frame
      * @param  frameRate the number of frames per second
      * @param  bigEndian indicates whether the data for a single sample is
@@ -217,7 +213,8 @@
      * @param  frameSize the number of bytes in each frame
      * @param  frameRate the number of frames per second
      * @param  bigEndian indicates whether the data for a single sample is
-     *         stored in big-endian byte order ({@code false} means little-endian)
+     *         stored in big-endian byte order ({@code false} means
+     *         little-endian)
      * @param  properties a {@code Map<String, Object>} object containing format
      *         properties
      * @since 1.5
@@ -276,9 +273,10 @@
 
     /**
      * Obtains the sample rate. For compressed formats, the return value is the
-     * sample rate of the uncompressed audio data. When this AudioFormat is used
-     * for queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
-     * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
+     * sample rate of the uncompressed audio data. When this {@code AudioFormat}
+     * is used for queries (e.g.
+     * {@link AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
+     * AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample rate
      * of {@code AudioSystem.NOT_SPECIFIED} means that any sample rate is
      * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
@@ -296,10 +294,10 @@
 
     /**
      * Obtains the size of a sample. For compressed formats, the return value is
-     * the sample size of the uncompressed audio data. When this AudioFormat is
-     * used for queries (e.g. {@link AudioSystem#isConversionSupported(
-     * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or
-     * capabilities (e.g.
+     * the sample size of the uncompressed audio data. When this
+     * {@code AudioFormat} is used for queries (e.g.
+     * {@link AudioSystem#isConversionSupported(AudioFormat,AudioFormat)
+     * AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample size
      * of {@code AudioSystem.NOT_SPECIFIED} means that any sample size is
      * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
@@ -316,9 +314,9 @@
     }
 
     /**
-     * Obtains the number of channels. When this AudioFormat is used for queries
-     * (e.g. {@link AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
-     * AudioSystem.isConversionSupported}) or capabilities (e.g.
+     * Obtains the number of channels. When this {@code AudioFormat} is used for
+     * queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
+     * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a return
      * value of {@code AudioSystem.NOT_SPECIFIED} means that any (positive)
      * number of channels is acceptable.
@@ -333,8 +331,8 @@
     }
 
     /**
-     * Obtains the frame size in bytes. When this AudioFormat is used for
-     * queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
+     * Obtains the frame size in bytes. When this {@code AudioFormat} is used
+     * for queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
      * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame size
      * of {@code AudioSystem.NOT_SPECIFIED} means that any frame size is
@@ -352,10 +350,10 @@
     }
 
     /**
-     * Obtains the frame rate in frames per second. When this AudioFormat is
-     * used for queries (e.g. {@link AudioSystem#isConversionSupported(
-     * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or
-     * capabilities (e.g.
+     * Obtains the frame rate in frames per second. When this
+     * {@code AudioFormat} is used for queries (e.g.
+     * {@link AudioSystem#isConversionSupported(AudioFormat,AudioFormat)
+     * AudioSystem.isConversionSupported}) or capabilities (e.g.
      * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame rate
      * of {@code AudioSystem.NOT_SPECIFIED} means that any frame rate is
      * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
@@ -551,9 +549,10 @@
      * the sound amplitude that are often used for recording speech.
      * <p>
      * You can use a predefined encoding by referring to one of the static
-     * objects created by this class, such as PCM_SIGNED or PCM_UNSIGNED.
-     * Service providers can create new encodings, such as compressed audio
-     * formats, and make these available through the {@link AudioSystem} class.
+     * objects created by this class, such as {@code PCM_SIGNED} or
+     * {@code PCM_UNSIGNED}. Service providers can create new encodings, such as
+     * compressed audio formats, and make these available through the
+     * {@link AudioSystem} class.
      * <p>
      * The {@code Encoding} class is static, so that all {@code AudioFormat}
      * objects that have the same encoding will refer to the same object (rather
@@ -609,7 +608,12 @@
         }
 
         /**
-         * Finalizes the equals method.
+         * Indicates whether the specified object is equal to this encoding,
+         * returning {@code true} if the objects are equal.
+         *
+         * @param  obj the reference object with which to compare
+         * @return {@code true} if the specified object is equal to this
+         *         encoding; {@code false} otherwise
          */
         @Override
         public final boolean equals(final Object obj) {
@@ -623,7 +627,9 @@
         }
 
         /**
-         * Finalizes the hashCode method.
+         * Returns a hash code value for this encoding.
+         *
+         * @return a hash code value for this encoding
          */
         @Override
         public final int hashCode() {
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioInputStream.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioInputStream.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -28,7 +28,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 
-
 /**
  * An audio input stream is an input stream with a specified audio format and
  * length. The length is expressed in sample frames, not bytes. Several methods
@@ -42,9 +41,10 @@
  * The {@code AudioSystem} class includes many methods that manipulate
  * {@code AudioInputStream} objects. For example, the methods let you:
  * <ul>
- * <li> obtain an audio input stream from an external audio file, stream, or URL
- * <li> write an external file from an audio input stream
- * <li> convert an audio input stream to a different audio format
+ *   <li>obtain an audio input stream from an external audio file, stream, or
+ *   {@code URL}
+ *   <li>write an external file from an audio input stream
+ *   <li>convert an audio input stream to a different audio format
  * </ul>
  *
  * @author David Rivas
@@ -139,7 +139,7 @@
     /**
      * Constructs an audio input stream that reads its data from the target data
      * line indicated. The format of the stream is the same as that of the
-     * target data line, and the length is AudioSystem#NOT_SPECIFIED.
+     * target data line, and the length is {@code AudioSystem#NOT_SPECIFIED}.
      *
      * @param  line the target data line from which this stream obtains its data
      * @see AudioSystem#NOT_SPECIFIED
@@ -370,11 +370,11 @@
 
     /**
      * Returns the maximum number of bytes that can be read (or skipped over)
-     * from this audio input stream without blocking. This limit applies only
-     * to the next invocation of a {@code read} or {@code skip} method for this
+     * from this audio input stream without blocking. This limit applies only to
+     * the next invocation of a {@code read} or {@code skip} method for this
      * audio input stream; the limit can vary each time these methods are
-     * invoked. Depending on the underlying stream, an IOException may be thrown
-     * if this stream is closed.
+     * invoked. Depending on the underlying stream, an {@code IOException} may
+     * be thrown if this stream is closed.
      *
      * @return the number of bytes that can be read from this audio input stream
      *         without blocking
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java	Sat Sep 09 14:36:45 2017 +0200
@@ -45,34 +45,30 @@
  * <caption>Permission target name, what the permission allows, and associated
  * risks</caption>
  * <thead>
- * <tr>
- * <th>Permission Target Name</th>
- * <th>What the Permission Allows</th>
- * <th>Risks of Allowing this Permission</th>
- * </tr>
+ *   <tr>
+ *     <th>Permission Target Name
+ *     <th>What the Permission Allows
+ *     <th>Risks of Allowing this Permission
  * </thead>
  * <tbody>
- * <tr>
- * <td>play</td>
- * <td>Audio playback through the audio device or devices on the system.
- * Allows the application to obtain and manipulate lines and mixers for
- * audio playback (rendering).</td>
- * <td>In some cases use of this permission may affect other
- * applications because the audio from one line may be mixed with other audio
- * being played on the system, or because manipulation of a mixer affects the
- * audio for all lines using that mixer.</td>
- * </tr>
- *
- * <tr>
- * <td>record</td>
- * <td>Audio recording through the audio device or devices on the system.
- * Allows the application to obtain and manipulate lines and mixers for
- * audio recording (capture).</td>
- * <td>In some cases use of this permission may affect other
- * applications because manipulation of a mixer affects the audio for all lines
- * using that mixer.
- * This permission can enable an applet or application to eavesdrop on a user.</td>
- * </tr>
+ *   <tr>
+ *     <td>play
+ *     <td>Audio playback through the audio device or devices on the system.
+ *     Allows the application to obtain and manipulate lines and mixers for
+ *     audio playback (rendering).
+ *     <td>In some cases use of this permission may affect other
+ *     applications because the audio from one line may be mixed with other
+ *     audio being played on the system, or because manipulation of a mixer
+ *     affects the audio for all lines using that mixer.
+ *   <tr>
+ *     <td>record
+ *     <td>Audio recording through the audio device or devices on the system.
+ *     Allows the application to obtain and manipulate lines and mixers for
+ *     audio recording (capture).
+ *     <td>In some cases use of this permission may affect other applications
+ *     because manipulation of a mixer affects the audio for all lines using
+ *     that mixer. This permission can enable an applet or application to
+ *     eavesdrop on a user.
  * </tbody>
  * </table>
  *
@@ -81,6 +77,9 @@
  */
 public class AudioPermission extends BasicPermission {
 
+    /**
+     * Use serialVersionUID from JDK 1.3 for interoperability.
+     */
     private static final long serialVersionUID = -5518053473477801126L;
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java	Sat Sep 09 14:36:45 2017 +0200
@@ -25,7 +25,6 @@
 
 package javax.sound.sampled;
 
-import java.io.EOFException;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -75,33 +74,28 @@
  * <table class="striped">
  * <caption>Audio System Property Keys</caption>
  * <thead>
- *  <tr>
- *   <th>Property Key</th>
- *   <th>Interface</th>
- *   <th>Affected Method(s)</th>
- *  </tr>
+ *   <tr>
+ *     <th>Property Key
+ *     <th>Interface
+ *     <th>Affected Method(s)
  * </thead>
  * <tbody>
- *  <tr>
- *   <td>{@code javax.sound.sampled.Clip}</td>
- *   <td>{@link Clip}</td>
- *   <td>{@link #getLine}, {@link #getClip}</td>
- *  </tr>
- *  <tr>
- *   <td>{@code javax.sound.sampled.Port}</td>
- *   <td>{@link Port}</td>
- *   <td>{@link #getLine}</td>
- *  </tr>
- *  <tr>
- *   <td>{@code javax.sound.sampled.SourceDataLine}</td>
- *   <td>{@link SourceDataLine}</td>
- *   <td>{@link #getLine}, {@link #getSourceDataLine}</td>
- *  </tr>
- *  <tr>
- *   <td>{@code javax.sound.sampled.TargetDataLine}</td>
- *   <td>{@link TargetDataLine}</td>
- *   <td>{@link #getLine}, {@link #getTargetDataLine}</td>
- *  </tr>
+ *   <tr>
+ *     <td>{@code javax.sound.sampled.Clip}
+ *     <td>{@link Clip}
+ *     <td>{@link #getLine}, {@link #getClip}
+ *   <tr>
+ *     <td>{@code javax.sound.sampled.Port}
+ *     <td>{@link Port}
+ *     <td>{@link #getLine}
+ *   <tr>
+ *     <td>{@code javax.sound.sampled.SourceDataLine}
+ *     <td>{@link SourceDataLine}
+ *     <td>{@link #getLine}, {@link #getSourceDataLine}
+ *   <tr>
+ *     <td>{@code javax.sound.sampled.TargetDataLine}
+ *     <td>{@link TargetDataLine}
+ *     <td>{@link #getLine}, {@link #getTargetDataLine}
  * </tbody>
  * </table>
  *
@@ -125,20 +119,19 @@
  * matching {@code Mixer.Info} object is found, or the mixer name is not
  * specified, the first mixer from the resulting list, which provides the
  * respective line interface, will be returned.
- *
+ * <p>
  * For example, the property {@code javax.sound.sampled.Clip} with a value
- * {@code "com.sun.media.sound.MixerProvider#SunClip"}
- * will have the following consequences when {@code getLine} is called
- * requesting a {@code Clip} instance: if the class
- * {@code com.sun.media.sound.MixerProvider} exists in the list of installed
- * mixer providers, the first {@code Clip} from the first mixer with name
- * {@code "SunClip"} will be returned. If it cannot be found, the
- * first {@code Clip} from the first mixer of the specified provider will be
+ * {@code "com.sun.media.sound.MixerProvider#SunClip"} will have the following
+ * consequences when {@code getLine} is called requesting a {@code Clip}
+ * instance: if the class {@code com.sun.media.sound.MixerProvider} exists in
+ * the list of installed mixer providers, the first {@code Clip} from the first
+ * mixer with name {@code "SunClip"} will be returned. If it cannot be found,
+ * the first {@code Clip} from the first mixer of the specified provider will be
  * returned, regardless of name. If there is none, the first {@code Clip} from
- * the first {@code Mixer} with name {@code "SunClip"} in the list of
- * all mixers (as returned by {@code getMixerInfo}) will be returned, or, if not
- * found, the first {@code Clip} of the first {@code Mixer} that can be found in
- * the list of all mixers is returned. If that fails, too, an
+ * the first {@code Mixer} with name {@code "SunClip"} in the list of all mixers
+ * (as returned by {@code getMixerInfo}) will be returned, or, if not found, the
+ * first {@code Clip} of the first {@code Mixer} that can be found in the list
+ * of all mixers is returned. If that fails, too, an
  * {@code IllegalArgumentException} is thrown.
  *
  * @author Kara Kytle
@@ -479,7 +472,6 @@
      * @param  mixerInfo a {@code Mixer.Info} object representing the desired
      *         mixer, or {@code null} for the system default mixer
      * @return a clip object from the specified mixer
-     *
      * @throws LineUnavailableException if a clip is not available from this
      *         mixer due to resource restrictions
      * @throws SecurityException if a clip is not available from this mixer due
@@ -670,9 +662,9 @@
      *
      * @param  sourceEncoding the encoding for which conversion support is
      *         queried
-     * @return array of encodings. If {@code sourceEncoding}is not supported, an
-     *         array of length 0 is returned. Otherwise, the array will have a
-     *         length of at least 1, representing {@code sourceEncoding}
+     * @return array of encodings. If {@code sourceEncoding} is not supported,
+     *         an array of length 0 is returned. Otherwise, the array will have
+     *         a length of at least 1, representing {@code sourceEncoding}
      *         (no conversion).
      * @throws NullPointerException if {@code sourceEncoding} is {@code null}
      */
@@ -935,15 +927,15 @@
     }
 
     /**
-     * Obtains the audio file format of the specified URL. The URL must point to
-     * valid audio file data.
+     * Obtains the audio file format of the specified {@code URL}. The
+     * {@code URL} must point to valid audio file data.
      *
-     * @param  url the URL from which file format information should be
+     * @param  url the {@code URL} from which file format information should be
      *         extracted
      * @return an {@code AudioFileFormat} object describing the audio file
      *         format
-     * @throws UnsupportedAudioFileException if the URL does not point to valid
-     *         audio file data recognized by the system
+     * @throws UnsupportedAudioFileException if the {@code URL} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an input/output exception occurs
      * @throws NullPointerException if {@code url} is {@code null}
      */
@@ -1021,15 +1013,15 @@
     }
 
     /**
-     * Obtains an audio input stream from the URL provided. The URL must point
-     * to valid audio file data.
+     * Obtains an audio input stream from the {@code URL} provided. The
+     * {@code URL} must point to valid audio file data.
      *
-     * @param  url the URL for which the {@code AudioInputStream} should be
-     *         constructed
+     * @param  url the {@code URL} for which the {@code AudioInputStream} should
+     *         be constructed
      * @return an {@code AudioInputStream} object based on the audio file data
-     *         pointed to by the URL
-     * @throws UnsupportedAudioFileException if the URL does not point to valid
-     *         audio file data recognized by the system
+     *         pointed to by the {@code URL}
+     * @throws UnsupportedAudioFileException if the {@code URL} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @throws NullPointerException if {@code url} is {@code null}
      */
@@ -1121,8 +1113,8 @@
      * Obtains the file types that the system can write from the audio input
      * stream specified.
      *
-     * @param  stream the audio input stream for which audio file type
-     *         support is queried
+     * @param  stream the audio input stream for which audio file type support
+     *         is queried
      * @return array of file types. If no file types are supported, an array of
      *         length 0 is returned.
      * @throws NullPointerException if {@code stream} is {@code null}
@@ -1175,8 +1167,8 @@
      * type to the output stream provided. Some file types require that the
      * length be written into the file header; such files cannot be written from
      * start to finish unless the length is known in advance. An attempt to
-     * write a file of such a type will fail with an IOException if the length
-     * in the audio file type is {@code AudioSystem.NOT_SPECIFIED}.
+     * write a file of such a type will fail with an {@code IOException} if the
+     * length in the audio file type is {@code AudioSystem.NOT_SPECIFIED}.
      *
      * @param  stream the audio input stream containing audio data to be written
      *         to the file
@@ -1250,7 +1242,9 @@
     // METHODS FOR INTERNAL IMPLEMENTATION USE
 
     /**
-     * Obtains the set of MixerProviders on the system.
+     * Obtains the list of MixerProviders currently installed on the system.
+     *
+     * @return the list of MixerProviders currently installed on the system
      */
     @SuppressWarnings("unchecked")
     private static List<MixerProvider> getMixerProviders() {
@@ -1331,9 +1325,12 @@
             }
         }
 
-        /* Provider class not specified or
-           provider class cannot be found, or
-           provider class and instance specified and instance cannot be found or is not appropriate */
+        /*
+         *  - Provider class not specified, or
+         *  - provider class cannot be found, or
+         *  - provider class and instance specified and instance cannot be found
+         *    or is not appropriate
+         */
         if (instanceName != null) {
             mixer = getNamedMixer(instanceName, providers, info);
             if (mixer != null) {
@@ -1342,8 +1339,10 @@
         }
 
 
-        /* No default are specified, or if something is specified, everything
-           failed. */
+        /*
+         * No defaults are specified, or if something is specified, everything
+         * failed
+         */
         return null;
     }
 
@@ -1436,10 +1435,14 @@
 
     /**
      * Checks if a Mixer is appropriate. A Mixer is considered appropriate if it
-     * support the given line type. If isMixingRequired is true and the line
-     * type is an output one (SourceDataLine, Clip), the mixer is appropriate if
-     * it supports at least 2 (concurrent) lines of the given type.
+     * support the given line type. If isMixingRequired is {@code true} and the
+     * line type is an output one (SourceDataLine, Clip), the mixer is
+     * appropriate if it supports at least 2 (concurrent) lines of the given
+     * type.
      *
+     * @param  mixer The mixer to check
+     * @param  lineInfo The line to check
+     * @param  isMixingRequired Is the mixing required or not
      * @return {@code true} if the mixer is considered appropriate according to
      *         the rules given above, {@code false} otherwise
      */
@@ -1461,6 +1464,10 @@
 
     /**
      * Like getMixerInfo, but return List.
+     *
+     * @return a List of info objects for the currently installed mixers. If no
+     *         mixers are available on the system, an empty List is returned.
+     * @see #getMixerInfo()
      */
     private static List<Mixer.Info> getMixerInfoList() {
         List<MixerProvider> providers = getMixerProviders();
@@ -1469,6 +1476,11 @@
 
     /**
      * Like getMixerInfo, but return List.
+     *
+     * @param  providers The list of MixerProviders
+     * @return a List of info objects for the currently installed mixers. If no
+     *         mixers are available on the system, an empty List is returned.
+     * @see #getMixerInfo()
      */
     private static List<Mixer.Info> getMixerInfoList(List<MixerProvider> providers) {
         List<Mixer.Info> infos = new ArrayList<>();
@@ -1491,6 +1503,11 @@
      * Obtains the set of services currently installed on the system using the
      * SPI mechanism in 1.3.
      *
+     * @param  providerClass The type of providers requested. This should be one
+     *         of AudioFileReader.class, AudioFileWriter.class,
+     *         FormatConversionProvider.class, MixerProvider.class,
+     *         MidiDeviceProvider.class, MidiFileReader.class,
+     *         MidiFileWriter.class or SoundbankReader.class.
      * @return a List of instances of providers for the requested service. If no
      *         providers are available, a vector of length 0 will be returned.
      */
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,7 +121,7 @@
     /**
      * Provides a string representation of the control.
      *
-     * @return a string description
+     * @return a string representation of the control
      */
     @Override
     public String toString() {
@@ -153,7 +153,7 @@
         /**
          * Constructs a new boolean control type.
          *
-         * @param name the name of the new boolean control type
+         * @param  name the name of the new boolean control type
          */
         protected Type(final String name) {
             super(name);
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Clip.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Clip.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -178,13 +178,13 @@
     /**
      * Sets the first and last sample frames that will be played in the loop.
      * The ending point must be greater than or equal to the starting point, and
-     * both must fall within the size of the loaded media. A value of 0 for
-     * the starting point means the beginning of the loaded media. Similarly, a
+     * both must fall within the size of the loaded media. A value of 0 for the
+     * starting point means the beginning of the loaded media. Similarly, a
      * value of -1 for the ending point indicates the last frame of the media.
      *
      * @param  start the loop's starting position, in sample frames (zero-based)
-     * @param  end the loop's ending position, in sample frames (zero-based),
-     *         or -1 to indicate the final frame
+     * @param  end the loop's ending position, in sample frames (zero-based), or
+     *         -1 to indicate the final frame
      * @throws IllegalArgumentException if the requested loop points cannot be
      *         set, usually because one or both falls outside the media's
      *         duration or because the ending point is before the starting point
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/CompoundControl.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/CompoundControl.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,8 +90,7 @@
 
     /**
      * An instance of the {@code CompoundControl.Type} inner class identifies
-     * one kind of compound control. Static instances are provided for the
-     * common types.
+     * one kind of compound control.
      *
      * @author Kara Kytle
      * @since 1.3
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Control.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Control.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
     private final Type type;
 
     /**
-     * Constructs a Control with the specified type.
+     * Constructs a control with the specified type.
      *
      * @param  type the kind of control desired
      */
@@ -66,9 +66,9 @@
     }
 
     /**
-     * Obtains a String describing the control type and its current state.
+     * Obtains a string describing the control type and its current state.
      *
-     * @return a String representation of the Control
+     * @return a string representation of the control
      */
     @Override
     public String toString() {
@@ -77,7 +77,6 @@
 
     /**
      * An instance of the {@code Type} class represents the type of the control.
-     * Static instances are provided for the common types.
      */
     public static class Type {
 
@@ -98,7 +97,12 @@
         }
 
         /**
-         * Finalizes the equals method.
+         * Indicates whether the specified object is equal to this control type,
+         * returning {@code true} if the objects are the same.
+         *
+         * @param  obj the reference object with which to compare
+         * @return {@code true} if the specified object is equal to this control
+         *         type; {@code false} otherwise
          */
         @Override
         public final boolean equals(Object obj) {
@@ -106,7 +110,9 @@
         }
 
         /**
-         * Finalizes the hashCode method.
+         * Returns a hash code value for this control type.
+         *
+         * @return a hash code value for this control type
          */
         @Override
         public final int hashCode() {
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/DataLine.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/DataLine.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,7 +54,7 @@
  * data, a {@code STOP} event is generated.
  * <p>
  * Mixers often support synchronized control of multiple data lines.
- * Synchronization can be established through the Mixer interface's
+ * Synchronization can be established through the {@code Mixer} interface's
  * {@link Mixer#synchronize synchronize} method. See the description of the
  * {@link Mixer Mixer} interface for a more complete description.
  *
@@ -181,7 +181,7 @@
      * are bytes, but will always correspond to an integral number of sample
      * frames of audio data.
      *
-     * @return the size of the buffer in bytes
+     * @return the size of the buffer, in bytes
      */
     int getBufferSize();
 
@@ -260,8 +260,8 @@
      * {@code DataLine.Info} provides additional information specific to data
      * lines. This information includes:
      * <ul>
-     * <li> the audio formats supported by the data line
-     * <li> the minimum and maximum sizes of its internal buffer
+     *   <li>the audio formats supported by the data line
+     *   <li>the minimum and maximum sizes of its internal buffer
      * </ul>
      * Because a {@code Line.Info} knows the class of the line its describes, a
      * {@code DataLine.Info} object can describe {@code DataLine} subinterfaces
@@ -270,14 +270,25 @@
      * appropriate instance of {@code DataLine.Info} as the argument to a method
      * such as {@link Mixer#getLine(Line.Info)}.
      *
+     * @author Kara Kytle
      * @see Line.Info
-     * @author Kara Kytle
      * @since 1.3
      */
     class Info extends Line.Info {
 
+        /**
+         * The set of supported formats.
+         */
         private final AudioFormat[] formats;
+
+        /**
+         * Minimum buffer size supported by the data line, in bytes.
+         */
         private final int minBufferSize;
+
+        /**
+         * Maximum buffer size supported by the data line, in bytes.
+         */
         private final int maxBufferSize;
 
         /**
@@ -289,10 +300,10 @@
          * @param  lineClass the class of the data line described by the info
          *         object
          * @param  formats set of formats supported
-         * @param  minBufferSize minimum buffer size supported by the data
-         *         line, in bytes
-         * @param  maxBufferSize maximum buffer size supported by the data
-         *         line, in bytes
+         * @param  minBufferSize minimum buffer size supported by the data line,
+         *         in bytes
+         * @param  maxBufferSize maximum buffer size supported by the data line,
+         *         in bytes
          */
         public Info(Class<?> lineClass, AudioFormat[] formats, int minBufferSize, int maxBufferSize) {
 
@@ -317,7 +328,7 @@
          * @param  lineClass the class of the data line described by the info
          *         object
          * @param  format desired format
-         * @param  bufferSize desired buffer size in bytes
+         * @param  bufferSize desired buffer size, in bytes
          */
         public Info(Class<?> lineClass, AudioFormat format, int bufferSize) {
 
@@ -354,7 +365,7 @@
          * {@code isFormatSupported(AudioFormat)} is guaranteed to return
          * {@code true} for all formats returned by {@code getFormats()}.
          * <p>
-         * Some fields in the AudioFormat instances can be set to
+         * Some fields in the {@code AudioFormat} instances can be set to
          * {@link AudioSystem#NOT_SPECIFIED NOT_SPECIFIED} if that field does
          * not apply to the format, or if the format supports a wide range of
          * values for that field. For example, a multi-channel device supporting
@@ -419,6 +430,7 @@
          * large as that of the object specified, and all of its formats must
          * match formats supported by the object specified.
          *
+         * @param  info the info object which is being compared to this one
          * @return {@code true} if this object matches the one specified,
          *         otherwise {@code false}
          */
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Line.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Line.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -237,8 +237,8 @@
          * class. This constructor is typically used by an application to
          * describe a desired line.
          *
-         * @param  lineClass the class of the line that the new Line.Info object
-         *         describes
+         * @param  lineClass the class of the line that the new
+         *         {@code Line.Info} object describes
          */
         public Info(Class<?> lineClass) {
 
@@ -250,7 +250,8 @@
         }
 
         /**
-         * Obtains the class of the line that this Line.Info object describes.
+         * Obtains the class of the line that this {@code Line.Info} object
+         * describes.
          *
          * @return the described line's class
          */
@@ -261,13 +262,13 @@
         /**
          * Indicates whether the specified info object matches this one. To
          * match, the specified object must be identical to or a special case of
-         * this one. The specified info object must be either an instance of
-         * the same class as this one, or an instance of a sub-type of this one.
-         * In addition, the attributes of the specified object must be
-         * compatible with the capabilities of this one. Specifically, the
-         * routing configuration for the specified info object must be
-         * compatible with that of this one. Subclasses may add other criteria
-         * to determine whether the two objects match.
+         * this one. The specified info object must be either an instance of the
+         * same class as this one, or an instance of a sub-type of this one. In
+         * addition, the attributes of the specified object must be compatible
+         * with the capabilities of this one. Specifically, the routing
+         * configuration for the specified info object must be compatible with
+         * that of this one. Subclasses may add other criteria to determine
+         * whether the two objects match.
          *
          * @param  info the info object which is being compared to this one
          * @return {@code true} if the specified object matches this one,
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,14 +48,17 @@
  */
 public class LineEvent extends EventObject {
 
+    /**
+     * Use serialVersionUID from JDK 1.3 for interoperability.
+     */
     private static final long serialVersionUID = -1274246333383880410L;
 
     /**
      * The kind of line event ({@code OPEN}, {@code CLOSE}, {@code START}, or
      * {@code STOP}).
      *
+     * @see #getType
      * @serial
-     * @see #getType
      */
     private final Type type;
 
@@ -67,8 +70,8 @@
      * this value is not known, the position value should be
      * {@link AudioSystem#NOT_SPECIFIED}.
      *
+     * @see #getFramePosition
      * @serial
-     * @see #getFramePosition
      */
     private final long position;
 
@@ -184,11 +187,11 @@
 
         /**
          * Indicates whether the specified object is equal to this event type,
-         * returning {@code true} if the objects are identical.
+         * returning {@code true} if the objects are the same.
          *
          * @param  obj the reference object with which to compare
-         * @return {@code true} if this event type is the same as {@code obj};
-         *         {@code false} otherwise
+         * @return {@code true} if the specified object is equal to this event
+         *         type; {@code false} otherwise
          */
         @Override
         public final boolean equals(Object obj) {
@@ -196,7 +199,9 @@
         }
 
         /**
-         * Finalizes the hashcode method.
+         * Returns a hash code value for this event type.
+         *
+         * @return a hash code value for this event type
          */
         @Override
         public final int hashCode() {
@@ -205,6 +210,8 @@
 
         /**
          * Returns the type name as the string representation.
+         *
+         * @return the type name as the string representation
          */
         @Override
         public String toString() {
@@ -253,22 +260,24 @@
 
         /**
          * A type of event that is sent when a line ceases to engage in active
-         * input or output of audio data because the end of media has been reached.
+         * input or output of audio data because the end of media has been
+         * reached.
          */
         /*
-         * ISSUE: we may want to get rid of this.  Is JavaSound
-         * responsible for reporting this??
+         * ISSUE: we may want to get rid of this. Is JavaSound responsible for
+         * reporting this??
          *
-         * [If it's decided to keep this API, the docs will need to be updated to include mention
-         * of EOM events elsewhere.]
+         * [If it's decided to keep this API, the docs will need to be updated
+         * to include mention of EOM events elsewhere.]
          */
         //public static final Type EOM  = new Type("EOM");
 
         /**
          * A type of event that is sent when a line begins to engage in active
-         * input or output of audio data.  Examples of when this happens are
-         * when a source line begins or resumes writing data to its mixer, and
-         * when a target line begins or resumes reading data from its mixer.
+         * input or output of audio data. Examples of when this happens are when
+         * a source line begins or resumes writing data to its mixer, and when a
+         * target line begins or resumes reading data from its mixer.
+         *
          * @see #STOP
          * @see SourceDataLine#write
          * @see TargetDataLine#read
@@ -277,8 +286,9 @@
         //public static final Type ACTIVE       = new Type("ACTIVE");
 
         /**
-         * A type of event that is sent when a line ceases active input or output
-         * of audio data.
+         * A type of event that is sent when a line ceases active input or
+         * output of audio data.
+         *
          * @see #START
          * @see DataLine#stop
          */
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineUnavailableException.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineUnavailableException.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,9 @@
  */
 public class LineUnavailableException extends Exception {
 
+    /**
+     * Use serialVersionUID from JDK 1.3 for interoperability.
+     */
     private static final long serialVersionUID = -2046718279487432130L;
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Mixer.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Mixer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@
      * version, vendor, etc.
      *
      * @return a mixer info object that describes this mixer
-     * @see Mixer.Info
+     * @see Info
      */
     Info getMixerInfo();
 
@@ -144,19 +144,19 @@
     /**
      * Obtains the approximate maximum number of lines of the requested type
      * that can be open simultaneously on the mixer.
-     *
+     * <p>
      * Certain types of mixers do not have a hard bound and may allow opening
      * more lines. Since certain lines are a shared resource, a mixer may not be
      * able to open the maximum number of lines if another process has opened
      * lines of this mixer.
-     *
+     * <p>
      * The requested type is any line that matches the description in the
      * provided {@code Line.Info} object. For example, if the info object
      * represents a speaker port, and the mixer supports exactly one speaker
-     * port, this method should return 1. If the info object represents a
-     * source data line and the mixer supports the use of 32 source data lines
+     * port, this method should return 1. If the info object represents a source
+     * data line and the mixer supports the use of 32 source data lines
      * simultaneously, the return value should be 32. If there is no limit, this
-     * function returns {@code AudioSystem.NOT_SPECIFIED}.
+     * function returns {@link AudioSystem#NOT_SPECIFIED}.
      *
      * @param  info a {@code Line.Info} that describes the line for which the
      *         number of supported instances is queried
@@ -215,11 +215,10 @@
      * this mixer are unsynchronized.
      *
      * @param  lines the synchronized lines for which synchronization should be
-     *         released, or {@code null} for all this mixer's synchronized
-     *         lines
+     *         released, or {@code null} for all this mixer's synchronized lines
      * @throws IllegalArgumentException if the lines cannot be unsynchronized.
-     *         This may occur if the argument specified does not exactly match
-     *         a set of lines for which synchronization has already been
+     *         This may occur if the argument specified does not exactly match a
+     *         set of lines for which synchronization has already been
      *         established.
      */
     void unsynchronize(Line[] lines);
@@ -277,8 +276,8 @@
          * information.
          *
          * @param  name the name of the mixer
-         * @param  vendor the company who manufactures or creates the
-         *         hardware or software mixer
+         * @param  vendor the company who manufactures or creates the hardware
+         *         or software mixer
          * @param  description descriptive text about the mixer
          * @param  version version information for the mixer
          */
@@ -291,13 +290,12 @@
         }
 
         /**
-         * Indicates whether two info objects are equal, returning {@code true}
-         * if they are identical.
+         * Indicates whether the specified object is equal to this info object,
+         * returning {@code true} if the objects are the same.
          *
-         * @param  obj the reference object with which to compare this info
-         *         object
-         * @return {@code true} if this info object is the same as the
-         *         {@code obj} argument; {@code false} otherwise
+         * @param  obj the reference object with which to compare
+         * @return {@code true} if the specified object is equal to this info
+         *         object; {@code false} otherwise
          */
         @Override
         public final boolean equals(Object obj) {
@@ -305,9 +303,9 @@
         }
 
         /**
-         * Finalizes the hashcode method.
+         * Returns a hash code value for this info object.
          *
-         * @return the hashcode for this object
+         * @return a hash code value for this info object
          */
         @Override
         public final int hashCode() {
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Port.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Port.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,7 +100,14 @@
         // DAT
         // DVD
 
+        /**
+         * The string that names the port.
+         */
         private final String name;
+
+        /**
+         * Whether this port is source or not.
+         */
         private final boolean isSource;
 
         /**
@@ -111,8 +118,8 @@
          * @param  lineClass the class of the port described by the info object
          * @param  name the string that names the port
          * @param  isSource {@code true} if the port is a source port (such as a
-         *         microphone), {@code false} if the port is a target port
-         *         (such as a speaker)
+         *         microphone), {@code false} if the port is a target port (such
+         *         as a speaker)
          */
         public Info(Class<?> lineClass, String name, boolean isSource) {
 
@@ -134,8 +141,8 @@
          * Indicates whether the port is a source or a target for its mixer.
          *
          * @return {@code true} if the port is a source port (such as a
-         *         microphone), {@code false} if the port is a target port
-         *         (such as a speaker)
+         *         microphone), {@code false} if the port is a target port (such
+         *         as a speaker)
          */
         public boolean isSource() {
             return isSource;
@@ -147,6 +154,8 @@
          * types must be equal.
          *
          * @param  info the info object for which the match is queried
+         * @return {@code true} if the specified object matches this one,
+         *         {@code false} otherwise
          */
         @Override
         public boolean matches(Line.Info info) {
@@ -167,7 +176,12 @@
         }
 
         /**
-         * Finalizes the equals method.
+         * Indicates whether the specified object is equal to this info object,
+         * returning {@code true} if the objects are the same.
+         *
+         * @param  obj the reference object with which to compare
+         * @return {@code true} if the specified object is equal to this info
+         *         object; {@code false} otherwise
          */
         @Override
         public final boolean equals(Object obj) {
@@ -175,7 +189,9 @@
         }
 
         /**
-         * Finalizes the hashCode method.
+         * Returns a hash code value for this info object.
+         *
+         * @return a hash code value for this info object
          */
         @Override
         public final int hashCode() {
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java	Sat Sep 09 14:36:45 2017 +0200
@@ -38,7 +38,7 @@
  * delay time and intensity of early reflections, the delay time and intensity
  * of late reflections, and an overall decay time. Early reflections are the
  * initial individual low-order reflections of the direct signal off the
- * surfaces in the room. The late Reflections are the dense, high-order
+ * surfaces in the room. The late reflections are the dense, high-order
  * reflections that characterize the room's reverberation. The delay times for
  * the start of these two reflection types give the listener a sense of the
  * overall size and complexity of the room's shape and contents. The larger the
@@ -63,8 +63,8 @@
  * <p>
  * If implementing JavaSound on a I3DL2-compliant device:
  * <ul>
- * <li>Filtering is disabled (high-frequency attenuations are set to 0.0 dB)
- * <li>Density parameters are set to midway between minimum and maximum
+ *   <li>Filtering is disabled (high-frequency attenuations are set to 0.0 dB)
+ *   <li>Density parameters are set to midway between minimum and maximum
  * </ul>
  * <p>
  * The following table shows what parameter values an implementation might use
@@ -74,60 +74,50 @@
  * <caption>Reverb types and params: decay time, late intensity, late delay,
  * early intensity, and early delay</caption>
  * <thead>
- * <tr>
- *  <th>Type</th>
- *  <th>Decay Time (ms)</th>
- *  <th>Late Intensity (dB)</th>
- *  <th>Late Delay (ms)</th>
- *  <th>Early Intensity (dB)</th>
- *  <th>Early Delay(ms)</th>
- * </tr>
+ *   <tr>
+ *     <th>Type
+ *     <th>Decay Time (ms)
+ *     <th>Late Intensity (dB)
+ *     <th>Late Delay (ms)
+ *     <th>Early Intensity (dB)
+ *     <th>Early Delay(ms)
  * </thead>
  * <tbody>
- * <tr>
- *  <td>Cavern</td>
- *  <td>2250</td>
- *  <td>-2.0</td>
- *  <td>41.3</td>
- *  <td>-1.4</td>
- *  <td>10.3</td>
- * </tr>
- *
- * <tr>
- *  <td>Dungeon</td>
- *  <td>1600</td>
- *  <td>-1.0</td>
- *  <td>10.3</td>
- *  <td>-0.7</td>
- *  <td>2.6</td>
- * </tr>
- *
- * <tr>
- *  <td>Garage</td>
- *  <td>900</td>
- *  <td>-6.0</td>
- *  <td>14.7</td>
- *  <td>-4.0</td>
- *  <td>3.9</td>
- * </tr>
- *
- * <tr>
- *  <td>Acoustic Lab</td>
- *  <td>280</td>
- *  <td>-3.0</td>
- *  <td>8.0</td>
- *  <td>-2.0</td>
- *  <td>2.0</td>
- * </tr>
- *
- * <tr>
- *  <td>Closet</td>
- *  <td>150</td>
- *  <td>-10.0</td>
- *  <td>2.5</td>
- *  <td>-7.0</td>
- *  <td>0.6</td>
- * </tr>
+ *   <tr>
+ *     <td>Cavern
+ *     <td>2250
+ *     <td>-2.0
+ *     <td>41.3
+ *     <td>-1.4
+ *     <td>10.3
+ *   <tr>
+ *     <td>Dungeon
+ *     <td>1600
+ *     <td>-1.0
+ *     <td>10.3
+ *     <td>-0.7
+ *     <td>2.6
+ *   <tr>
+ *     <td>Garage
+ *     <td>900
+ *     <td>-6.0
+ *     <td>14.7
+ *     <td>-4.0
+ *     <td>3.9
+ *   <tr>
+ *     <td>Acoustic Lab
+ *     <td>280
+ *     <td>-3.0
+ *     <td>8.0
+ *     <td>-2.0
+ *     <td>2.0
+ *   <tr>
+ *     <td>Closet
+ *     <td>150
+ *     <td>-10.0
+ *     <td>2.5
+ *     <td>-7.0
+ *     <td>0.6
  * </tbody>
  * </table>
  *
@@ -199,7 +189,7 @@
      * @since 1.5
      */
     public String getName() {
-            return name;
+        return name;
     }
 
     /**
@@ -257,11 +247,11 @@
 
     /**
      * Indicates whether the specified object is equal to this reverb type,
-     * returning {@code true} if the objects are identical.
+     * returning {@code true} if the objects are the same.
      *
      * @param  obj the reference object with which to compare
-     * @return {@code true} if this reverb type is the same as {@code obj};
-     *         {@code false} otherwise
+     * @return {@code true} if the specified object is equal to this reverb
+     *         type; {@code false} otherwise
      */
     @Override
     public final boolean equals(Object obj) {
@@ -269,7 +259,9 @@
     }
 
     /**
-     * Finalizes the hashcode method.
+     * Returns a hash code value for this reverb type.
+     *
+     * @return a hash code value for this reverb type
      */
     @Override
     public final int hashCode() {
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java	Sat Sep 09 14:36:45 2017 +0200
@@ -168,9 +168,9 @@
      * {@code IllegalArgumentException}.
      *
      * @param  b a byte array containing data to be written to the data line
+     * @param  off the offset from the beginning of the array, in bytes
      * @param  len the length, in bytes, of the valid data in the array (in
      *         other words, the requested amount of data to write, in bytes)
-     * @param  off the offset from the beginning of the array, in bytes
      * @return the number of bytes actually written
      * @throws IllegalArgumentException if the requested number of bytes does
      *         not represent an integral number of sample frames, or if
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,11 +35,14 @@
  */
 public class UnsupportedAudioFileException extends Exception {
 
+    /**
+     * Use serialVersionUID from JDK 1.3 for interoperability.
+     */
     private static final long serialVersionUID = -139127412623160368L;
 
     /**
-     * Constructs an {@code UnsupportedAudioFileException} that has
-     * {@code null} as its error detail message.
+     * Constructs an {@code UnsupportedAudioFileException} that has {@code null}
+     * as its error detail message.
      */
     public UnsupportedAudioFileException() {
         super();
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -30,8 +30,8 @@
  * <h2>Related Documentation</h2>
  * For more information on using Java Sound see:
  * <ul>
- *     <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
- *     The Java Sound Tutorial</a></li>
+ *   <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
+ *   The Java Sound Tutorial</a>
  * </ul>
  *
  * @since 1.3
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileReader.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileReader.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, 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
@@ -68,15 +68,15 @@
             throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains the audio file format of the URL provided. The URL must point to
-     * valid audio file data.
+     * Obtains the audio file format of the {@code URL} provided. The
+     * {@code URL} must point to valid audio file data.
      *
-     * @param  url the URL from which file format information should be
+     * @param  url the {@code URL} from which file format information should be
      *         extracted
      * @return an {@code AudioFileFormat} object describing the audio file
      *         format
-     * @throws UnsupportedAudioFileException if the URL does not point to valid
-     *         audio file data recognized by the system
+     * @throws UnsupportedAudioFileException if the {@code URL} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @throws NullPointerException if {@code url} is {@code null}
      */
@@ -84,11 +84,11 @@
             throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains the audio file format of the {@code File} provided.
-     * The {@code File} must point to valid audio file data.
+     * Obtains the audio file format of the {@code File} provided. The
+     * {@code File} must point to valid audio file data.
      *
-     * @param  file the {@code File} from which file format information
-     *         should be extracted
+     * @param  file the {@code File} from which file format information should
+     *         be extracted
      * @return an {@code AudioFileFormat} object describing the audio file
      *         format
      * @throws UnsupportedAudioFileException if the {@code File} does not point
@@ -123,15 +123,15 @@
             throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains an audio input stream from the URL provided. The URL must point
-     * to valid audio file data.
+     * Obtains an audio input stream from the {@code URL} provided. The
+     * {@code URL} must point to valid audio file data.
      *
-     * @param  url the URL for which the {@code AudioInputStream} should be
-     *         constructed
+     * @param  url the {@code URL} for which the {@code AudioInputStream} should
+     *         be constructed
      * @return an {@code AudioInputStream} object based on the audio file data
-     *         pointed to by the URL
-     * @throws UnsupportedAudioFileException if the URL does not point to valid
-     *         audio file data recognized by the system
+     *         pointed to by the {@code URL}
+     * @throws UnsupportedAudioFileException if the {@code URL} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @throws NullPointerException if {@code url} is {@code null}
      */
@@ -139,8 +139,8 @@
             throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains an audio input stream from the {@code File} provided.
-     * The {@code File} must point to valid audio file data.
+     * Obtains an audio input stream from the {@code File} provided. The
+     * {@code File} must point to valid audio file data.
      *
      * @param  file the {@code File} for which the {@code AudioInputStream}
      *         should be constructed
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -113,10 +113,10 @@
 
     /**
      * Writes a stream of bytes representing an audio file of the file type
-     * indicated to the output stream provided. Some file types require that
-     * the length be written into the file header, and cannot be written from
-     * start to finish unless the length is known in advance. An attempt to
-     * write such a file type will fail with an IOException if the length in the
+     * indicated to the output stream provided. Some file types require that the
+     * length be written into the file header, and cannot be written from start
+     * to finish unless the length is known in advance. An attempt to write such
+     * a file type will fail with an {@code IOException} if the length in the
      * audio file format is {@link AudioSystem#NOT_SPECIFIED}.
      *
      * @param  stream the audio input stream containing audio data to be written
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/package-info.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/package-info.java	Sat Sep 09 14:36:45 2017 +0200
@@ -30,8 +30,8 @@
  * <h2>Related Documentation</h2>
  * For more information on using Java Sound see:
  * <ul>
- *     <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
- *     The Java Sound Tutorial</a></li>
+ *   <li><a href="https://docs.oracle.com/javase/tutorial/sound/">
+ *   The Java Sound Tutorial</a>
  * </ul>
  *
  * @since 1.3
--- a/jdk/src/java.desktop/share/classes/javax/swing/ButtonModel.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/ButtonModel.java	Sat Sep 09 14:36:45 2017 +0200
@@ -199,6 +199,21 @@
     public void setGroup(ButtonGroup group);
 
     /**
+     * Returns the group that the button belongs to.
+     * Normally used with radio buttons, which are mutually
+     * exclusive within their group.
+     *
+     * @implSpec The default implementation of this method returns {@code null}.
+     * Subclasses should return the group set by setGroup().
+     *
+     * @return the <code>ButtonGroup</code> that the button belongs to
+     * @since 10
+     */
+    default ButtonGroup getGroup() {
+        return null;
+    }
+
+    /**
      * Adds an <code>ActionListener</code> to the model.
      *
      * @param l the listener to add
--- a/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1077,8 +1077,15 @@
         firePropertyChange(IS_SELECTED_PROPERTY, oldValue, newValue);
         if (isSelected)
           fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ACTIVATED);
-        else
+        else {
           fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED);
+          try {
+              java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(
+                                               new sun.awt.UngrabEvent(this));
+          } catch (SecurityException e) {
+              this.dispatchEvent(new sun.awt.UngrabEvent(this));
+          }
+        }
         repaint();
     }
 
@@ -1758,6 +1765,12 @@
           isClosed = true;
         }
         fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSED);
+        try {
+            java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(
+                    new sun.awt.UngrabEvent(this));
+        } catch (SecurityException e) {
+            this.dispatchEvent(new sun.awt.UngrabEvent(this));
+        }
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1233,6 +1233,16 @@
                                         messageType, icon, null, null);
     }
 
+    private static boolean checkFrameForComponent(Component parentComponent) {
+        if (parentComponent == null) {
+            return false;
+        }
+        if (parentComponent instanceof Frame) {
+            return true;
+        }
+        return checkFrameForComponent(parentComponent.getParent());
+    }
+
     /**
      * Brings up an internal dialog panel with a specified icon, where
      * the initial choice is determined by the <code>initialValue</code>
@@ -1293,32 +1303,39 @@
                 getFocusOwner();
 
         pane.setInitialValue(initialValue);
-
-        JInternalFrame dialog =
-            pane.createInternalFrame(parentComponent, title);
-        pane.selectInitialValue();
-        dialog.setVisible(true);
+        if (checkFrameForComponent(parentComponent)) {
+            JInternalFrame dialog =
+                    pane.createInternalFrame(parentComponent, title);
+            pane.selectInitialValue();
+            dialog.setVisible(true);
 
-        /* Since all input will be blocked until this dialog is dismissed,
-         * make sure its parent containers are visible first (this component
-         * is tested below).  This is necessary for JApplets, because
-         * because an applet normally isn't made visible until after its
-         * start() method returns -- if this method is called from start(),
-         * the applet will appear to hang while an invisible modal frame
-         * waits for input.
-         */
-        if (dialog.isVisible() && !dialog.isShowing()) {
-            Container parent = dialog.getParent();
-            while (parent != null) {
-                if (parent.isVisible() == false) {
-                    parent.setVisible(true);
+            /* Since all input will be blocked until this dialog is dismissed,
+             * make sure its parent containers are visible first (this component
+             * is tested below).  This is necessary for JApplets, because
+             * because an applet normally isn't made visible until after its
+             * start() method returns -- if this method is called from start(),
+             * the applet will appear to hang while an invisible modal frame
+             * waits for input.
+             */
+            if (dialog.isVisible() && !dialog.isShowing()) {
+                Container parent = dialog.getParent();
+                while (parent != null) {
+                    if (parent.isVisible() == false) {
+                        parent.setVisible(true);
+                    }
+                    parent = parent.getParent();
                 }
-                parent = parent.getParent();
             }
+
+            AWTAccessor.getContainerAccessor().startLWModal(dialog);
+        } else {
+            pane.setComponentOrientation(getRootFrame().getComponentOrientation());
+            int style = styleFromMessageType(messageType);
+            JDialog dialog = pane.createDialog(parentComponent, title, style);
+            pane.selectInitialValue();
+            dialog.setVisible(true);
         }
 
-        AWTAccessor.getContainerAccessor().startLWModal(dialog);
-
         if (parentComponent instanceof JInternalFrame) {
             try {
                 ((JInternalFrame)parentComponent).setSelected(true);
--- a/jdk/src/java.desktop/share/classes/javax/swing/JToggleButton.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/JToggleButton.java	Sat Sep 09 14:36:45 2017 +0200
@@ -219,8 +219,8 @@
           case TRAVERSAL_BACKWARD:
             ButtonModel model = getModel();
             JToggleButton selection = this;
-            if (model instanceof DefaultButtonModel) {
-                ButtonGroup group = ((DefaultButtonModel) model).getGroup();
+            if (model != null) {
+                ButtonGroup group = model.getGroup();
                 if (group != null && group.getSelection() != null
                                                   && !group.isSelected(model)) {
                     Iterator<AbstractButton> iterator =
--- a/jdk/src/java.desktop/share/classes/javax/swing/LayoutFocusTraversalPolicy.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/LayoutFocusTraversalPolicy.java	Sat Sep 09 14:36:45 2017 +0200
@@ -238,19 +238,18 @@
         } else if (aComponent instanceof JComponent) {
             if (SunToolkit.isInstanceOf(aComponent,
                                                  "javax.swing.JToggleButton")) {
-                JToggleButton.ToggleButtonModel model =
-                        (JToggleButton.ToggleButtonModel) ((JToggleButton)
-                                aComponent).getModel();
+                ButtonModel model = ((JToggleButton)aComponent).getModel();
                 if (model != null) {
                     ButtonGroup group = model.getGroup();
                     if (group != null) {
                         Enumeration<AbstractButton> elements =
-                                                            group.getElements();
+                                                        group.getElements();
                         int idx = 0;
                         while (elements.hasMoreElements()) {
                             AbstractButton member = elements.nextElement();
-                            if (member.isVisible() && member.isDisplayable() &&
-                                   member.isEnabled() && member.isFocusable()) {
+                            if (member instanceof JToggleButton &&
+                                 member.isVisible() && member.isDisplayable() &&
+                                 member.isEnabled() && member.isFocusable()) {
                                 if (member == aComponent) {
                                     return idx == 0;
                                 }
--- a/jdk/src/java.desktop/share/classes/javax/swing/MultiUIDefaults.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/MultiUIDefaults.java	Sat Sep 09 14:36:45 2017 +0200
@@ -127,7 +127,7 @@
 
     @Override
     protected void getUIError(String msg) {
-        if (tables.length > 0) {
+        if (tables != null && tables.length > 0 && tables[0] != null) {
             tables[0].getUIError(msg);
         } else {
             super.getUIError(msg);
--- a/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java	Sat Sep 09 14:36:45 2017 +0200
@@ -756,9 +756,8 @@
      * @see #getUI
      */
     protected void getUIError(String msg) {
-        System.err.println("UIDefaults.getUI() failed: " + msg);
         try {
-            throw new Error();
+            throw new Error(msg);
         }
         catch (Throwable e) {
             e.printStackTrace();
@@ -888,7 +887,7 @@
      * Adds a resource bundle to the list of resource bundles that are
      * searched for localized values. Resource bundles are searched in
      * the reverse order they were added, using the
-     * {@linkplain ClassLoader#getSystemClassLoader application class loader}.
+     * {@linkplain ClassLoader#getSystemClassLoader system class loader}.
      * In other words, the most recently added bundle is searched first.
      *
      * @param bundleName  the base name of the resource bundle to be added
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java	Sat Sep 09 14:36:45 2017 +0200
@@ -911,7 +911,7 @@
             // JComboBox mouse listener
             Component source = (Component)e.getSource();
             Dimension size = source.getSize();
-            Rectangle bounds = new Rectangle( 0, 0, size.width - 1, size.height - 1 );
+            Rectangle bounds = new Rectangle( 0, 0, size.width, size.height);
             if ( !bounds.contains( e.getPoint() ) ) {
                 MouseEvent newEvent = convertMouseEvent( e );
                 Point location = newEvent.getPoint();
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java	Sat Sep 09 14:36:45 2017 +0200
@@ -917,9 +917,14 @@
                     processMouseEvent(me);
                 break;
             case MouseEvent.MOUSE_WHEEL:
+                // If the scroll is done inside a combobox, menuitem,
+                // or inside a Popup#HeavyWeightWindow or inside a frame
+                // popup should not close which is the standard behaviour
                 if (isInPopup(src)
-                    || ((src instanceof JComboBox) && ((JComboBox) src).isPopupVisible())) {
-
+                    || ((src instanceof JComboBox) && ((JComboBox) src).isPopupVisible())
+                    || ((src instanceof JWindow) && ((JWindow)src).isVisible())
+                    || ((src instanceof JMenuItem) && ((JMenuItem)src).isVisible())
+                    || (src instanceof JFrame)) {
                     return;
                 }
                 cancelPopupMenu();
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1138,7 +1138,11 @@
                              int tabIndex, Icon icon, Rectangle iconRect,
                              boolean isSelected ) {
         if (icon != null) {
+            // Clip the icon within iconRect bounds
+            Shape oldClip = g.getClip();
+            ((Graphics2D)g).clip(iconRect);
             icon.paintIcon(tabPane, g, iconRect.x, iconRect.y);
+            g.setClip(oldClip);
         }
     }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java	Sat Sep 09 14:36:45 2017 +0200
@@ -281,11 +281,6 @@
         // Home Button
         File homeDir = fsv.getHomeDirectory();
         String toolTipText = homeFolderToolTipText;
-        if (fsv.isRoot(homeDir)) {
-            toolTipText = getFileView(fc).getName(homeDir); // Probably "Desktop".
-        }
-
-
 
 
         JButton b = new JButton(homeFolderIcon);
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -559,7 +559,7 @@
          */
         public PaintContext(Insets insets, Dimension canvasSize, boolean inverted,
                             CacheMode cacheMode, double maxH, double maxV) {
-            if (maxH < 1 || maxH < 1) {
+            if (maxH < 1 || maxV < 1) {
                 throw new IllegalArgumentException("Both maxH and maxV must be >= 1");
             }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf	Sat Sep 09 14:36:45 2017 +0200
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (c) 1998, 2015, 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
@@ -27303,6 +27303,45 @@
                   </layer>
                </canvas>
             </state>
+            <state stateKeys="Disabled">
+               <style>
+                  <textForeground/>
+                  <textBackground/>
+                  <background/>
+                  <uiproperties/>
+               </style>
+               <canvas>
+                  <size width="10" height="10"/>
+                  <nextLayerNameIndex>3</nextLayerNameIndex>
+                  <stretchingInsets top="1" bottom="1" left="1" right="1"/>
+                  <layer name="Layer 1">
+                     <opacity>1.0</opacity>
+                     <fillOpacity>1.0</fillOpacity>
+                     <blendingMode>NORMAL</blendingMode>
+                     <locked>false</locked>
+                     <visible>true</visible>
+                     <shapes>
+                        <rectangle x1="0.0" x2="10.0" y1="0.0" y2="1.0" rounding="0.0">
+                           <matte red="116" green="121" blue="128" alpha="255" uiDefaultParentName="nimbusBorder" hueOffset="-0.013888836" saturationOffset="5.823001E-4" brightnessOffset="-0.12941176" alphaOffset="0"/>
+                           <paintPoints x1="0.25" y1="0.0" x2="0.75" y2="1.0"/>
+                        </rectangle>
+                        <rectangle x1="0.0" x2="10.0" y1="9.0" y2="10.0" rounding="0.0">
+                           <matte red="116" green="121" blue="128" alpha="255" uiDefaultParentName="nimbusBorder" hueOffset="-0.013888836" saturationOffset="5.823001E-4" brightnessOffset="-0.12941176" alphaOffset="0"/>
+                           <paintPoints x1="0.25" y1="0.0" x2="0.75" y2="1.0"/>
+                        </rectangle>
+                        <rectangle x1="0.0" x2="1.0" y1="1.0" y2="9.0" rounding="0.0">
+                           <matte red="116" green="121" blue="128" alpha="255" uiDefaultParentName="nimbusBorder" hueOffset="-0.013888836" saturationOffset="5.823001E-4" brightnessOffset="-0.12941176" alphaOffset="0"/>
+                           <paintPoints x1="0.25" y1="0.0" x2="0.75" y2="1.0"/>
+                        </rectangle>
+                        <rectangle x1="9.0" x2="10.0" y1="1.0" y2="9.0" rounding="0.0">
+                           <matte red="116" green="121" blue="128" alpha="255" uiDefaultParentName="nimbusBorder" hueOffset="-0.013888836" saturationOffset="5.823001E-4" brightnessOffset="-0.12941176" alphaOffset="0"/>
+                           <paintPoints x1="0.25" y1="0.0" x2="0.75" y2="1.0"/>
+                        </rectangle>
+                     </shapes>
+                     <effects/>
+                  </layer>
+               </canvas>
+            </state>
          </backgroundStates>
          <foregroundStates/>
          <borderStates/>
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Sat Sep 09 14:36:45 2017 +0200
@@ -47,6 +47,8 @@
      */
     private Boolean localTrue = Boolean.TRUE;
 
+    private boolean updateKBAction = true;
+
     /**
      * Creates a new UI object for the given component.
      *
@@ -70,7 +72,7 @@
         if (clientProperty == null) {
             c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, localTrue);
         }
-        updateStyle(getComponent());
+        updateStyle(getComponent(), true);
     }
 
     /**
@@ -106,13 +108,22 @@
      */
     @Override
     protected void propertyChange(PropertyChangeEvent evt) {
+
+        if (evt.getPropertyName().equals("keymap")) {
+            if (evt.getNewValue() != null)
+            {
+                updateKBAction = false;
+            } else {
+                updateKBAction = true;
+            }
+        }
         if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
-            updateStyle((JTextComponent)evt.getSource());
+            updateStyle((JTextComponent)evt.getSource(), updateKBAction);
         }
         super.propertyChange(evt);
     }
 
-    private void updateStyle(JTextComponent comp) {
+    private void updateStyle(JTextComponent comp, boolean updateKBAction) {
         SynthContext context = getContext(comp, ENABLED);
         SynthStyle oldStyle = style;
 
@@ -121,7 +132,7 @@
         if (style != oldStyle) {
             SynthTextFieldUI.updateStyle(comp, context, getPropertyPrefix());
 
-            if (oldStyle != null) {
+            if (oldStyle != null && updateKBAction) {
                 uninstallKeyboardActions();
                 installKeyboardActions();
             }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthGraphicsUtils.java	Sat Sep 09 14:36:45 2017 +0200
@@ -326,7 +326,11 @@
      */
     public void paintText(SynthContext ss, Graphics g, String text,
                           Rectangle bounds, int mnemonicIndex) {
+        // Clip the text within textRect bounds
+        Shape oldClip = g.getClip();
+        ((Graphics2D)g).clip(bounds);
         paintText(ss, g, text, bounds.x, bounds.y, mnemonicIndex);
+        g.setClip(oldClip);
     }
 
     /**
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	Sat Sep 09 14:36:45 2017 +0200
@@ -683,6 +683,7 @@
                    "RIGHT", "selectChild",
                 "KP_RIGHT", "selectChild",
                    "ENTER", "return",
+                   "ctrl ENTER", "return",
                    "SPACE", "return"
         });
         table.put("PopupMenu.selectedWindowInputMapBindings.RightToLeft",
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Sat Sep 09 14:36:45 2017 +0200
@@ -621,15 +621,17 @@
 
         if (tabPane.getTabComponentAt(tabIndex) == null) {
             String title = tabPane.getTitleAt(tabIndex);
+            String clippedTitle = title;
             Font font = ss.getStyle().getFont(ss);
             FontMetrics metrics = SwingUtilities2.getFontMetrics(tabPane, g, font);
             Icon icon = getIconForTab(tabIndex);
 
             layoutLabel(ss, tabPlacement, metrics, tabIndex, title, icon,
                     tabRect, iconRect, textRect, isSelected);
-
+            clippedTitle = SwingUtilities2.clipStringIfNecessary(null, metrics,
+                           title, textRect.width);
             paintText(ss, g, tabPlacement, font, metrics,
-                    tabIndex, title, textRect, isSelected);
+                    tabIndex, clippedTitle, textRect, isSelected);
 
             paintIcon(g, tabPlacement, tabIndex, icon, iconRect, isSelected);
         }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Sat Sep 09 14:36:45 2017 +0200
@@ -55,7 +55,7 @@
 public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI {
     private Handler handler = new Handler();
     private SynthStyle style;
-
+    private boolean updateKBAction = true;
     /**
      * Creates a UI object for a JTextArea.
      *
@@ -73,7 +73,7 @@
     protected void installDefaults() {
         // Installs the text cursor on the component
         super.installDefaults();
-        updateStyle(getComponent());
+        updateStyle(getComponent(), true);
         getComponent().addFocusListener(handler);
     }
 
@@ -92,7 +92,7 @@
         super.uninstallDefaults();
     }
 
-    private void updateStyle(JTextComponent comp) {
+    private void updateStyle(JTextComponent comp, boolean updateKBAction) {
         SynthContext context = getContext(comp, ENABLED);
         SynthStyle oldStyle = style;
 
@@ -101,7 +101,7 @@
         if (style != oldStyle) {
             SynthTextFieldUI.updateStyle(comp, context, getPropertyPrefix());
 
-            if (oldStyle != null) {
+            if (oldStyle != null && updateKBAction) {
                 uninstallKeyboardActions();
                 installKeyboardActions();
             }
@@ -184,8 +184,16 @@
      */
     @Override
     protected void propertyChange(PropertyChangeEvent evt) {
+        if (evt.getPropertyName().equals("keymap")) {
+            if (evt.getNewValue() != null)
+            {
+                updateKBAction = false;
+            } else {
+                updateKBAction = true;
+            }
+        }
         if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
-            updateStyle((JTextComponent)evt.getSource());
+            updateStyle((JTextComponent)evt.getSource(), updateKBAction);
         }
         super.propertyChange(evt);
     }
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Sat Sep 09 14:36:45 2017 +0200
@@ -54,6 +54,7 @@
 public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI {
     private Handler handler = new Handler();
     private SynthStyle style;
+    private boolean updateKBAction = true;
 
     /**
      * Creates a UI for a JTextField.
@@ -65,7 +66,7 @@
         return new SynthTextFieldUI();
     }
 
-    private void updateStyle(JTextComponent comp) {
+    private void updateStyle(JTextComponent comp, boolean updateKBAction) {
         SynthContext context = getContext(comp, ENABLED);
         SynthStyle oldStyle = style;
 
@@ -74,7 +75,7 @@
         if (style != oldStyle) {
             SynthTextFieldUI.updateStyle(comp, context, getPropertyPrefix());
 
-            if (oldStyle != null) {
+            if (oldStyle != null && updateKBAction) {
                 uninstallKeyboardActions();
                 installKeyboardActions();
             }
@@ -232,8 +233,16 @@
      */
     @Override
     protected void propertyChange(PropertyChangeEvent evt) {
+        if (evt.getPropertyName().equals("keymap")) {
+            if (evt.getNewValue() != null)
+            {
+                updateKBAction = false;
+            } else {
+                updateKBAction = true;
+            }
+        }
         if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
-            updateStyle((JTextComponent)evt.getSource());
+            updateStyle((JTextComponent)evt.getSource(), updateKBAction);
         }
         super.propertyChange(evt);
     }
@@ -245,7 +254,7 @@
     protected void installDefaults() {
         // Installs the text cursor on the component
         super.installDefaults();
-        updateStyle(getComponent());
+        updateStyle(getComponent(), true);
         getComponent().addFocusListener(handler);
     }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/DefaultEditorKit.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1496,6 +1496,15 @@
                                     target.setCaretPosition(newIndex);
                                 }
                             }
+                        } else {
+                            // If the caret index is same as the visible offset
+                            // then correct newVis.y so that it won't cause
+                            // unnecessary scrolling upward/downward when
+                            // page-down/page-up is received after ctrl-END/ctrl-HOME
+                            if (direction == -1 && newVis.y <= initialY ||
+                                direction == 1 && newVis.y >= initialY) {
+                                newVis.y = initialY;
+                            }
                         }
                     } catch (BadLocationException ble) { }
                 } else {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/StyleSheet.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -2538,7 +2538,7 @@
                 if (pos.isHorizontalPositionRelativeToSize()) {
                     flags |= 4;
                 }
-                else if (pos.isHorizontalPositionRelativeToSize()) {
+                else if (pos.isHorizontalPositionRelativeToFontSize()) {
                     hPosition *= CSS.getFontSize(a, 12, ss);
                 }
                 if (pos.isVerticalPositionRelativeToSize()) {
--- a/jdk/src/java.desktop/share/classes/sun/awt/dnd/SunDropTargetEvent.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/awt/dnd/SunDropTargetEvent.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, 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
@@ -26,11 +26,10 @@
 package sun.awt.dnd;
 
 import java.awt.Component;
-import java.awt.dnd.InvalidDnDOperationException;
 import java.awt.event.MouseEvent;
 
 @SuppressWarnings("serial") // JDK-implementation class
-public class SunDropTargetEvent extends MouseEvent {
+public final class SunDropTargetEvent extends MouseEvent {
 
     public static final int MOUSE_DROPPED = MouseEvent.MOUSE_RELEASED;
 
@@ -48,7 +47,7 @@
         try {
             dispatcher.dispatchEvent(this);
         } finally {
-            dispatcher.unregisterEvent(this);
+            dispose();
         }
     }
 
@@ -56,10 +55,14 @@
         boolean was_consumed = isConsumed();
         super.consume();
         if (!was_consumed && isConsumed()) {
-            dispatcher.unregisterEvent(this);
+            dispose();
         }
     }
 
+    public void dispose() {
+        dispatcher.unregisterEvent(this);
+    }
+
     public SunDropTargetContextPeer.EventDispatcher getDispatcher() {
         return dispatcher;
     }
--- a/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java	Sat Sep 09 14:36:45 2017 +0200
@@ -42,9 +42,9 @@
  */
 @SuppressWarnings("serial") // JDK-implementation class
 public abstract class ShellFolder extends File {
-    private static final String COLUMN_NAME = "FileChooser.fileNameHeaderText";
-    private static final String COLUMN_SIZE = "FileChooser.fileSizeHeaderText";
-    private static final String COLUMN_DATE = "FileChooser.fileDateHeaderText";
+    public static final String COLUMN_NAME = "FileChooser.fileNameHeaderText";
+    public static final String COLUMN_SIZE = "FileChooser.fileSizeHeaderText";
+    public static final String COLUMN_DATE = "FileChooser.fileDateHeaderText";
 
     protected ShellFolder parent;
 
--- a/jdk/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/font/SunLayoutEngine.java	Sat Sep 09 14:36:45 2017 +0200
@@ -192,7 +192,8 @@
             if (font instanceof FileFont) {
                 pScaler = ((FileFont)font).getScaler().nativeScaler;
             }
-            shape(font, strike, ptSize, mat, pScaler, pNativeFont, isAAT(font),
+            shape(font, strike, ptSize, mat, pScaler, pNativeFont,
+                  layoutTables, isAAT(font),
                   tr.text, data, key.script(),
                   tr.start, tr.limit, baseIndex, pt,
                   typo_flags, gmask);
@@ -210,7 +211,7 @@
     /* Native method to invoke harfbuzz layout engine */
     private static native boolean
         shape(Font2D font, FontStrike strike, float ptSize, float[] mat,
-              long pscaler, long pNativeFont, boolean aat,
+              long pscaler, long pNativeFont, long layoutTables, boolean aat,
               char[] chars, GVData data,
               int script, int offset, int limit,
               int baseIndex, Point2D.Float pt, int typo_flags, int slot);
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ArrayCacheConst.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ArrayCacheConst.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -242,6 +242,8 @@
             int factor = 1;
             if (name.contains("Int") || name.contains("Float")) {
                 factor = 4;
+            } else if (name.contains("Double")) {
+                factor = 8;
             }
             return factor;
         }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ByteArrayCache.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/ByteArrayCache.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package sun.java2d.marlin;
 
 import static sun.java2d.marlin.ArrayCacheConst.ARRAY_SIZES;
@@ -37,13 +38,14 @@
 import sun.java2d.marlin.ArrayCacheConst.CacheStats;
 
 /*
- * Note that the [BYTE/INT/FLOAT]ArrayCache files are nearly identical except
+ * Note that the [BYTE/INT/FLOAT/DOUBLE]ArrayCache files are nearly identical except
  * for a few type and name differences. Typically, the [BYTE]ArrayCache.java file
- * is edited manually and then [INT]ArrayCache.java and [FLOAT]ArrayCache.java
+ * is edited manually and then [INT/FLOAT/DOUBLE]ArrayCache.java
  * files are generated with the following command lines:
  */
 // % sed -e 's/(b\yte)[ ]*//g' -e 's/b\yte/int/g' -e 's/B\yte/Int/g' < B\yteArrayCache.java > IntArrayCache.java
-// % sed -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
+// % sed -e 's/(b\yte)[ ]*0/0.0f/g' -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
+// % sed -e 's/(b\yte)[ ]*0/0.0d/g' -e 's/(b\yte)[ ]*/(double) /g' -e 's/b\yte/double/g' -e 's/B\yte/Double/g' < B\yteArrayCache.java > DoubleArrayCache.java
 
 final class ByteArrayCache implements MarlinConst {
 
@@ -231,8 +233,8 @@
         if (clean) {
             return new byte[length];
         }
-       // use JDK9 Unsafe.allocateUninitializedArray(class, length):
-       return (byte[]) OffHeapArray.UNSAFE.allocateUninitializedArray(byte.class, length);
+        // use JDK9 Unsafe.allocateUninitializedArray(class, length):
+        return (byte[]) OffHeapArray.UNSAFE.allocateUninitializedArray(byte.class, length);
     }
 
     static void fill(final byte[] array, final int fromIndex,
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/CollinearSimplifier.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/CollinearSimplifier.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -146,7 +146,7 @@
 
     private static float getSlope(float x1, float y1, float x2, float y2) {
         float dy = y2 - y1;
-        if (dy == 0f) {
+        if (dy == 0.0f) {
             return (x2 > x1) ? Float.POSITIVE_INFINITY
                    : Float.NEGATIVE_INFINITY;
         }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Curve.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Curve.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,8 +29,6 @@
 
     float ax, ay, bx, by, cx, cy, dx, dy;
     float dax, day, dbx, dby;
-    // shared iterator instance
-    private final BreakPtrIterator iterator = new BreakPtrIterator();
 
     Curve() {
     }
@@ -58,31 +56,31 @@
              float x3, float y3,
              float x4, float y4)
     {
-        ax = 3f * (x2 - x3) + x4 - x1;
-        ay = 3f * (y2 - y3) + y4 - y1;
-        bx = 3f * (x1 - 2f * x2 + x3);
-        by = 3f * (y1 - 2f * y2 + y3);
-        cx = 3f * (x2 - x1);
-        cy = 3f * (y2 - y1);
+        ax = 3.0f * (x2 - x3) + x4 - x1;
+        ay = 3.0f * (y2 - y3) + y4 - y1;
+        bx = 3.0f * (x1 - 2.0f * x2 + x3);
+        by = 3.0f * (y1 - 2.0f * y2 + y3);
+        cx = 3.0f * (x2 - x1);
+        cy = 3.0f * (y2 - y1);
         dx = x1;
         dy = y1;
-        dax = 3f * ax; day = 3f * ay;
-        dbx = 2f * bx; dby = 2f * by;
+        dax = 3.0f * ax; day = 3.0f * ay;
+        dbx = 2.0f * bx; dby = 2.0f * by;
     }
 
     void set(float x1, float y1,
              float x2, float y2,
              float x3, float y3)
     {
-        ax = 0f; ay = 0f;
-        bx = x1 - 2f * x2 + x3;
-        by = y1 - 2f * y2 + y3;
-        cx = 2f * (x2 - x1);
-        cy = 2f * (y2 - y1);
+        ax = 0.0f; ay = 0.0f;
+        bx = x1 - 2.0f * x2 + x3;
+        by = y1 - 2.0f * y2 + y3;
+        cx = 2.0f * (x2 - x1);
+        cy = 2.0f * (y2 - y1);
         dx = x1;
         dy = y1;
-        dax = 0f; day = 0f;
-        dbx = 2f * bx; dby = 2f * by;
+        dax = 0.0f; day = 0.0f;
+        dbx = 2.0f * bx; dby = 2.0f * by;
     }
 
     float xat(float t) {
@@ -113,7 +111,7 @@
         // Fortunately, this turns out to be quadratic, so there are at
         // most 2 inflection points.
         final float a = dax * dby - dbx * day;
-        final float b = 2f * (cy * dax - day * cx);
+        final float b = 2.0f * (cy * dax - day * cx);
         final float c = cy * dbx - cx * dby;
 
         return Helpers.quadraticRoots(a, b, c, pts, off);
@@ -128,11 +126,11 @@
         // these are the coefficients of some multiple of g(t) (not g(t),
         // because the roots of a polynomial are not changed after multiplication
         // by a constant, and this way we save a few multiplications).
-        final float a = 2f * (dax*dax + day*day);
-        final float b = 3f * (dax*dbx + day*dby);
-        final float c = 2f * (dax*cx + day*cy) + dbx*dbx + dby*dby;
+        final float a = 2.0f * (dax*dax + day*day);
+        final float b = 3.0f * (dax*dbx + day*dby);
+        final float c = 2.0f * (dax*cx + day*cy) + dbx*dbx + dby*dby;
         final float d = dbx*cx + dby*cy;
-        return Helpers.cubicRootsInAB(a, b, c, d, pts, off, 0f, 1f);
+        return Helpers.cubicRootsInAB(a, b, c, d, pts, off, 0.0f, 1.0f);
     }
 
     // Tries to find the roots of the function ROC(t)-w in [0, 1). It uses
@@ -153,14 +151,14 @@
         assert off <= 6 && roots.length >= 10;
         int ret = off;
         int numPerpdfddf = perpendiculardfddf(roots, off);
-        float t0 = 0, ft0 = ROCsq(t0) - w*w;
-        roots[off + numPerpdfddf] = 1f; // always check interval end points
+        float t0 = 0.0f, ft0 = ROCsq(t0) - w*w;
+        roots[off + numPerpdfddf] = 1.0f; // always check interval end points
         numPerpdfddf++;
         for (int i = off; i < off + numPerpdfddf; i++) {
             float t1 = roots[i], ft1 = ROCsq(t1) - w*w;
-            if (ft0 == 0f) {
+            if (ft0 == 0.0f) {
                 roots[ret++] = t0;
-            } else if (ft1 * ft0 < 0f) { // have opposite signs
+            } else if (ft1 * ft0 < 0.0f) { // have opposite signs
                 // (ROC(t)^2 == w^2) == (ROC(t) == w) is true because
                 // ROC(t) >= 0 for all t.
                 roots[ret++] = falsePositionROCsqMinusX(t0, t1, w*w, err);
@@ -220,7 +218,7 @@
 
     private static boolean sameSign(float x, float y) {
         // another way is to test if x*y > 0. This is bad for small x, y.
-        return (x < 0f && y < 0f) || (x > 0f && y > 0f);
+        return (x < 0.0f && y < 0.0f) || (x > 0.0f && y > 0.0f);
     }
 
     // returns the radius of curvature squared at t of this curve
@@ -229,76 +227,11 @@
         // dx=xat(t) and dy=yat(t). These calls have been inlined for efficiency
         final float dx = t * (t * dax + dbx) + cx;
         final float dy = t * (t * day + dby) + cy;
-        final float ddx = 2f * dax * t + dbx;
-        final float ddy = 2f * day * t + dby;
+        final float ddx = 2.0f * dax * t + dbx;
+        final float ddy = 2.0f * day * t + dby;
         final float dx2dy2 = dx*dx + dy*dy;
         final float ddx2ddy2 = ddx*ddx + ddy*ddy;
         final float ddxdxddydy = ddx*dx + ddy*dy;
         return dx2dy2*((dx2dy2*dx2dy2) / (dx2dy2 * ddx2ddy2 - ddxdxddydy*ddxdxddydy));
     }
-
-    // curve to be broken should be in pts
-    // this will change the contents of pts but not Ts
-    // TODO: There's no reason for Ts to be an array. All we need is a sequence
-    // of t values at which to subdivide. An array statisfies this condition,
-    // but is unnecessarily restrictive. Ts should be an Iterator<Float> instead.
-    // Doing this will also make dashing easier, since we could easily make
-    // LengthIterator an Iterator<Float> and feed it to this function to simplify
-    // the loop in Dasher.somethingTo.
-    BreakPtrIterator breakPtsAtTs(final float[] pts, final int type,
-                                  final float[] Ts, final int numTs)
-    {
-        assert pts.length >= 2*type && numTs <= Ts.length;
-
-        // initialize shared iterator:
-        iterator.init(pts, type, Ts, numTs);
-
-        return iterator;
-    }
-
-    static final class BreakPtrIterator {
-        private int nextCurveIdx;
-        private int curCurveOff;
-        private float prevT;
-        private float[] pts;
-        private int type;
-        private float[] ts;
-        private int numTs;
-
-        void init(final float[] pts, final int type,
-                  final float[] ts, final int numTs) {
-            this.pts = pts;
-            this.type = type;
-            this.ts = ts;
-            this.numTs = numTs;
-
-            nextCurveIdx = 0;
-            curCurveOff = 0;
-            prevT = 0f;
-        }
-
-        public boolean hasNext() {
-            return nextCurveIdx <= numTs;
-        }
-
-        public int next() {
-            int ret;
-            if (nextCurveIdx < numTs) {
-                float curT = ts[nextCurveIdx];
-                float splitT = (curT - prevT) / (1f - prevT);
-                Helpers.subdivideAt(splitT,
-                                    pts, curCurveOff,
-                                    pts, 0,
-                                    pts, type, type);
-                prevT = curT;
-                ret = 0;
-                curCurveOff = type;
-            } else {
-                ret = curCurveOff;
-            }
-            nextCurveIdx++;
-            return ret;
-        }
-    }
 }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DCollinearSimplifier.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,154 @@
+/*
+ * 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.  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.java2d.marlin;
+
+
+final class DCollinearSimplifier implements DPathConsumer2D {
+
+    enum SimplifierState {
+
+        Empty, PreviousPoint, PreviousLine
+    };
+    // slope precision threshold
+    static final double EPS = 1e-4d; // aaime proposed 1e-3d
+
+    DPathConsumer2D delegate;
+    SimplifierState state;
+    double px1, py1, px2, py2;
+    double pslope;
+
+    DCollinearSimplifier() {
+    }
+
+    public DCollinearSimplifier init(DPathConsumer2D delegate) {
+        this.delegate = delegate;
+        this.state = SimplifierState.Empty;
+
+        return this; // fluent API
+    }
+
+    @Override
+    public void pathDone() {
+        emitStashedLine();
+        state = SimplifierState.Empty;
+        delegate.pathDone();
+    }
+
+    @Override
+    public void closePath() {
+        emitStashedLine();
+        state = SimplifierState.Empty;
+        delegate.closePath();
+    }
+
+    @Override
+    public long getNativeConsumer() {
+        return 0;
+    }
+
+    @Override
+    public void quadTo(double x1, double y1, double x2, double y2) {
+        emitStashedLine();
+        delegate.quadTo(x1, y1, x2, y2);
+        // final end point:
+        state = SimplifierState.PreviousPoint;
+        px1 = x2;
+        py1 = y2;
+    }
+
+    @Override
+    public void curveTo(double x1, double y1, double x2, double y2,
+                        double x3, double y3) {
+        emitStashedLine();
+        delegate.curveTo(x1, y1, x2, y2, x3, y3);
+        // final end point:
+        state = SimplifierState.PreviousPoint;
+        px1 = x3;
+        py1 = y3;
+    }
+
+    @Override
+    public void moveTo(double x, double y) {
+        emitStashedLine();
+        delegate.moveTo(x, y);
+        state = SimplifierState.PreviousPoint;
+        px1 = x;
+        py1 = y;
+    }
+
+    @Override
+    public void lineTo(final double x, final double y) {
+        switch (state) {
+            case Empty:
+                delegate.lineTo(x, y);
+                state = SimplifierState.PreviousPoint;
+                px1 = x;
+                py1 = y;
+                return;
+
+            case PreviousPoint:
+                state = SimplifierState.PreviousLine;
+                px2 = x;
+                py2 = y;
+                pslope = getSlope(px1, py1, x, y);
+                return;
+
+            case PreviousLine:
+                final double slope = getSlope(px2, py2, x, y);
+                // test for collinearity
+                if ((slope == pslope) || (Math.abs(pslope - slope) < EPS)) {
+                    // merge segments
+                    px2 = x;
+                    py2 = y;
+                    return;
+                }
+                // emit previous segment
+                delegate.lineTo(px2, py2);
+                px1 = px2;
+                py1 = py2;
+                px2 = x;
+                py2 = y;
+                pslope = slope;
+                return;
+            default:
+        }
+    }
+
+    private void emitStashedLine() {
+        if (state == SimplifierState.PreviousLine) {
+            delegate.lineTo(px2, py2);
+        }
+    }
+
+    private static double getSlope(double x1, double y1, double x2, double y2) {
+        double dy = y2 - y1;
+        if (dy == 0.0d) {
+            return (x2 > x1) ? Double.POSITIVE_INFINITY
+                   : Double.NEGATIVE_INFINITY;
+        }
+        return (x2 - x1) / dy;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DCurve.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,237 @@
+/*
+ * 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.  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.java2d.marlin;
+
+final class DCurve {
+
+    double ax, ay, bx, by, cx, cy, dx, dy;
+    double dax, day, dbx, dby;
+
+    DCurve() {
+    }
+
+    void set(double[] points, int type) {
+        switch(type) {
+        case 8:
+            set(points[0], points[1],
+                points[2], points[3],
+                points[4], points[5],
+                points[6], points[7]);
+            return;
+        case 6:
+            set(points[0], points[1],
+                points[2], points[3],
+                points[4], points[5]);
+            return;
+        default:
+            throw new InternalError("Curves can only be cubic or quadratic");
+        }
+    }
+
+    void set(double x1, double y1,
+             double x2, double y2,
+             double x3, double y3,
+             double x4, double y4)
+    {
+        ax = 3.0d * (x2 - x3) + x4 - x1;
+        ay = 3.0d * (y2 - y3) + y4 - y1;
+        bx = 3.0d * (x1 - 2.0d * x2 + x3);
+        by = 3.0d * (y1 - 2.0d * y2 + y3);
+        cx = 3.0d * (x2 - x1);
+        cy = 3.0d * (y2 - y1);
+        dx = x1;
+        dy = y1;
+        dax = 3.0d * ax; day = 3.0d * ay;
+        dbx = 2.0d * bx; dby = 2.0d * by;
+    }
+
+    void set(double x1, double y1,
+             double x2, double y2,
+             double x3, double y3)
+    {
+        ax = 0.0d; ay = 0.0d;
+        bx = x1 - 2.0d * x2 + x3;
+        by = y1 - 2.0d * y2 + y3;
+        cx = 2.0d * (x2 - x1);
+        cy = 2.0d * (y2 - y1);
+        dx = x1;
+        dy = y1;
+        dax = 0.0d; day = 0.0d;
+        dbx = 2.0d * bx; dby = 2.0d * by;
+    }
+
+    double xat(double t) {
+        return t * (t * (t * ax + bx) + cx) + dx;
+    }
+    double yat(double t) {
+        return t * (t * (t * ay + by) + cy) + dy;
+    }
+
+    double dxat(double t) {
+        return t * (t * dax + dbx) + cx;
+    }
+
+    double dyat(double t) {
+        return t * (t * day + dby) + cy;
+    }
+
+    int dxRoots(double[] roots, int off) {
+        return DHelpers.quadraticRoots(dax, dbx, cx, roots, off);
+    }
+
+    int dyRoots(double[] roots, int off) {
+        return DHelpers.quadraticRoots(day, dby, cy, roots, off);
+    }
+
+    int infPoints(double[] pts, int off) {
+        // inflection point at t if -f'(t)x*f''(t)y + f'(t)y*f''(t)x == 0
+        // Fortunately, this turns out to be quadratic, so there are at
+        // most 2 inflection points.
+        final double a = dax * dby - dbx * day;
+        final double b = 2.0d * (cy * dax - day * cx);
+        final double c = cy * dbx - cx * dby;
+
+        return DHelpers.quadraticRoots(a, b, c, pts, off);
+    }
+
+    // finds points where the first and second derivative are
+    // perpendicular. This happens when g(t) = f'(t)*f''(t) == 0 (where
+    // * is a dot product). Unfortunately, we have to solve a cubic.
+    private int perpendiculardfddf(double[] pts, int off) {
+        assert pts.length >= off + 4;
+
+        // these are the coefficients of some multiple of g(t) (not g(t),
+        // because the roots of a polynomial are not changed after multiplication
+        // by a constant, and this way we save a few multiplications).
+        final double a = 2.0d * (dax*dax + day*day);
+        final double b = 3.0d * (dax*dbx + day*dby);
+        final double c = 2.0d * (dax*cx + day*cy) + dbx*dbx + dby*dby;
+        final double d = dbx*cx + dby*cy;
+        return DHelpers.cubicRootsInAB(a, b, c, d, pts, off, 0.0d, 1.0d);
+    }
+
+    // Tries to find the roots of the function ROC(t)-w in [0, 1). It uses
+    // a variant of the false position algorithm to find the roots. False
+    // position requires that 2 initial values x0,x1 be given, and that the
+    // function must have opposite signs at those values. To find such
+    // values, we need the local extrema of the ROC function, for which we
+    // need the roots of its derivative; however, it's harder to find the
+    // roots of the derivative in this case than it is to find the roots
+    // of the original function. So, we find all points where this curve's
+    // first and second derivative are perpendicular, and we pretend these
+    // are our local extrema. There are at most 3 of these, so we will check
+    // at most 4 sub-intervals of (0,1). ROC has asymptotes at inflection
+    // points, so roc-w can have at least 6 roots. This shouldn't be a
+    // problem for what we're trying to do (draw a nice looking curve).
+    int rootsOfROCMinusW(double[] roots, int off, final double w, final double err) {
+        // no OOB exception, because by now off<=6, and roots.length >= 10
+        assert off <= 6 && roots.length >= 10;
+        int ret = off;
+        int numPerpdfddf = perpendiculardfddf(roots, off);
+        double t0 = 0.0d, ft0 = ROCsq(t0) - w*w;
+        roots[off + numPerpdfddf] = 1.0d; // always check interval end points
+        numPerpdfddf++;
+        for (int i = off; i < off + numPerpdfddf; i++) {
+            double t1 = roots[i], ft1 = ROCsq(t1) - w*w;
+            if (ft0 == 0.0d) {
+                roots[ret++] = t0;
+            } else if (ft1 * ft0 < 0.0d) { // have opposite signs
+                // (ROC(t)^2 == w^2) == (ROC(t) == w) is true because
+                // ROC(t) >= 0 for all t.
+                roots[ret++] = falsePositionROCsqMinusX(t0, t1, w*w, err);
+            }
+            t0 = t1;
+            ft0 = ft1;
+        }
+
+        return ret - off;
+    }
+
+    private static double eliminateInf(double x) {
+        return (x == Double.POSITIVE_INFINITY ? Double.MAX_VALUE :
+            (x == Double.NEGATIVE_INFINITY ? Double.MIN_VALUE : x));
+    }
+
+    // A slight modification of the false position algorithm on wikipedia.
+    // This only works for the ROCsq-x functions. It might be nice to have
+    // the function as an argument, but that would be awkward in java6.
+    // TODO: It is something to consider for java8 (or whenever lambda
+    // expressions make it into the language), depending on how closures
+    // and turn out. Same goes for the newton's method
+    // algorithm in DHelpers.java
+    private double falsePositionROCsqMinusX(double x0, double x1,
+                                           final double x, final double err)
+    {
+        final int iterLimit = 100;
+        int side = 0;
+        double t = x1, ft = eliminateInf(ROCsq(t) - x);
+        double s = x0, fs = eliminateInf(ROCsq(s) - x);
+        double r = s, fr;
+        for (int i = 0; i < iterLimit && Math.abs(t - s) > err * Math.abs(t + s); i++) {
+            r = (fs * t - ft * s) / (fs - ft);
+            fr = ROCsq(r) - x;
+            if (sameSign(fr, ft)) {
+                ft = fr; t = r;
+                if (side < 0) {
+                    fs /= (1 << (-side));
+                    side--;
+                } else {
+                    side = -1;
+                }
+            } else if (fr * fs > 0) {
+                fs = fr; s = r;
+                if (side > 0) {
+                    ft /= (1 << side);
+                    side++;
+                } else {
+                    side = 1;
+                }
+            } else {
+                break;
+            }
+        }
+        return r;
+    }
+
+    private static boolean sameSign(double x, double y) {
+        // another way is to test if x*y > 0. This is bad for small x, y.
+        return (x < 0.0d && y < 0.0d) || (x > 0.0d && y > 0.0d);
+    }
+
+    // returns the radius of curvature squared at t of this curve
+    // see http://en.wikipedia.org/wiki/Radius_of_curvature_(applications)
+    private double ROCsq(final double t) {
+        // dx=xat(t) and dy=yat(t). These calls have been inlined for efficiency
+        final double dx = t * (t * dax + dbx) + cx;
+        final double dy = t * (t * day + dby) + cy;
+        final double ddx = 2.0d * dax * t + dbx;
+        final double ddy = 2.0d * day * t + dby;
+        final double dx2dy2 = dx*dx + dy*dy;
+        final double ddx2ddy2 = ddx*ddx + ddy*ddy;
+        final double ddxdxddydy = ddx*dx + ddy*dy;
+        return dx2dy2*((dx2dy2*dx2dy2) / (dx2dy2 * ddx2ddy2 - ddxdxddydy*ddxdxddydy));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DDasher.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,746 @@
+/*
+ * 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.  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.java2d.marlin;
+
+import java.util.Arrays;
+
+/**
+ * The <code>DDasher</code> class takes a series of linear commands
+ * (<code>moveTo</code>, <code>lineTo</code>, <code>close</code> and
+ * <code>end</code>) and breaks them into smaller segments according to a
+ * dash pattern array and a starting dash phase.
+ *
+ * <p> Issues: in J2Se, a zero length dash segment as drawn as a very
+ * short dash, whereas Pisces does not draw anything.  The PostScript
+ * semantics are unclear.
+ *
+ */
+final class DDasher implements DPathConsumer2D, MarlinConst {
+
+    static final int REC_LIMIT = 4;
+    static final double ERR = 0.01d;
+    static final double MIN_T_INC = 1.0d / (1 << REC_LIMIT);
+
+    // More than 24 bits of mantissa means we can no longer accurately
+    // measure the number of times cycled through the dash array so we
+    // punt and override the phase to just be 0 past that point.
+    static final double MAX_CYCLES = 16000000.0d;
+
+    private DPathConsumer2D out;
+    private double[] dash;
+    private int dashLen;
+    private double startPhase;
+    private boolean startDashOn;
+    private int startIdx;
+
+    private boolean starting;
+    private boolean needsMoveTo;
+
+    private int idx;
+    private boolean dashOn;
+    private double phase;
+
+    private double sx, sy;
+    private double x0, y0;
+
+    // temporary storage for the current curve
+    private final double[] curCurvepts;
+
+    // per-thread renderer context
+    final DRendererContext rdrCtx;
+
+    // flag to recycle dash array copy
+    boolean recycleDashes;
+
+    // dashes ref (dirty)
+    final DoubleArrayCache.Reference dashes_ref;
+    // firstSegmentsBuffer ref (dirty)
+    final DoubleArrayCache.Reference firstSegmentsBuffer_ref;
+
+    /**
+     * Constructs a <code>DDasher</code>.
+     * @param rdrCtx per-thread renderer context
+     */
+    DDasher(final DRendererContext rdrCtx) {
+        this.rdrCtx = rdrCtx;
+
+        dashes_ref = rdrCtx.newDirtyDoubleArrayRef(INITIAL_ARRAY); // 1K
+
+        firstSegmentsBuffer_ref = rdrCtx.newDirtyDoubleArrayRef(INITIAL_ARRAY); // 1K
+        firstSegmentsBuffer     = firstSegmentsBuffer_ref.initial;
+
+        // we need curCurvepts to be able to contain 2 curves because when
+        // dashing curves, we need to subdivide it
+        curCurvepts = new double[8 * 2];
+    }
+
+    /**
+     * Initialize the <code>DDasher</code>.
+     *
+     * @param out an output <code>DPathConsumer2D</code>.
+     * @param dash an array of <code>double</code>s containing the dash pattern
+     * @param dashLen length of the given dash array
+     * @param phase a <code>double</code> containing the dash phase
+     * @param recycleDashes true to indicate to recycle the given dash array
+     * @return this instance
+     */
+    DDasher init(final DPathConsumer2D out, double[] dash, int dashLen,
+                double phase, boolean recycleDashes)
+    {
+        this.out = out;
+
+        // Normalize so 0 <= phase < dash[0]
+        int sidx = 0;
+        dashOn = true;
+        double sum = 0.0d;
+        for (double d : dash) {
+            sum += d;
+        }
+        double cycles = phase / sum;
+        if (phase < 0.0d) {
+            if (-cycles >= MAX_CYCLES) {
+                phase = 0.0d;
+            } else {
+                int fullcycles = FloatMath.floor_int(-cycles);
+                if ((fullcycles & dash.length & 1) != 0) {
+                    dashOn = !dashOn;
+                }
+                phase += fullcycles * sum;
+                while (phase < 0.0d) {
+                    if (--sidx < 0) {
+                        sidx = dash.length - 1;
+                    }
+                    phase += dash[sidx];
+                    dashOn = !dashOn;
+                }
+            }
+        } else if (phase > 0) {
+            if (cycles >= MAX_CYCLES) {
+                phase = 0.0d;
+            } else {
+                int fullcycles = FloatMath.floor_int(cycles);
+                if ((fullcycles & dash.length & 1) != 0) {
+                    dashOn = !dashOn;
+                }
+                phase -= fullcycles * sum;
+                double d;
+                while (phase >= (d = dash[sidx])) {
+                    phase -= d;
+                    sidx = (sidx + 1) % dash.length;
+                    dashOn = !dashOn;
+                }
+            }
+        }
+
+        this.dash = dash;
+        this.dashLen = dashLen;
+        this.startPhase = this.phase = phase;
+        this.startDashOn = dashOn;
+        this.startIdx = sidx;
+        this.starting = true;
+        needsMoveTo = false;
+        firstSegidx = 0;
+
+        this.recycleDashes = recycleDashes;
+
+        return this; // fluent API
+    }
+
+    /**
+     * Disposes this dasher:
+     * clean up before reusing this instance
+     */
+    void dispose() {
+        if (DO_CLEAN_DIRTY) {
+            // Force zero-fill dirty arrays:
+            Arrays.fill(curCurvepts, 0.0d);
+        }
+        // Return arrays:
+        if (recycleDashes) {
+            dash = dashes_ref.putArray(dash);
+        }
+        firstSegmentsBuffer = firstSegmentsBuffer_ref.putArray(firstSegmentsBuffer);
+    }
+
+    double[] copyDashArray(final float[] dashes) {
+        final int len = dashes.length;
+        final double[] newDashes;
+        if (len <= MarlinConst.INITIAL_ARRAY) {
+            newDashes = dashes_ref.initial;
+        } else {
+            if (DO_STATS) {
+                rdrCtx.stats.stat_array_dasher_dasher.add(len);
+            }
+            newDashes = dashes_ref.getArray(len);
+        }
+        for (int i = 0; i < len; i++) { newDashes[i] = dashes[i]; }
+        return newDashes;
+    }
+
+    @Override
+    public void moveTo(double x0, double y0) {
+        if (firstSegidx > 0) {
+            out.moveTo(sx, sy);
+            emitFirstSegments();
+        }
+        needsMoveTo = true;
+        this.idx = startIdx;
+        this.dashOn = this.startDashOn;
+        this.phase = this.startPhase;
+        this.sx = this.x0 = x0;
+        this.sy = this.y0 = y0;
+        this.starting = true;
+    }
+
+    private void emitSeg(double[] buf, int off, int type) {
+        switch (type) {
+        case 8:
+            out.curveTo(buf[off+0], buf[off+1],
+                        buf[off+2], buf[off+3],
+                        buf[off+4], buf[off+5]);
+            return;
+        case 6:
+            out.quadTo(buf[off+0], buf[off+1],
+                       buf[off+2], buf[off+3]);
+            return;
+        case 4:
+            out.lineTo(buf[off], buf[off+1]);
+            return;
+        default:
+        }
+    }
+
+    private void emitFirstSegments() {
+        final double[] fSegBuf = firstSegmentsBuffer;
+
+        for (int i = 0; i < firstSegidx; ) {
+            int type = (int)fSegBuf[i];
+            emitSeg(fSegBuf, i + 1, type);
+            i += (type - 1);
+        }
+        firstSegidx = 0;
+    }
+    // We don't emit the first dash right away. If we did, caps would be
+    // drawn on it, but we need joins to be drawn if there's a closePath()
+    // So, we store the path elements that make up the first dash in the
+    // buffer below.
+    private double[] firstSegmentsBuffer; // dynamic array
+    private int firstSegidx;
+
+    // precondition: pts must be in relative coordinates (relative to x0,y0)
+    private void goTo(double[] pts, int off, final int type) {
+        double x = pts[off + type - 4];
+        double y = pts[off + type - 3];
+        if (dashOn) {
+            if (starting) {
+                int len = type - 1; // - 2 + 1
+                int segIdx = firstSegidx;
+                double[] buf = firstSegmentsBuffer;
+                if (segIdx + len  > buf.length) {
+                    if (DO_STATS) {
+                        rdrCtx.stats.stat_array_dasher_firstSegmentsBuffer
+                            .add(segIdx + len);
+                    }
+                    firstSegmentsBuffer = buf
+                        = firstSegmentsBuffer_ref.widenArray(buf, segIdx,
+                                                             segIdx + len);
+                }
+                buf[segIdx++] = type;
+                len--;
+                // small arraycopy (2, 4 or 6) but with offset:
+                System.arraycopy(pts, off, buf, segIdx, len);
+                segIdx += len;
+                firstSegidx = segIdx;
+            } else {
+                if (needsMoveTo) {
+                    out.moveTo(x0, y0);
+                    needsMoveTo = false;
+                }
+                emitSeg(pts, off, type);
+            }
+        } else {
+            starting = false;
+            needsMoveTo = true;
+        }
+        this.x0 = x;
+        this.y0 = y;
+    }
+
+    @Override
+    public void lineTo(double x1, double y1) {
+        double dx = x1 - x0;
+        double dy = y1 - y0;
+
+        double len = dx*dx + dy*dy;
+        if (len == 0.0d) {
+            return;
+        }
+        len = Math.sqrt(len);
+
+        // The scaling factors needed to get the dx and dy of the
+        // transformed dash segments.
+        final double cx = dx / len;
+        final double cy = dy / len;
+
+        final double[] _curCurvepts = curCurvepts;
+        final double[] _dash = dash;
+
+        double leftInThisDashSegment;
+        double dashdx, dashdy, p;
+
+        while (true) {
+            leftInThisDashSegment = _dash[idx] - phase;
+
+            if (len <= leftInThisDashSegment) {
+                _curCurvepts[0] = x1;
+                _curCurvepts[1] = y1;
+                goTo(_curCurvepts, 0, 4);
+
+                // Advance phase within current dash segment
+                phase += len;
+                // TODO: compare double values using epsilon:
+                if (len == leftInThisDashSegment) {
+                    phase = 0.0d;
+                    idx = (idx + 1) % dashLen;
+                    dashOn = !dashOn;
+                }
+                return;
+            }
+
+            dashdx = _dash[idx] * cx;
+            dashdy = _dash[idx] * cy;
+
+            if (phase == 0.0d) {
+                _curCurvepts[0] = x0 + dashdx;
+                _curCurvepts[1] = y0 + dashdy;
+            } else {
+                p = leftInThisDashSegment / _dash[idx];
+                _curCurvepts[0] = x0 + p * dashdx;
+                _curCurvepts[1] = y0 + p * dashdy;
+            }
+
+            goTo(_curCurvepts, 0, 4);
+
+            len -= leftInThisDashSegment;
+            // Advance to next dash segment
+            idx = (idx + 1) % dashLen;
+            dashOn = !dashOn;
+            phase = 0.0d;
+        }
+    }
+
+    // shared instance in DDasher
+    private final LengthIterator li = new LengthIterator();
+
+    // preconditions: curCurvepts must be an array of length at least 2 * type,
+    // that contains the curve we want to dash in the first type elements
+    private void somethingTo(int type) {
+        if (pointCurve(curCurvepts, type)) {
+            return;
+        }
+        li.initializeIterationOnCurve(curCurvepts, type);
+
+        // initially the current curve is at curCurvepts[0...type]
+        int curCurveoff = 0;
+        double lastSplitT = 0.0d;
+        double t;
+        double leftInThisDashSegment = dash[idx] - phase;
+
+        while ((t = li.next(leftInThisDashSegment)) < 1.0d) {
+            if (t != 0.0d) {
+                DHelpers.subdivideAt((t - lastSplitT) / (1.0d - lastSplitT),
+                                    curCurvepts, curCurveoff,
+                                    curCurvepts, 0,
+                                    curCurvepts, type, type);
+                lastSplitT = t;
+                goTo(curCurvepts, 2, type);
+                curCurveoff = type;
+            }
+            // Advance to next dash segment
+            idx = (idx + 1) % dashLen;
+            dashOn = !dashOn;
+            phase = 0.0d;
+            leftInThisDashSegment = dash[idx];
+        }
+        goTo(curCurvepts, curCurveoff+2, type);
+        phase += li.lastSegLen();
+        if (phase >= dash[idx]) {
+            phase = 0.0d;
+            idx = (idx + 1) % dashLen;
+            dashOn = !dashOn;
+        }
+        // reset LengthIterator:
+        li.reset();
+    }
+
+    private static boolean pointCurve(double[] curve, int type) {
+        for (int i = 2; i < type; i++) {
+            if (curve[i] != curve[i-2]) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    // Objects of this class are used to iterate through curves. They return
+    // t values where the left side of the curve has a specified length.
+    // It does this by subdividing the input curve until a certain error
+    // condition has been met. A recursive subdivision procedure would
+    // return as many as 1<<limit curves, but this is an iterator and we
+    // don't need all the curves all at once, so what we carry out a
+    // lazy inorder traversal of the recursion tree (meaning we only move
+    // through the tree when we need the next subdivided curve). This saves
+    // us a lot of memory because at any one time we only need to store
+    // limit+1 curves - one for each level of the tree + 1.
+    // NOTE: the way we do things here is not enough to traverse a general
+    // tree; however, the trees we are interested in have the property that
+    // every non leaf node has exactly 2 children
+    static final class LengthIterator {
+        private enum Side {LEFT, RIGHT};
+        // Holds the curves at various levels of the recursion. The root
+        // (i.e. the original curve) is at recCurveStack[0] (but then it
+        // gets subdivided, the left half is put at 1, so most of the time
+        // only the right half of the original curve is at 0)
+        private final double[][] recCurveStack; // dirty
+        // sides[i] indicates whether the node at level i+1 in the path from
+        // the root to the current leaf is a left or right child of its parent.
+        private final Side[] sides; // dirty
+        private int curveType;
+        // lastT and nextT delimit the current leaf.
+        private double nextT;
+        private double lenAtNextT;
+        private double lastT;
+        private double lenAtLastT;
+        private double lenAtLastSplit;
+        private double lastSegLen;
+        // the current level in the recursion tree. 0 is the root. limit
+        // is the deepest possible leaf.
+        private int recLevel;
+        private boolean done;
+
+        // the lengths of the lines of the control polygon. Only its first
+        // curveType/2 - 1 elements are valid. This is an optimization. See
+        // next() for more detail.
+        private final double[] curLeafCtrlPolyLengths = new double[3];
+
+        LengthIterator() {
+            this.recCurveStack = new double[REC_LIMIT + 1][8];
+            this.sides = new Side[REC_LIMIT];
+            // if any methods are called without first initializing this object
+            // on a curve, we want it to fail ASAP.
+            this.nextT = Double.MAX_VALUE;
+            this.lenAtNextT = Double.MAX_VALUE;
+            this.lenAtLastSplit = Double.MIN_VALUE;
+            this.recLevel = Integer.MIN_VALUE;
+            this.lastSegLen = Double.MAX_VALUE;
+            this.done = true;
+        }
+
+        /**
+         * Reset this LengthIterator.
+         */
+        void reset() {
+            // keep data dirty
+            // as it appears not useful to reset data:
+            if (DO_CLEAN_DIRTY) {
+                final int recLimit = recCurveStack.length - 1;
+                for (int i = recLimit; i >= 0; i--) {
+                    Arrays.fill(recCurveStack[i], 0.0d);
+                }
+                Arrays.fill(sides, Side.LEFT);
+                Arrays.fill(curLeafCtrlPolyLengths, 0.0d);
+                Arrays.fill(nextRoots, 0.0d);
+                Arrays.fill(flatLeafCoefCache, 0.0d);
+                flatLeafCoefCache[2] = -1.0d;
+            }
+        }
+
+        void initializeIterationOnCurve(double[] pts, int type) {
+            // optimize arraycopy (8 values faster than 6 = type):
+            System.arraycopy(pts, 0, recCurveStack[0], 0, 8);
+            this.curveType = type;
+            this.recLevel = 0;
+            this.lastT = 0.0d;
+            this.lenAtLastT = 0.0d;
+            this.nextT = 0.0d;
+            this.lenAtNextT = 0.0d;
+            goLeft(); // initializes nextT and lenAtNextT properly
+            this.lenAtLastSplit = 0.0d;
+            if (recLevel > 0) {
+                this.sides[0] = Side.LEFT;
+                this.done = false;
+            } else {
+                // the root of the tree is a leaf so we're done.
+                this.sides[0] = Side.RIGHT;
+                this.done = true;
+            }
+            this.lastSegLen = 0.0d;
+        }
+
+        // 0 == false, 1 == true, -1 == invalid cached value.
+        private int cachedHaveLowAcceleration = -1;
+
+        private boolean haveLowAcceleration(double err) {
+            if (cachedHaveLowAcceleration == -1) {
+                final double len1 = curLeafCtrlPolyLengths[0];
+                final double len2 = curLeafCtrlPolyLengths[1];
+                // the test below is equivalent to !within(len1/len2, 1, err).
+                // It is using a multiplication instead of a division, so it
+                // should be a bit faster.
+                if (!DHelpers.within(len1, len2, err * len2)) {
+                    cachedHaveLowAcceleration = 0;
+                    return false;
+                }
+                if (curveType == 8) {
+                    final double len3 = curLeafCtrlPolyLengths[2];
+                    // if len1 is close to 2 and 2 is close to 3, that probably
+                    // means 1 is close to 3 so the second part of this test might
+                    // not be needed, but it doesn't hurt to include it.
+                    final double errLen3 = err * len3;
+                    if (!(DHelpers.within(len2, len3, errLen3) &&
+                          DHelpers.within(len1, len3, errLen3))) {
+                        cachedHaveLowAcceleration = 0;
+                        return false;
+                    }
+                }
+                cachedHaveLowAcceleration = 1;
+                return true;
+            }
+
+            return (cachedHaveLowAcceleration == 1);
+        }
+
+        // we want to avoid allocations/gc so we keep this array so we
+        // can put roots in it,
+        private final double[] nextRoots = new double[4];
+
+        // caches the coefficients of the current leaf in its flattened
+        // form (see inside next() for what that means). The cache is
+        // invalid when it's third element is negative, since in any
+        // valid flattened curve, this would be >= 0.
+        private final double[] flatLeafCoefCache = new double[]{0.0d, 0.0d, -1.0d, 0.0d};
+
+        // returns the t value where the remaining curve should be split in
+        // order for the left subdivided curve to have length len. If len
+        // is >= than the length of the uniterated curve, it returns 1.
+        double next(final double len) {
+            final double targetLength = lenAtLastSplit + len;
+            while (lenAtNextT < targetLength) {
+                if (done) {
+                    lastSegLen = lenAtNextT - lenAtLastSplit;
+                    return 1.0d;
+                }
+                goToNextLeaf();
+            }
+            lenAtLastSplit = targetLength;
+            final double leaflen = lenAtNextT - lenAtLastT;
+            double t = (targetLength - lenAtLastT) / leaflen;
+
+            // cubicRootsInAB is a fairly expensive call, so we just don't do it
+            // if the acceleration in this section of the curve is small enough.
+            if (!haveLowAcceleration(0.05d)) {
+                // We flatten the current leaf along the x axis, so that we're
+                // left with a, b, c which define a 1D Bezier curve. We then
+                // solve this to get the parameter of the original leaf that
+                // gives us the desired length.
+                final double[] _flatLeafCoefCache = flatLeafCoefCache;
+
+                if (_flatLeafCoefCache[2] < 0.0d) {
+                    double x =     curLeafCtrlPolyLengths[0],
+                          y = x + curLeafCtrlPolyLengths[1];
+                    if (curveType == 8) {
+                        double z = y + curLeafCtrlPolyLengths[2];
+                        _flatLeafCoefCache[0] = 3.0d * (x - y) + z;
+                        _flatLeafCoefCache[1] = 3.0d * (y - 2.0d * x);
+                        _flatLeafCoefCache[2] = 3.0d * x;
+                        _flatLeafCoefCache[3] = -z;
+                    } else if (curveType == 6) {
+                        _flatLeafCoefCache[0] = 0.0d;
+                        _flatLeafCoefCache[1] = y - 2.0d * x;
+                        _flatLeafCoefCache[2] = 2.0d * x;
+                        _flatLeafCoefCache[3] = -y;
+                    }
+                }
+                double a = _flatLeafCoefCache[0];
+                double b = _flatLeafCoefCache[1];
+                double c = _flatLeafCoefCache[2];
+                double d = t * _flatLeafCoefCache[3];
+
+                // we use cubicRootsInAB here, because we want only roots in 0, 1,
+                // and our quadratic root finder doesn't filter, so it's just a
+                // matter of convenience.
+                int n = DHelpers.cubicRootsInAB(a, b, c, d, nextRoots, 0, 0.0d, 1.0d);
+                if (n == 1 && !Double.isNaN(nextRoots[0])) {
+                    t = nextRoots[0];
+                }
+            }
+            // t is relative to the current leaf, so we must make it a valid parameter
+            // of the original curve.
+            t = t * (nextT - lastT) + lastT;
+            if (t >= 1.0d) {
+                t = 1.0d;
+                done = true;
+            }
+            // even if done = true, if we're here, that means targetLength
+            // is equal to, or very, very close to the total length of the
+            // curve, so lastSegLen won't be too high. In cases where len
+            // overshoots the curve, this method will exit in the while
+            // loop, and lastSegLen will still be set to the right value.
+            lastSegLen = len;
+            return t;
+        }
+
+        double lastSegLen() {
+            return lastSegLen;
+        }
+
+        // go to the next leaf (in an inorder traversal) in the recursion tree
+        // preconditions: must be on a leaf, and that leaf must not be the root.
+        private void goToNextLeaf() {
+            // We must go to the first ancestor node that has an unvisited
+            // right child.
+            int _recLevel = recLevel;
+            final Side[] _sides = sides;
+
+            _recLevel--;
+            while(_sides[_recLevel] == Side.RIGHT) {
+                if (_recLevel == 0) {
+                    recLevel = 0;
+                    done = true;
+                    return;
+                }
+                _recLevel--;
+            }
+
+            _sides[_recLevel] = Side.RIGHT;
+            // optimize arraycopy (8 values faster than 6 = type):
+            System.arraycopy(recCurveStack[_recLevel], 0,
+                             recCurveStack[_recLevel+1], 0, 8);
+            _recLevel++;
+
+            recLevel = _recLevel;
+            goLeft();
+        }
+
+        // go to the leftmost node from the current node. Return its length.
+        private void goLeft() {
+            double len = onLeaf();
+            if (len >= 0.0d) {
+                lastT = nextT;
+                lenAtLastT = lenAtNextT;
+                nextT += (1 << (REC_LIMIT - recLevel)) * MIN_T_INC;
+                lenAtNextT += len;
+                // invalidate caches
+                flatLeafCoefCache[2] = -1.0d;
+                cachedHaveLowAcceleration = -1;
+            } else {
+                DHelpers.subdivide(recCurveStack[recLevel], 0,
+                                  recCurveStack[recLevel+1], 0,
+                                  recCurveStack[recLevel], 0, curveType);
+                sides[recLevel] = Side.LEFT;
+                recLevel++;
+                goLeft();
+            }
+        }
+
+        // this is a bit of a hack. It returns -1 if we're not on a leaf, and
+        // the length of the leaf if we are on a leaf.
+        private double onLeaf() {
+            double[] curve = recCurveStack[recLevel];
+            double polyLen = 0.0d;
+
+            double x0 = curve[0], y0 = curve[1];
+            for (int i = 2; i < curveType; i += 2) {
+                final double x1 = curve[i], y1 = curve[i+1];
+                final double len = DHelpers.linelen(x0, y0, x1, y1);
+                polyLen += len;
+                curLeafCtrlPolyLengths[i/2 - 1] = len;
+                x0 = x1;
+                y0 = y1;
+            }
+
+            final double lineLen = DHelpers.linelen(curve[0], curve[1],
+                                                  curve[curveType-2],
+                                                  curve[curveType-1]);
+            if ((polyLen - lineLen) < ERR || recLevel == REC_LIMIT) {
+                return (polyLen + lineLen) / 2.0d;
+            }
+            return -1.0d;
+        }
+    }
+
+    @Override
+    public void curveTo(double x1, double y1,
+                        double x2, double y2,
+                        double x3, double y3)
+    {
+        final double[] _curCurvepts = curCurvepts;
+        _curCurvepts[0] = x0;        _curCurvepts[1] = y0;
+        _curCurvepts[2] = x1;        _curCurvepts[3] = y1;
+        _curCurvepts[4] = x2;        _curCurvepts[5] = y2;
+        _curCurvepts[6] = x3;        _curCurvepts[7] = y3;
+        somethingTo(8);
+    }
+
+    @Override
+    public void quadTo(double x1, double y1, double x2, double y2) {
+        final double[] _curCurvepts = curCurvepts;
+        _curCurvepts[0] = x0;        _curCurvepts[1] = y0;
+        _curCurvepts[2] = x1;        _curCurvepts[3] = y1;
+        _curCurvepts[4] = x2;        _curCurvepts[5] = y2;
+        somethingTo(6);
+    }
+
+    @Override
+    public void closePath() {
+        lineTo(sx, sy);
+        if (firstSegidx > 0) {
+            if (!dashOn || needsMoveTo) {
+                out.moveTo(sx, sy);
+            }
+            emitFirstSegments();
+        }
+        moveTo(sx, sy);
+    }
+
+    @Override
+    public void pathDone() {
+        if (firstSegidx > 0) {
+            out.moveTo(sx, sy);
+            emitFirstSegments();
+        }
+        out.pathDone();
+
+        // Dispose this instance:
+        dispose();
+    }
+
+    @Override
+    public long getNativeConsumer() {
+        throw new InternalError("DDasher does not use a native consumer");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DHelpers.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,436 @@
+/*
+ * 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.  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.java2d.marlin;
+
+import static java.lang.Math.PI;
+import static java.lang.Math.cos;
+import static java.lang.Math.sqrt;
+import static java.lang.Math.cbrt;
+import static java.lang.Math.acos;
+
+final class DHelpers implements MarlinConst {
+
+    private DHelpers() {
+        throw new Error("This is a non instantiable class");
+    }
+
+    static boolean within(final double x, final double y, final double err) {
+        final double d = y - x;
+        return (d <= err && d >= -err);
+    }
+
+    static int quadraticRoots(final double a, final double b,
+                              final double c, double[] zeroes, final int off)
+    {
+        int ret = off;
+        double t;
+        if (a != 0.0d) {
+            final double dis = b*b - 4*a*c;
+            if (dis > 0.0d) {
+                final double sqrtDis = Math.sqrt(dis);
+                // depending on the sign of b we use a slightly different
+                // algorithm than the traditional one to find one of the roots
+                // so we can avoid adding numbers of different signs (which
+                // might result in loss of precision).
+                if (b >= 0.0d) {
+                    zeroes[ret++] = (2.0d * c) / (-b - sqrtDis);
+                    zeroes[ret++] = (-b - sqrtDis) / (2.0d * a);
+                } else {
+                    zeroes[ret++] = (-b + sqrtDis) / (2.0d * a);
+                    zeroes[ret++] = (2.0d * c) / (-b + sqrtDis);
+                }
+            } else if (dis == 0.0d) {
+                t = (-b) / (2.0d * a);
+                zeroes[ret++] = t;
+            }
+        } else {
+            if (b != 0.0d) {
+                t = (-c) / b;
+                zeroes[ret++] = t;
+            }
+        }
+        return ret - off;
+    }
+
+    // find the roots of g(t) = d*t^3 + a*t^2 + b*t + c in [A,B)
+    static int cubicRootsInAB(double d, double a, double b, double c,
+                              double[] pts, final int off,
+                              final double A, final double B)
+    {
+        if (d == 0.0d) {
+            int num = quadraticRoots(a, b, c, pts, off);
+            return filterOutNotInAB(pts, off, num, A, B) - off;
+        }
+        // From Graphics Gems:
+        // http://tog.acm.org/resources/GraphicsGems/gems/Roots3And4.c
+        // (also from awt.geom.CubicCurve2D. But here we don't need as
+        // much accuracy and we don't want to create arrays so we use
+        // our own customized version).
+
+        // normal form: x^3 + ax^2 + bx + c = 0
+        a /= d;
+        b /= d;
+        c /= d;
+
+        //  substitute x = y - A/3 to eliminate quadratic term:
+        //     x^3 +Px + Q = 0
+        //
+        // Since we actually need P/3 and Q/2 for all of the
+        // calculations that follow, we will calculate
+        // p = P/3
+        // q = Q/2
+        // instead and use those values for simplicity of the code.
+        double sq_A = a * a;
+        double p = (1.0d/3.0d) * ((-1.0d/3.0d) * sq_A + b);
+        double q = (1.0d/2.0d) * ((2.0d/27.0d) * a * sq_A - (1.0d/3.0d) * a * b + c);
+
+        // use Cardano's formula
+
+        double cb_p = p * p * p;
+        double D = q * q + cb_p;
+
+        int num;
+        if (D < 0.0d) {
+            // see: http://en.wikipedia.org/wiki/Cubic_function#Trigonometric_.28and_hyperbolic.29_method
+            final double phi = (1.0d/3.0d) * acos(-q / sqrt(-cb_p));
+            final double t = 2.0d * sqrt(-p);
+
+            pts[ off+0 ] = ( t * cos(phi));
+            pts[ off+1 ] = (-t * cos(phi + (PI / 3.0d)));
+            pts[ off+2 ] = (-t * cos(phi - (PI / 3.0d)));
+            num = 3;
+        } else {
+            final double sqrt_D = sqrt(D);
+            final double u = cbrt(sqrt_D - q);
+            final double v = - cbrt(sqrt_D + q);
+
+            pts[ off ] = (u + v);
+            num = 1;
+
+            if (within(D, 0.0d, 1e-8d)) {
+                pts[off+1] = -(pts[off] / 2.0d);
+                num = 2;
+            }
+        }
+
+        final double sub = (1.0d/3.0d) * a;
+
+        for (int i = 0; i < num; ++i) {
+            pts[ off+i ] -= sub;
+        }
+
+        return filterOutNotInAB(pts, off, num, A, B) - off;
+    }
+
+    static double evalCubic(final double a, final double b,
+                           final double c, final double d,
+                           final double t)
+    {
+        return t * (t * (t * a + b) + c) + d;
+    }
+
+    static double evalQuad(final double a, final double b,
+                          final double c, final double t)
+    {
+        return t * (t * a + b) + c;
+    }
+
+    // returns the index 1 past the last valid element remaining after filtering
+    static int filterOutNotInAB(double[] nums, final int off, final int len,
+                                final double a, final double b)
+    {
+        int ret = off;
+        for (int i = off, end = off + len; i < end; i++) {
+            if (nums[i] >= a && nums[i] < b) {
+                nums[ret++] = nums[i];
+            }
+        }
+        return ret;
+    }
+
+    static double polyLineLength(double[] poly, final int off, final int nCoords) {
+        assert nCoords % 2 == 0 && poly.length >= off + nCoords : "";
+        double acc = 0.0d;
+        for (int i = off + 2; i < off + nCoords; i += 2) {
+            acc += linelen(poly[i], poly[i+1], poly[i-2], poly[i-1]);
+        }
+        return acc;
+    }
+
+    static double linelen(double x1, double y1, double x2, double y2) {
+        final double dx = x2 - x1;
+        final double dy = y2 - y1;
+        return Math.sqrt(dx*dx + dy*dy);
+    }
+
+    static void subdivide(double[] src, int srcoff, double[] left, int leftoff,
+                          double[] right, int rightoff, int type)
+    {
+        switch(type) {
+        case 6:
+            DHelpers.subdivideQuad(src, srcoff, left, leftoff, right, rightoff);
+            return;
+        case 8:
+            DHelpers.subdivideCubic(src, srcoff, left, leftoff, right, rightoff);
+            return;
+        default:
+            throw new InternalError("Unsupported curve type");
+        }
+    }
+
+    static void isort(double[] a, int off, int len) {
+        for (int i = off + 1, end = off + len; i < end; i++) {
+            double ai = a[i];
+            int j = i - 1;
+            for (; j >= off && a[j] > ai; j--) {
+                a[j+1] = a[j];
+            }
+            a[j+1] = ai;
+        }
+    }
+
+    // Most of these are copied from classes in java.awt.geom because we need
+    // both single and double precision variants of these functions, and Line2D,
+    // CubicCurve2D, QuadCurve2D don't provide them.
+    /**
+     * Subdivides the cubic curve specified by the coordinates
+     * stored in the <code>src</code> array at indices <code>srcoff</code>
+     * through (<code>srcoff</code>&nbsp;+&nbsp;7) and stores the
+     * resulting two subdivided curves into the two result arrays at the
+     * corresponding indices.
+     * Either or both of the <code>left</code> and <code>right</code>
+     * arrays may be <code>null</code> or a reference to the same array
+     * as the <code>src</code> array.
+     * Note that the last point in the first subdivided curve is the
+     * same as the first point in the second subdivided curve. Thus,
+     * it is possible to pass the same array for <code>left</code>
+     * and <code>right</code> and to use offsets, such as <code>rightoff</code>
+     * equals (<code>leftoff</code> + 6), in order
+     * to avoid allocating extra storage for this common point.
+     * @param src the array holding the coordinates for the source curve
+     * @param srcoff the offset into the array of the beginning of the
+     * the 6 source coordinates
+     * @param left the array for storing the coordinates for the first
+     * half of the subdivided curve
+     * @param leftoff the offset into the array of the beginning of the
+     * the 6 left coordinates
+     * @param right the array for storing the coordinates for the second
+     * half of the subdivided curve
+     * @param rightoff the offset into the array of the beginning of the
+     * the 6 right coordinates
+     * @since 1.7
+     */
+    static void subdivideCubic(double[] src, int srcoff,
+                               double[] left, int leftoff,
+                               double[] right, int rightoff)
+    {
+        double x1 = src[srcoff + 0];
+        double y1 = src[srcoff + 1];
+        double ctrlx1 = src[srcoff + 2];
+        double ctrly1 = src[srcoff + 3];
+        double ctrlx2 = src[srcoff + 4];
+        double ctrly2 = src[srcoff + 5];
+        double x2 = src[srcoff + 6];
+        double y2 = src[srcoff + 7];
+        if (left != null) {
+            left[leftoff + 0] = x1;
+            left[leftoff + 1] = y1;
+        }
+        if (right != null) {
+            right[rightoff + 6] = x2;
+            right[rightoff + 7] = y2;
+        }
+        x1 = (x1 + ctrlx1) / 2.0d;
+        y1 = (y1 + ctrly1) / 2.0d;
+        x2 = (x2 + ctrlx2) / 2.0d;
+        y2 = (y2 + ctrly2) / 2.0d;
+        double centerx = (ctrlx1 + ctrlx2) / 2.0d;
+        double centery = (ctrly1 + ctrly2) / 2.0d;
+        ctrlx1 = (x1 + centerx) / 2.0d;
+        ctrly1 = (y1 + centery) / 2.0d;
+        ctrlx2 = (x2 + centerx) / 2.0d;
+        ctrly2 = (y2 + centery) / 2.0d;
+        centerx = (ctrlx1 + ctrlx2) / 2.0d;
+        centery = (ctrly1 + ctrly2) / 2.0d;
+        if (left != null) {
+            left[leftoff + 2] = x1;
+            left[leftoff + 3] = y1;
+            left[leftoff + 4] = ctrlx1;
+            left[leftoff + 5] = ctrly1;
+            left[leftoff + 6] = centerx;
+            left[leftoff + 7] = centery;
+        }
+        if (right != null) {
+            right[rightoff + 0] = centerx;
+            right[rightoff + 1] = centery;
+            right[rightoff + 2] = ctrlx2;
+            right[rightoff + 3] = ctrly2;
+            right[rightoff + 4] = x2;
+            right[rightoff + 5] = y2;
+        }
+    }
+
+
+    static void subdivideCubicAt(double t, double[] src, int srcoff,
+                                 double[] left, int leftoff,
+                                 double[] right, int rightoff)
+    {
+        double x1 = src[srcoff + 0];
+        double y1 = src[srcoff + 1];
+        double ctrlx1 = src[srcoff + 2];
+        double ctrly1 = src[srcoff + 3];
+        double ctrlx2 = src[srcoff + 4];
+        double ctrly2 = src[srcoff + 5];
+        double x2 = src[srcoff + 6];
+        double y2 = src[srcoff + 7];
+        if (left != null) {
+            left[leftoff + 0] = x1;
+            left[leftoff + 1] = y1;
+        }
+        if (right != null) {
+            right[rightoff + 6] = x2;
+            right[rightoff + 7] = y2;
+        }
+        x1 = x1 + t * (ctrlx1 - x1);
+        y1 = y1 + t * (ctrly1 - y1);
+        x2 = ctrlx2 + t * (x2 - ctrlx2);
+        y2 = ctrly2 + t * (y2 - ctrly2);
+        double centerx = ctrlx1 + t * (ctrlx2 - ctrlx1);
+        double centery = ctrly1 + t * (ctrly2 - ctrly1);
+        ctrlx1 = x1 + t * (centerx - x1);
+        ctrly1 = y1 + t * (centery - y1);
+        ctrlx2 = centerx + t * (x2 - centerx);
+        ctrly2 = centery + t * (y2 - centery);
+        centerx = ctrlx1 + t * (ctrlx2 - ctrlx1);
+        centery = ctrly1 + t * (ctrly2 - ctrly1);
+        if (left != null) {
+            left[leftoff + 2] = x1;
+            left[leftoff + 3] = y1;
+            left[leftoff + 4] = ctrlx1;
+            left[leftoff + 5] = ctrly1;
+            left[leftoff + 6] = centerx;
+            left[leftoff + 7] = centery;
+        }
+        if (right != null) {
+            right[rightoff + 0] = centerx;
+            right[rightoff + 1] = centery;
+            right[rightoff + 2] = ctrlx2;
+            right[rightoff + 3] = ctrly2;
+            right[rightoff + 4] = x2;
+            right[rightoff + 5] = y2;
+        }
+    }
+
+    static void subdivideQuad(double[] src, int srcoff,
+                              double[] left, int leftoff,
+                              double[] right, int rightoff)
+    {
+        double x1 = src[srcoff + 0];
+        double y1 = src[srcoff + 1];
+        double ctrlx = src[srcoff + 2];
+        double ctrly = src[srcoff + 3];
+        double x2 = src[srcoff + 4];
+        double y2 = src[srcoff + 5];
+        if (left != null) {
+            left[leftoff + 0] = x1;
+            left[leftoff + 1] = y1;
+        }
+        if (right != null) {
+            right[rightoff + 4] = x2;
+            right[rightoff + 5] = y2;
+        }
+        x1 = (x1 + ctrlx) / 2.0d;
+        y1 = (y1 + ctrly) / 2.0d;
+        x2 = (x2 + ctrlx) / 2.0d;
+        y2 = (y2 + ctrly) / 2.0d;
+        ctrlx = (x1 + x2) / 2.0d;
+        ctrly = (y1 + y2) / 2.0d;
+        if (left != null) {
+            left[leftoff + 2] = x1;
+            left[leftoff + 3] = y1;
+            left[leftoff + 4] = ctrlx;
+            left[leftoff + 5] = ctrly;
+        }
+        if (right != null) {
+            right[rightoff + 0] = ctrlx;
+            right[rightoff + 1] = ctrly;
+            right[rightoff + 2] = x2;
+            right[rightoff + 3] = y2;
+        }
+    }
+
+    static void subdivideQuadAt(double t, double[] src, int srcoff,
+                                double[] left, int leftoff,
+                                double[] right, int rightoff)
+    {
+        double x1 = src[srcoff + 0];
+        double y1 = src[srcoff + 1];
+        double ctrlx = src[srcoff + 2];
+        double ctrly = src[srcoff + 3];
+        double x2 = src[srcoff + 4];
+        double y2 = src[srcoff + 5];
+        if (left != null) {
+            left[leftoff + 0] = x1;
+            left[leftoff + 1] = y1;
+        }
+        if (right != null) {
+            right[rightoff + 4] = x2;
+            right[rightoff + 5] = y2;
+        }
+        x1 = x1 + t * (ctrlx - x1);
+        y1 = y1 + t * (ctrly - y1);
+        x2 = ctrlx + t * (x2 - ctrlx);
+        y2 = ctrly + t * (y2 - ctrly);
+        ctrlx = x1 + t * (x2 - x1);
+        ctrly = y1 + t * (y2 - y1);
+        if (left != null) {
+            left[leftoff + 2] = x1;
+            left[leftoff + 3] = y1;
+            left[leftoff + 4] = ctrlx;
+            left[leftoff + 5] = ctrly;
+        }
+        if (right != null) {
+            right[rightoff + 0] = ctrlx;
+            right[rightoff + 1] = ctrly;
+            right[rightoff + 2] = x2;
+            right[rightoff + 3] = y2;
+        }
+    }
+
+    static void subdivideAt(double t, double[] src, int srcoff,
+                            double[] left, int leftoff,
+                            double[] right, int rightoff, int size)
+    {
+        switch(size) {
+        case 8:
+            subdivideCubicAt(t, src, srcoff, left, leftoff, right, rightoff);
+            return;
+        case 6:
+            subdivideQuadAt(t, src, srcoff, left, leftoff, right, rightoff);
+            return;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DMarlinRenderingEngine.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,1111 @@
+/*
+ * 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.  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.java2d.marlin;
+
+import java.awt.BasicStroke;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Path2D;
+import java.awt.geom.PathIterator;
+import java.security.AccessController;
+import static sun.java2d.marlin.MarlinUtils.logInfo;
+import sun.java2d.ReentrantContextProvider;
+import sun.java2d.ReentrantContextProviderCLQ;
+import sun.java2d.ReentrantContextProviderTL;
+import sun.java2d.pipe.AATileGenerator;
+import sun.java2d.pipe.Region;
+import sun.java2d.pipe.RenderingEngine;
+import sun.security.action.GetPropertyAction;
+
+/**
+ * Marlin RendererEngine implementation (derived from Pisces)
+ */
+public final class DMarlinRenderingEngine extends RenderingEngine
+                                          implements MarlinConst
+{
+    private static enum NormMode {
+        ON_WITH_AA {
+            @Override
+            PathIterator getNormalizingPathIterator(final DRendererContext rdrCtx,
+                                                    final PathIterator src)
+            {
+                // NormalizingPathIterator NearestPixelCenter:
+                return rdrCtx.nPCPathIterator.init(src);
+            }
+        },
+        ON_NO_AA{
+            @Override
+            PathIterator getNormalizingPathIterator(final DRendererContext rdrCtx,
+                                                    final PathIterator src)
+            {
+                // NearestPixel NormalizingPathIterator:
+                return rdrCtx.nPQPathIterator.init(src);
+            }
+        },
+        OFF{
+            @Override
+            PathIterator getNormalizingPathIterator(final DRendererContext rdrCtx,
+                                                    final PathIterator src)
+            {
+                // return original path iterator if normalization is disabled:
+                return src;
+            }
+        };
+
+        abstract PathIterator getNormalizingPathIterator(DRendererContext rdrCtx,
+                                                         PathIterator src);
+    }
+
+    private static final float MIN_PEN_SIZE = 1.0f / NORM_SUBPIXELS;
+
+    static final double UPPER_BND = Float.MAX_VALUE / 2.0d;
+    static final double LOWER_BND = -UPPER_BND;
+
+    /**
+     * Public constructor
+     */
+    public DMarlinRenderingEngine() {
+        super();
+        logSettings(DMarlinRenderingEngine.class.getName());
+    }
+
+    /**
+     * Create a widened path as specified by the parameters.
+     * <p>
+     * The specified {@code src} {@link Shape} is widened according
+     * to the specified attribute parameters as per the
+     * {@link BasicStroke} specification.
+     *
+     * @param src the source path to be widened
+     * @param width the width of the widened path as per {@code BasicStroke}
+     * @param caps the end cap decorations as per {@code BasicStroke}
+     * @param join the segment join decorations as per {@code BasicStroke}
+     * @param miterlimit the miter limit as per {@code BasicStroke}
+     * @param dashes the dash length array as per {@code BasicStroke}
+     * @param dashphase the initial dash phase as per {@code BasicStroke}
+     * @return the widened path stored in a new {@code Shape} object
+     * @since 1.7
+     */
+    @Override
+    public Shape createStrokedShape(Shape src,
+                                    float width,
+                                    int caps,
+                                    int join,
+                                    float miterlimit,
+                                    float[] dashes,
+                                    float dashphase)
+    {
+        final DRendererContext rdrCtx = getRendererContext();
+        try {
+            // initialize a large copyable Path2D to avoid a lot of array growing:
+            final Path2D.Double p2d = rdrCtx.getPath2D();
+
+            strokeTo(rdrCtx,
+                     src,
+                     null,
+                     width,
+                     NormMode.OFF,
+                     caps,
+                     join,
+                     miterlimit,
+                     dashes,
+                     dashphase,
+                     rdrCtx.transformerPC2D.wrapPath2d(p2d)
+                    );
+
+            // Use Path2D copy constructor (trim)
+            return new Path2D.Double(p2d);
+
+        } finally {
+            // recycle the DRendererContext instance
+            returnRendererContext(rdrCtx);
+        }
+    }
+
+    /**
+     * Sends the geometry for a widened path as specified by the parameters
+     * to the specified consumer.
+     * <p>
+     * The specified {@code src} {@link Shape} is widened according
+     * to the parameters specified by the {@link BasicStroke} object.
+     * Adjustments are made to the path as appropriate for the
+     * {@link java.awt.RenderingHints#VALUE_STROKE_NORMALIZE} hint if the
+     * {@code normalize} boolean parameter is true.
+     * Adjustments are made to the path as appropriate for the
+     * {@link java.awt.RenderingHints#VALUE_ANTIALIAS_ON} hint if the
+     * {@code antialias} boolean parameter is true.
+     * <p>
+     * The geometry of the widened path is forwarded to the indicated
+     * {@link DPathConsumer2D} object as it is calculated.
+     *
+     * @param src the source path to be widened
+     * @param bs the {@code BasicSroke} object specifying the
+     *           decorations to be applied to the widened path
+     * @param normalize indicates whether stroke normalization should
+     *                  be applied
+     * @param antialias indicates whether or not adjustments appropriate
+     *                  to antialiased rendering should be applied
+     * @param consumer the {@code DPathConsumer2D} instance to forward
+     *                 the widened geometry to
+     * @since 1.7
+     */
+    @Override
+    public void strokeTo(Shape src,
+                         AffineTransform at,
+                         BasicStroke bs,
+                         boolean thin,
+                         boolean normalize,
+                         boolean antialias,
+                         final sun.awt.geom.PathConsumer2D consumer)
+    {
+        final NormMode norm = (normalize) ?
+                ((antialias) ? NormMode.ON_WITH_AA : NormMode.ON_NO_AA)
+                : NormMode.OFF;
+
+        final DRendererContext rdrCtx = getRendererContext();
+        try {
+            strokeTo(rdrCtx, src, at, bs, thin, norm, antialias,
+                     rdrCtx.p2dAdapter.init(consumer));
+        } finally {
+            // recycle the DRendererContext instance
+            returnRendererContext(rdrCtx);
+        }
+    }
+
+    final void strokeTo(final DRendererContext rdrCtx,
+                        Shape src,
+                        AffineTransform at,
+                        BasicStroke bs,
+                        boolean thin,
+                        NormMode normalize,
+                        boolean antialias,
+                        DPathConsumer2D pc2d)
+    {
+        double lw;
+        if (thin) {
+            if (antialias) {
+                lw = userSpaceLineWidth(at, MIN_PEN_SIZE);
+            } else {
+                lw = userSpaceLineWidth(at, 1.0d);
+            }
+        } else {
+            lw = bs.getLineWidth();
+        }
+        strokeTo(rdrCtx,
+                 src,
+                 at,
+                 lw,
+                 normalize,
+                 bs.getEndCap(),
+                 bs.getLineJoin(),
+                 bs.getMiterLimit(),
+                 bs.getDashArray(),
+                 bs.getDashPhase(),
+                 pc2d);
+    }
+
+    private final double userSpaceLineWidth(AffineTransform at, double lw) {
+
+        double widthScale;
+
+        if (at == null) {
+            widthScale = 1.0d;
+        } else if ((at.getType() & (AffineTransform.TYPE_GENERAL_TRANSFORM  |
+                                    AffineTransform.TYPE_GENERAL_SCALE)) != 0) {
+            widthScale = Math.sqrt(at.getDeterminant());
+        } else {
+            // First calculate the "maximum scale" of this transform.
+            double A = at.getScaleX();       // m00
+            double C = at.getShearX();       // m01
+            double B = at.getShearY();       // m10
+            double D = at.getScaleY();       // m11
+
+            /*
+             * Given a 2 x 2 affine matrix [ A B ] such that
+             *                             [ C D ]
+             * v' = [x' y'] = [Ax + Cy, Bx + Dy], we want to
+             * find the maximum magnitude (norm) of the vector v'
+             * with the constraint (x^2 + y^2 = 1).
+             * The equation to maximize is
+             *     |v'| = sqrt((Ax+Cy)^2+(Bx+Dy)^2)
+             * or  |v'| = sqrt((AA+BB)x^2 + 2(AC+BD)xy + (CC+DD)y^2).
+             * Since sqrt is monotonic we can maximize |v'|^2
+             * instead and plug in the substitution y = sqrt(1 - x^2).
+             * Trigonometric equalities can then be used to get
+             * rid of most of the sqrt terms.
+             */
+
+            double EA = A*A + B*B;          // x^2 coefficient
+            double EB = 2.0d * (A*C + B*D); // xy coefficient
+            double EC = C*C + D*D;          // y^2 coefficient
+
+            /*
+             * There is a lot of calculus omitted here.
+             *
+             * Conceptually, in the interests of understanding the
+             * terms that the calculus produced we can consider
+             * that EA and EC end up providing the lengths along
+             * the major axes and the hypot term ends up being an
+             * adjustment for the additional length along the off-axis
+             * angle of rotated or sheared ellipses as well as an
+             * adjustment for the fact that the equation below
+             * averages the two major axis lengths.  (Notice that
+             * the hypot term contains a part which resolves to the
+             * difference of these two axis lengths in the absence
+             * of rotation.)
+             *
+             * In the calculus, the ratio of the EB and (EA-EC) terms
+             * ends up being the tangent of 2*theta where theta is
+             * the angle that the long axis of the ellipse makes
+             * with the horizontal axis.  Thus, this equation is
+             * calculating the length of the hypotenuse of a triangle
+             * along that axis.
+             */
+
+            double hypot = Math.sqrt(EB*EB + (EA-EC)*(EA-EC));
+            // sqrt omitted, compare to squared limits below.
+            double widthsquared = ((EA + EC + hypot) / 2.0d);
+
+            widthScale = Math.sqrt(widthsquared);
+        }
+
+        return (lw / widthScale);
+    }
+
+    final void strokeTo(final DRendererContext rdrCtx,
+                        Shape src,
+                        AffineTransform at,
+                        double width,
+                        NormMode norm,
+                        int caps,
+                        int join,
+                        float miterlimit,
+                        float[] dashes,
+                        float dashphase,
+                        DPathConsumer2D pc2d)
+    {
+        // We use strokerat so that in Stroker and Dasher we can work only
+        // with the pre-transformation coordinates. This will repeat a lot of
+        // computations done in the path iterator, but the alternative is to
+        // work with transformed paths and compute untransformed coordinates
+        // as needed. This would be faster but I do not think the complexity
+        // of working with both untransformed and transformed coordinates in
+        // the same code is worth it.
+        // However, if a path's width is constant after a transformation,
+        // we can skip all this untransforming.
+
+        // As pathTo() will check transformed coordinates for invalid values
+        // (NaN / Infinity) to ignore such points, it is necessary to apply the
+        // transformation before the path processing.
+        AffineTransform strokerat = null;
+
+        int dashLen = -1;
+        boolean recycleDashes = false;
+        double[] dashesD = null;
+
+        // Ensure converting dashes to double precision:
+        if (dashes != null) {
+            recycleDashes = true;
+            dashLen = dashes.length;
+            dashesD = rdrCtx.dasher.copyDashArray(dashes);
+        }
+
+        if (at != null && !at.isIdentity()) {
+            final double a = at.getScaleX();
+            final double b = at.getShearX();
+            final double c = at.getShearY();
+            final double d = at.getScaleY();
+            final double det = a * d - c * b;
+
+            if (Math.abs(det) <= (2.0d * Double.MIN_VALUE)) {
+                // this rendering engine takes one dimensional curves and turns
+                // them into 2D shapes by giving them width.
+                // However, if everything is to be passed through a singular
+                // transformation, these 2D shapes will be squashed down to 1D
+                // again so, nothing can be drawn.
+
+                // Every path needs an initial moveTo and a pathDone. If these
+                // are not there this causes a SIGSEGV in libawt.so (at the time
+                // of writing of this comment (September 16, 2010)). Actually,
+                // I am not sure if the moveTo is necessary to avoid the SIGSEGV
+                // but the pathDone is definitely needed.
+                pc2d.moveTo(0.0d, 0.0d);
+                pc2d.pathDone();
+                return;
+            }
+
+            // If the transform is a constant multiple of an orthogonal transformation
+            // then every length is just multiplied by a constant, so we just
+            // need to transform input paths to stroker and tell stroker
+            // the scaled width. This condition is satisfied if
+            // a*b == -c*d && a*a+c*c == b*b+d*d. In the actual check below, we
+            // leave a bit of room for error.
+            if (nearZero(a*b + c*d) && nearZero(a*a + c*c - (b*b + d*d))) {
+                final double scale =  Math.sqrt(a*a + c*c);
+
+                if (dashesD != null) {
+                    for (int i = 0; i < dashLen; i++) {
+                        dashesD[i] *= scale;
+                    }
+                    dashphase *= scale;
+                }
+                width *= scale;
+
+                // by now strokerat == null. Input paths to
+                // stroker (and maybe dasher) will have the full transform at
+                // applied to them and nothing will happen to the output paths.
+            } else {
+                strokerat = at;
+
+                // by now strokerat == at. Input paths to
+                // stroker (and maybe dasher) will have the full transform at
+                // applied to them, then they will be normalized, and then
+                // the inverse of *only the non translation part of at* will
+                // be applied to the normalized paths. This won't cause problems
+                // in stroker, because, suppose at = T*A, where T is just the
+                // translation part of at, and A is the rest. T*A has already
+                // been applied to Stroker/Dasher's input. Then Ainv will be
+                // applied. Ainv*T*A is not equal to T, but it is a translation,
+                // which means that none of stroker's assumptions about its
+                // input will be violated. After all this, A will be applied
+                // to stroker's output.
+            }
+        } else {
+            // either at is null or it's the identity. In either case
+            // we don't transform the path.
+            at = null;
+        }
+
+        if (USE_SIMPLIFIER) {
+            // Use simplifier after stroker before Renderer
+            // to remove collinear segments (notably due to cap square)
+            pc2d = rdrCtx.simplifier.init(pc2d);
+        }
+
+        final DTransformingPathConsumer2D transformerPC2D = rdrCtx.transformerPC2D;
+        pc2d = transformerPC2D.deltaTransformConsumer(pc2d, strokerat);
+
+        pc2d = rdrCtx.stroker.init(pc2d, width, caps, join, miterlimit);
+
+        if (dashesD != null) {
+            pc2d = rdrCtx.dasher.init(pc2d, dashesD, dashLen, dashphase,
+                                      recycleDashes);
+        }
+        pc2d = transformerPC2D.inverseDeltaTransformConsumer(pc2d, strokerat);
+
+        final PathIterator pi = norm.getNormalizingPathIterator(rdrCtx,
+                                         src.getPathIterator(at));
+
+        pathTo(rdrCtx, pi, pc2d);
+
+        /*
+         * Pipeline seems to be:
+         * shape.getPathIterator(at)
+         * -> (NormalizingPathIterator)
+         * -> (inverseDeltaTransformConsumer)
+         * -> (Dasher)
+         * -> Stroker
+         * -> (deltaTransformConsumer)
+         *
+         * -> (CollinearSimplifier) to remove redundant segments
+         *
+         * -> pc2d = Renderer (bounding box)
+         */
+    }
+
+    private static boolean nearZero(final double num) {
+        return Math.abs(num) < 2.0d * Math.ulp(num);
+    }
+
+    abstract static class NormalizingPathIterator implements PathIterator {
+
+        private PathIterator src;
+
+        // the adjustment applied to the current position.
+        private double curx_adjust, cury_adjust;
+        // the adjustment applied to the last moveTo position.
+        private double movx_adjust, movy_adjust;
+
+        private final double[] tmp;
+
+        NormalizingPathIterator(final double[] tmp) {
+            this.tmp = tmp;
+        }
+
+        final NormalizingPathIterator init(final PathIterator src) {
+            this.src = src;
+            return this; // fluent API
+        }
+
+        /**
+         * Disposes this path iterator:
+         * clean up before reusing this instance
+         */
+        final void dispose() {
+            // free source PathIterator:
+            this.src = null;
+        }
+
+        @Override
+        public final int currentSegment(final double[] coords) {
+            int lastCoord;
+            final int type = src.currentSegment(coords);
+
+            switch(type) {
+                case PathIterator.SEG_MOVETO:
+                case PathIterator.SEG_LINETO:
+                    lastCoord = 0;
+                    break;
+                case PathIterator.SEG_QUADTO:
+                    lastCoord = 2;
+                    break;
+                case PathIterator.SEG_CUBICTO:
+                    lastCoord = 4;
+                    break;
+                case PathIterator.SEG_CLOSE:
+                    // we don't want to deal with this case later. We just exit now
+                    curx_adjust = movx_adjust;
+                    cury_adjust = movy_adjust;
+                    return type;
+                default:
+                    throw new InternalError("Unrecognized curve type");
+            }
+
+            // normalize endpoint
+            double coord, x_adjust, y_adjust;
+
+            coord = coords[lastCoord];
+            x_adjust = normCoord(coord); // new coord
+            coords[lastCoord] = x_adjust;
+            x_adjust -= coord;
+
+            coord = coords[lastCoord + 1];
+            y_adjust = normCoord(coord); // new coord
+            coords[lastCoord + 1] = y_adjust;
+            y_adjust -= coord;
+
+            // now that the end points are done, normalize the control points
+            switch(type) {
+                case PathIterator.SEG_MOVETO:
+                    movx_adjust = x_adjust;
+                    movy_adjust = y_adjust;
+                    break;
+                case PathIterator.SEG_LINETO:
+                    break;
+                case PathIterator.SEG_QUADTO:
+                    coords[0] += (curx_adjust + x_adjust) / 2.0d;
+                    coords[1] += (cury_adjust + y_adjust) / 2.0d;
+                    break;
+                case PathIterator.SEG_CUBICTO:
+                    coords[0] += curx_adjust;
+                    coords[1] += cury_adjust;
+                    coords[2] += x_adjust;
+                    coords[3] += y_adjust;
+                    break;
+                case PathIterator.SEG_CLOSE:
+                    // handled earlier
+                default:
+            }
+            curx_adjust = x_adjust;
+            cury_adjust = y_adjust;
+            return type;
+        }
+
+        abstract double normCoord(final double coord);
+
+        @Override
+        public final int currentSegment(final float[] coords) {
+            final double[] _tmp = tmp; // dirty
+            int type = this.currentSegment(_tmp);
+            for (int i = 0; i < 6; i++) {
+                coords[i] = (float)_tmp[i];
+            }
+            return type;
+        }
+
+        @Override
+        public final int getWindingRule() {
+            return src.getWindingRule();
+        }
+
+        @Override
+        public final boolean isDone() {
+            if (src.isDone()) {
+                // Dispose this instance:
+                dispose();
+                return true;
+            }
+            return false;
+        }
+
+        @Override
+        public final void next() {
+            src.next();
+        }
+
+        static final class NearestPixelCenter
+                                extends NormalizingPathIterator
+        {
+            NearestPixelCenter(final double[] tmp) {
+                super(tmp);
+            }
+
+            @Override
+            double normCoord(final double coord) {
+                // round to nearest pixel center
+                return Math.floor(coord) + 0.5d;
+            }
+        }
+
+        static final class NearestPixelQuarter
+                                extends NormalizingPathIterator
+        {
+            NearestPixelQuarter(final double[] tmp) {
+                super(tmp);
+            }
+
+            @Override
+            double normCoord(final double coord) {
+                // round to nearest (0.25, 0.25) pixel quarter
+                return Math.floor(coord + 0.25d) + 0.25d;
+            }
+        }
+    }
+
+    private static void pathTo(final DRendererContext rdrCtx, final PathIterator pi,
+                               final DPathConsumer2D pc2d)
+    {
+        // mark context as DIRTY:
+        rdrCtx.dirty = true;
+
+        final double[] coords = rdrCtx.double6;
+
+        pathToLoop(coords, pi, pc2d);
+
+        // mark context as CLEAN:
+        rdrCtx.dirty = false;
+    }
+
+    private static void pathToLoop(final double[] coords, final PathIterator pi,
+                                   final DPathConsumer2D pc2d)
+    {
+        // ported from DuctusRenderingEngine.feedConsumer() but simplified:
+        // - removed skip flag = !subpathStarted
+        // - removed pathClosed (ie subpathStarted not set to false)
+        boolean subpathStarted = false;
+
+        for (; !pi.isDone(); pi.next()) {
+            switch (pi.currentSegment(coords)) {
+            case PathIterator.SEG_MOVETO:
+                /* Checking SEG_MOVETO coordinates if they are out of the
+                 * [LOWER_BND, UPPER_BND] range. This check also handles NaN
+                 * and Infinity values. Skipping next path segment in case of
+                 * invalid data.
+                 */
+                if (coords[0] < UPPER_BND && coords[0] > LOWER_BND &&
+                    coords[1] < UPPER_BND && coords[1] > LOWER_BND)
+                {
+                    pc2d.moveTo(coords[0], coords[1]);
+                    subpathStarted = true;
+                }
+                break;
+            case PathIterator.SEG_LINETO:
+                /* Checking SEG_LINETO coordinates if they are out of the
+                 * [LOWER_BND, UPPER_BND] range. This check also handles NaN
+                 * and Infinity values. Ignoring current path segment in case
+                 * of invalid data. If segment is skipped its endpoint
+                 * (if valid) is used to begin new subpath.
+                 */
+                if (coords[0] < UPPER_BND && coords[0] > LOWER_BND &&
+                    coords[1] < UPPER_BND && coords[1] > LOWER_BND)
+                {
+                    if (subpathStarted) {
+                        pc2d.lineTo(coords[0], coords[1]);
+                    } else {
+                        pc2d.moveTo(coords[0], coords[1]);
+                        subpathStarted = true;
+                    }
+                }
+                break;
+            case PathIterator.SEG_QUADTO:
+                // Quadratic curves take two points
+                /* Checking SEG_QUADTO coordinates if they are out of the
+                 * [LOWER_BND, UPPER_BND] range. This check also handles NaN
+                 * and Infinity values. Ignoring current path segment in case
+                 * of invalid endpoints's data. Equivalent to the SEG_LINETO
+                 * if endpoint coordinates are valid but there are invalid data
+                 * among other coordinates
+                 */
+                if (coords[2] < UPPER_BND && coords[2] > LOWER_BND &&
+                    coords[3] < UPPER_BND && coords[3] > LOWER_BND)
+                {
+                    if (subpathStarted) {
+                        if (coords[0] < UPPER_BND && coords[0] > LOWER_BND &&
+                            coords[1] < UPPER_BND && coords[1] > LOWER_BND)
+                        {
+                            pc2d.quadTo(coords[0], coords[1],
+                                        coords[2], coords[3]);
+                        } else {
+                            pc2d.lineTo(coords[2], coords[3]);
+                        }
+                    } else {
+                        pc2d.moveTo(coords[2], coords[3]);
+                        subpathStarted = true;
+                    }
+                }
+                break;
+            case PathIterator.SEG_CUBICTO:
+                // Cubic curves take three points
+                /* Checking SEG_CUBICTO coordinates if they are out of the
+                 * [LOWER_BND, UPPER_BND] range. This check also handles NaN
+                 * and Infinity values. Ignoring current path segment in case
+                 * of invalid endpoints's data. Equivalent to the SEG_LINETO
+                 * if endpoint coordinates are valid but there are invalid data
+                 * among other coordinates
+                 */
+                if (coords[4] < UPPER_BND && coords[4] > LOWER_BND &&
+                    coords[5] < UPPER_BND && coords[5] > LOWER_BND)
+                {
+                    if (subpathStarted) {
+                        if (coords[0] < UPPER_BND && coords[0] > LOWER_BND &&
+                            coords[1] < UPPER_BND && coords[1] > LOWER_BND &&
+                            coords[2] < UPPER_BND && coords[2] > LOWER_BND &&
+                            coords[3] < UPPER_BND && coords[3] > LOWER_BND)
+                        {
+                            pc2d.curveTo(coords[0], coords[1],
+                                         coords[2], coords[3],
+                                         coords[4], coords[5]);
+                        } else {
+                            pc2d.lineTo(coords[4], coords[5]);
+                        }
+                    } else {
+                        pc2d.moveTo(coords[4], coords[5]);
+                        subpathStarted = true;
+                    }
+                }
+                break;
+            case PathIterator.SEG_CLOSE:
+                if (subpathStarted) {
+                    pc2d.closePath();
+                    // do not set subpathStarted to false
+                    // in case of missing moveTo() after close()
+                }
+                break;
+            default:
+            }
+        }
+        pc2d.pathDone();
+    }
+
+    /**
+     * Construct an antialiased tile generator for the given shape with
+     * the given rendering attributes and store the bounds of the tile
+     * iteration in the bbox parameter.
+     * The {@code at} parameter specifies a transform that should affect
+     * both the shape and the {@code BasicStroke} attributes.
+     * The {@code clip} parameter specifies the current clip in effect
+     * in device coordinates and can be used to prune the data for the
+     * operation, but the renderer is not required to perform any
+     * clipping.
+     * If the {@code BasicStroke} parameter is null then the shape
+     * should be filled as is, otherwise the attributes of the
+     * {@code BasicStroke} should be used to specify a draw operation.
+     * The {@code thin} parameter indicates whether or not the
+     * transformed {@code BasicStroke} represents coordinates smaller
+     * than the minimum resolution of the antialiasing rasterizer as
+     * specified by the {@code getMinimumAAPenWidth()} method.
+     * <p>
+     * Upon returning, this method will fill the {@code bbox} parameter
+     * with 4 values indicating the bounds of the iteration of the
+     * tile generator.
+     * The iteration order of the tiles will be as specified by the
+     * pseudo-code:
+     * <pre>
+     *     for (y = bbox[1]; y < bbox[3]; y += tileheight) {
+     *         for (x = bbox[0]; x < bbox[2]; x += tilewidth) {
+     *         }
+     *     }
+     * </pre>
+     * If there is no output to be rendered, this method may return
+     * null.
+     *
+     * @param s the shape to be rendered (fill or draw)
+     * @param at the transform to be applied to the shape and the
+     *           stroke attributes
+     * @param clip the current clip in effect in device coordinates
+     * @param bs if non-null, a {@code BasicStroke} whose attributes
+     *           should be applied to this operation
+     * @param thin true if the transformed stroke attributes are smaller
+     *             than the minimum dropout pen width
+     * @param normalize true if the {@code VALUE_STROKE_NORMALIZE}
+     *                  {@code RenderingHint} is in effect
+     * @param bbox returns the bounds of the iteration
+     * @return the {@code AATileGenerator} instance to be consulted
+     *         for tile coverages, or null if there is no output to render
+     * @since 1.7
+     */
+    @Override
+    public AATileGenerator getAATileGenerator(Shape s,
+                                              AffineTransform at,
+                                              Region clip,
+                                              BasicStroke bs,
+                                              boolean thin,
+                                              boolean normalize,
+                                              int[] bbox)
+    {
+        MarlinTileGenerator ptg = null;
+        DRenderer r = null;
+
+        final DRendererContext rdrCtx = getRendererContext();
+        try {
+            // Test if at is identity:
+            final AffineTransform _at = (at != null && !at.isIdentity()) ? at
+                                        : null;
+
+            final NormMode norm = (normalize) ? NormMode.ON_WITH_AA : NormMode.OFF;
+
+            if (bs == null) {
+                // fill shape:
+                final PathIterator pi = norm.getNormalizingPathIterator(rdrCtx,
+                                                 s.getPathIterator(_at));
+
+                // note: Winding rule may be EvenOdd ONLY for fill operations !
+                r = rdrCtx.renderer.init(clip.getLoX(), clip.getLoY(),
+                                         clip.getWidth(), clip.getHeight(),
+                                         pi.getWindingRule());
+
+                // TODO: subdivide quad/cubic curves into monotonic curves ?
+                pathTo(rdrCtx, pi, r);
+            } else {
+                // draw shape with given stroke:
+                r = rdrCtx.renderer.init(clip.getLoX(), clip.getLoY(),
+                                         clip.getWidth(), clip.getHeight(),
+                                         PathIterator.WIND_NON_ZERO);
+
+                strokeTo(rdrCtx, s, _at, bs, thin, norm, true, r);
+            }
+            if (r.endRendering()) {
+                ptg = rdrCtx.ptg.init();
+                ptg.getBbox(bbox);
+                // note: do not returnRendererContext(rdrCtx)
+                // as it will be called later by MarlinTileGenerator.dispose()
+                r = null;
+            }
+        } finally {
+            if (r != null) {
+                // dispose renderer and recycle the RendererContext instance:
+                r.dispose();
+            }
+        }
+
+        // Return null to cancel AA tile generation (nothing to render)
+        return ptg;
+    }
+
+    @Override
+    public final AATileGenerator getAATileGenerator(double x, double y,
+                                                    double dx1, double dy1,
+                                                    double dx2, double dy2,
+                                                    double lw1, double lw2,
+                                                    Region clip,
+                                                    int[] bbox)
+    {
+        // REMIND: Deal with large coordinates!
+        double ldx1, ldy1, ldx2, ldy2;
+        boolean innerpgram = (lw1 > 0.0d && lw2 > 0.0d);
+
+        if (innerpgram) {
+            ldx1 = dx1 * lw1;
+            ldy1 = dy1 * lw1;
+            ldx2 = dx2 * lw2;
+            ldy2 = dy2 * lw2;
+            x -= (ldx1 + ldx2) / 2.0d;
+            y -= (ldy1 + ldy2) / 2.0d;
+            dx1 += ldx1;
+            dy1 += ldy1;
+            dx2 += ldx2;
+            dy2 += ldy2;
+            if (lw1 > 1.0d && lw2 > 1.0d) {
+                // Inner parallelogram was entirely consumed by stroke...
+                innerpgram = false;
+            }
+        } else {
+            ldx1 = ldy1 = ldx2 = ldy2 = 0.0d;
+        }
+
+        MarlinTileGenerator ptg = null;
+        DRenderer r = null;
+
+        final DRendererContext rdrCtx = getRendererContext();
+        try {
+            r = rdrCtx.renderer.init(clip.getLoX(), clip.getLoY(),
+                                         clip.getWidth(), clip.getHeight(),
+                                         DRenderer.WIND_EVEN_ODD);
+
+            r.moveTo( x,  y);
+            r.lineTo( (x+dx1),  (y+dy1));
+            r.lineTo( (x+dx1+dx2),  (y+dy1+dy2));
+            r.lineTo( (x+dx2),  (y+dy2));
+            r.closePath();
+
+            if (innerpgram) {
+                x += ldx1 + ldx2;
+                y += ldy1 + ldy2;
+                dx1 -= 2.0d * ldx1;
+                dy1 -= 2.0d * ldy1;
+                dx2 -= 2.0d * ldx2;
+                dy2 -= 2.0d * ldy2;
+                r.moveTo( x,  y);
+                r.lineTo( (x+dx1),  (y+dy1));
+                r.lineTo( (x+dx1+dx2),  (y+dy1+dy2));
+                r.lineTo( (x+dx2),  (y+dy2));
+                r.closePath();
+            }
+            r.pathDone();
+
+            if (r.endRendering()) {
+                ptg = rdrCtx.ptg.init();
+                ptg.getBbox(bbox);
+                // note: do not returnRendererContext(rdrCtx)
+                // as it will be called later by MarlinTileGenerator.dispose()
+                r = null;
+            }
+        } finally {
+            if (r != null) {
+                // dispose renderer and recycle the RendererContext instance:
+                r.dispose();
+            }
+        }
+
+        // Return null to cancel AA tile generation (nothing to render)
+        return ptg;
+    }
+
+    /**
+     * Returns the minimum pen width that the antialiasing rasterizer
+     * can represent without dropouts occuring.
+     * @since 1.7
+     */
+    @Override
+    public float getMinimumAAPenSize() {
+        return MIN_PEN_SIZE;
+    }
+
+    static {
+        if (PathIterator.WIND_NON_ZERO != DRenderer.WIND_NON_ZERO ||
+            PathIterator.WIND_EVEN_ODD != DRenderer.WIND_EVEN_ODD ||
+            BasicStroke.JOIN_MITER != DStroker.JOIN_MITER ||
+            BasicStroke.JOIN_ROUND != DStroker.JOIN_ROUND ||
+            BasicStroke.JOIN_BEVEL != DStroker.JOIN_BEVEL ||
+            BasicStroke.CAP_BUTT != DStroker.CAP_BUTT ||
+            BasicStroke.CAP_ROUND != DStroker.CAP_ROUND ||
+            BasicStroke.CAP_SQUARE != DStroker.CAP_SQUARE)
+        {
+            throw new InternalError("mismatched renderer constants");
+        }
+    }
+
+    // --- DRendererContext handling ---
+    // use ThreadLocal or ConcurrentLinkedQueue to get one DRendererContext
+    private static final boolean USE_THREAD_LOCAL;
+
+    // reference type stored in either TL or CLQ
+    static final int REF_TYPE;
+
+    // Per-thread DRendererContext
+    private static final ReentrantContextProvider<DRendererContext> RDR_CTX_PROVIDER;
+
+    // Static initializer to use TL or CLQ mode
+    static {
+        USE_THREAD_LOCAL = MarlinProperties.isUseThreadLocal();
+
+        // Soft reference by default:
+        final String refType = AccessController.doPrivileged(
+                            new GetPropertyAction("sun.java2d.renderer.useRef",
+                            "soft"));
+
+        // Java 1.6 does not support strings in switch:
+        if ("hard".equalsIgnoreCase(refType)) {
+            REF_TYPE = ReentrantContextProvider.REF_HARD;
+        } else if ("weak".equalsIgnoreCase(refType)) {
+            REF_TYPE = ReentrantContextProvider.REF_WEAK;
+        } else {
+            REF_TYPE = ReentrantContextProvider.REF_SOFT;
+        }
+
+        if (USE_THREAD_LOCAL) {
+            RDR_CTX_PROVIDER = new ReentrantContextProviderTL<DRendererContext>(REF_TYPE)
+                {
+                    @Override
+                    protected DRendererContext newContext() {
+                        return DRendererContext.createContext();
+                    }
+                };
+        } else {
+            RDR_CTX_PROVIDER = new ReentrantContextProviderCLQ<DRendererContext>(REF_TYPE)
+                {
+                    @Override
+                    protected DRendererContext newContext() {
+                        return DRendererContext.createContext();
+                    }
+                };
+        }
+    }
+
+    private static boolean SETTINGS_LOGGED = !ENABLE_LOGS;
+
+    private static void logSettings(final String reClass) {
+        // log information at startup
+        if (SETTINGS_LOGGED) {
+            return;
+        }
+        SETTINGS_LOGGED = true;
+
+        String refType;
+        switch (REF_TYPE) {
+            default:
+            case ReentrantContextProvider.REF_HARD:
+                refType = "hard";
+                break;
+            case ReentrantContextProvider.REF_SOFT:
+                refType = "soft";
+                break;
+            case ReentrantContextProvider.REF_WEAK:
+                refType = "weak";
+                break;
+        }
+
+        logInfo("=========================================================="
+                + "=====================");
+
+        logInfo("Marlin software rasterizer           = ENABLED");
+        logInfo("Version                              = ["
+                + Version.getVersion() + "]");
+        logInfo("sun.java2d.renderer                  = "
+                + reClass);
+        logInfo("sun.java2d.renderer.useThreadLocal   = "
+                + USE_THREAD_LOCAL);
+        logInfo("sun.java2d.renderer.useRef           = "
+                + refType);
+
+        logInfo("sun.java2d.renderer.edges            = "
+                + MarlinConst.INITIAL_EDGES_COUNT);
+        logInfo("sun.java2d.renderer.pixelsize        = "
+                + MarlinConst.INITIAL_PIXEL_DIM);
+
+        logInfo("sun.java2d.renderer.subPixel_log2_X  = "
+                + MarlinConst.SUBPIXEL_LG_POSITIONS_X);
+        logInfo("sun.java2d.renderer.subPixel_log2_Y  = "
+                + MarlinConst.SUBPIXEL_LG_POSITIONS_Y);
+
+        logInfo("sun.java2d.renderer.tileSize_log2    = "
+                + MarlinConst.TILE_H_LG);
+        logInfo("sun.java2d.renderer.tileWidth_log2   = "
+                + MarlinConst.TILE_W_LG);
+        logInfo("sun.java2d.renderer.blockSize_log2   = "
+                + MarlinConst.BLOCK_SIZE_LG);
+
+        // RLE / blockFlags settings
+
+        logInfo("sun.java2d.renderer.forceRLE         = "
+                + MarlinProperties.isForceRLE());
+        logInfo("sun.java2d.renderer.forceNoRLE       = "
+                + MarlinProperties.isForceNoRLE());
+        logInfo("sun.java2d.renderer.useTileFlags     = "
+                + MarlinProperties.isUseTileFlags());
+        logInfo("sun.java2d.renderer.useTileFlags.useHeuristics = "
+                + MarlinProperties.isUseTileFlagsWithHeuristics());
+        logInfo("sun.java2d.renderer.rleMinWidth      = "
+                + MarlinCache.RLE_MIN_WIDTH);
+
+        // optimisation parameters
+        logInfo("sun.java2d.renderer.useSimplifier    = "
+                + MarlinConst.USE_SIMPLIFIER);
+
+        // debugging parameters
+        logInfo("sun.java2d.renderer.doStats          = "
+                + MarlinConst.DO_STATS);
+        logInfo("sun.java2d.renderer.doMonitors       = "
+                + MarlinConst.DO_MONITORS);
+        logInfo("sun.java2d.renderer.doChecks         = "
+                + MarlinConst.DO_CHECKS);
+
+        // logging parameters
+        logInfo("sun.java2d.renderer.useLogger        = "
+                + MarlinConst.USE_LOGGER);
+        logInfo("sun.java2d.renderer.logCreateContext = "
+                + MarlinConst.LOG_CREATE_CONTEXT);
+        logInfo("sun.java2d.renderer.logUnsafeMalloc  = "
+                + MarlinConst.LOG_UNSAFE_MALLOC);
+
+        // quality settings
+        logInfo("sun.java2d.renderer.cubic_dec_d2     = "
+                + MarlinProperties.getCubicDecD2());
+        logInfo("sun.java2d.renderer.cubic_inc_d1     = "
+                + MarlinProperties.getCubicIncD1());
+        logInfo("sun.java2d.renderer.quad_dec_d2      = "
+                + MarlinProperties.getQuadDecD2());
+
+        logInfo("Renderer settings:");
+        logInfo("CUB_DEC_BND  = " + DRenderer.CUB_DEC_BND);
+        logInfo("CUB_INC_BND  = " + DRenderer.CUB_INC_BND);
+        logInfo("QUAD_DEC_BND = " + DRenderer.QUAD_DEC_BND);
+
+        logInfo("INITIAL_EDGES_CAPACITY               = "
+                + MarlinConst.INITIAL_EDGES_CAPACITY);
+        logInfo("INITIAL_CROSSING_COUNT               = "
+                + DRenderer.INITIAL_CROSSING_COUNT);
+
+        logInfo("=========================================================="
+                + "=====================");
+    }
+
+    /**
+     * Get the DRendererContext instance dedicated to the current thread
+     * @return DRendererContext instance
+     */
+    @SuppressWarnings({"unchecked"})
+    static DRendererContext getRendererContext() {
+        final DRendererContext rdrCtx = RDR_CTX_PROVIDER.acquire();
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_pre_getAATileGenerator.start();
+        }
+        return rdrCtx;
+    }
+
+    /**
+     * Reset and return the given DRendererContext instance for reuse
+     * @param rdrCtx DRendererContext instance
+     */
+    static void returnRendererContext(final DRendererContext rdrCtx) {
+        rdrCtx.dispose();
+
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_pre_getAATileGenerator.stop();
+        }
+        RDR_CTX_PROVIDER.release(rdrCtx);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DPathConsumer2D.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,78 @@
+/*
+ * 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.  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.java2d.marlin;
+
+public interface DPathConsumer2D {
+    /**
+     * @see java.awt.geom.Path2D.Float#moveTo
+     */
+    public void moveTo(double x, double y);
+
+    /**
+     * @see java.awt.geom.Path2D.Float#lineTo
+     */
+    public void lineTo(double x, double y);
+
+    /**
+     * @see java.awt.geom.Path2D.Float#quadTo
+     */
+    public void quadTo(double x1, double y1,
+                       double x2, double y2);
+
+    /**
+     * @see java.awt.geom.Path2D.Float#curveTo
+     */
+    public void curveTo(double x1, double y1,
+                        double x2, double y2,
+                        double x3, double y3);
+
+    /**
+     * @see java.awt.geom.Path2D.Float#closePath
+     */
+    public void closePath();
+
+    /**
+     * Called after the last segment of the last subpath when the
+     * iteration of the path segments is completely done.  This
+     * method serves to trigger the end of path processing in the
+     * consumer that would normally be triggered when a
+     * {@link java.awt.geom.PathIterator PathIterator}
+     * returns {@code true} from its {@code done} method.
+     */
+    public void pathDone();
+
+    /**
+     * If a given PathConsumer performs all or most of its work
+     * natively then it can return a (non-zero) pointer to a
+     * native function vector that defines C functions for all
+     * of the above methods.
+     * The specific pointer it returns is a pointer to a
+     * PathConsumerVec structure as defined in the include file
+     * src/share/native/sun/java2d/pipe/PathConsumer2D.h
+     * @return a native pointer to a PathConsumerVec structure.
+     */
+    public long getNativeConsumer();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DRenderer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,1526 @@
+/*
+ * 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.  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.java2d.marlin;
+
+import static sun.java2d.marlin.OffHeapArray.SIZE_INT;
+import jdk.internal.misc.Unsafe;
+
+final class DRenderer implements DPathConsumer2D, MarlinRenderer {
+
+    static final boolean DISABLE_RENDER = false;
+
+    static final boolean ENABLE_BLOCK_FLAGS = MarlinProperties.isUseTileFlags();
+    static final boolean ENABLE_BLOCK_FLAGS_HEURISTICS = MarlinProperties.isUseTileFlagsWithHeuristics();
+
+    private static final int ALL_BUT_LSB = 0xFFFFFFFE;
+    private static final int ERR_STEP_MAX = 0x7FFFFFFF; // = 2^31 - 1
+
+    private static final double POWER_2_TO_32 = 0x1.0p32d;
+
+    // use double to make tosubpix methods faster (no int to double conversion)
+    static final double SUBPIXEL_SCALE_X = SUBPIXEL_POSITIONS_X;
+    static final double SUBPIXEL_SCALE_Y = SUBPIXEL_POSITIONS_Y;
+    static final int SUBPIXEL_MASK_X = SUBPIXEL_POSITIONS_X - 1;
+    static final int SUBPIXEL_MASK_Y = SUBPIXEL_POSITIONS_Y - 1;
+
+    // number of subpixels corresponding to a tile line
+    private static final int SUBPIXEL_TILE
+        = TILE_H << SUBPIXEL_LG_POSITIONS_Y;
+
+    // 2048 (pixelSize) pixels (height) x 8 subpixels = 64K
+    static final int INITIAL_BUCKET_ARRAY
+        = INITIAL_PIXEL_DIM * SUBPIXEL_POSITIONS_Y;
+
+    // crossing capacity = edges count / 4 ~ 1024
+    static final int INITIAL_CROSSING_COUNT = INITIAL_EDGES_COUNT >> 2;
+
+    public static final int WIND_EVEN_ODD = 0;
+    public static final int WIND_NON_ZERO = 1;
+
+    // common to all types of input path segments.
+    // OFFSET as bytes
+    // only integer values:
+    public static final long OFF_CURX_OR  = 0;
+    public static final long OFF_ERROR    = OFF_CURX_OR  + SIZE_INT;
+    public static final long OFF_BUMP_X   = OFF_ERROR    + SIZE_INT;
+    public static final long OFF_BUMP_ERR = OFF_BUMP_X   + SIZE_INT;
+    public static final long OFF_NEXT     = OFF_BUMP_ERR + SIZE_INT;
+    public static final long OFF_YMAX     = OFF_NEXT     + SIZE_INT;
+
+    // size of one edge in bytes
+    public static final int SIZEOF_EDGE_BYTES = (int)(OFF_YMAX + SIZE_INT);
+
+    // curve break into lines
+    // cubic error in subpixels to decrement step
+    private static final double CUB_DEC_ERR_SUBPIX
+        = MarlinProperties.getCubicDecD2() * (NORM_SUBPIXELS / 8.0d); // 1 pixel
+    // cubic error in subpixels to increment step
+    private static final double CUB_INC_ERR_SUBPIX
+        = MarlinProperties.getCubicIncD1() * (NORM_SUBPIXELS / 8.0d); // 0.4 pixel
+
+    // TestNonAARasterization (JDK-8170879): cubics
+    // bad paths (59294/100000 == 59,29%, 94335 bad pixels (avg = 1,59), 3966 warnings (avg = 0,07)
+
+    // cubic bind length to decrement step
+    public static final double CUB_DEC_BND
+        = 8.0d * CUB_DEC_ERR_SUBPIX;
+    // cubic bind length to increment step
+    public static final double CUB_INC_BND
+        = 8.0d * CUB_INC_ERR_SUBPIX;
+
+    // cubic countlg
+    public static final int CUB_COUNT_LG = 2;
+    // cubic count = 2^countlg
+    private static final int CUB_COUNT = 1 << CUB_COUNT_LG;
+    // cubic count^2 = 4^countlg
+    private static final int CUB_COUNT_2 = 1 << (2 * CUB_COUNT_LG);
+    // cubic count^3 = 8^countlg
+    private static final int CUB_COUNT_3 = 1 << (3 * CUB_COUNT_LG);
+    // cubic dt = 1 / count
+    private static final double CUB_INV_COUNT = 1.0d / CUB_COUNT;
+    // cubic dt^2 = 1 / count^2 = 1 / 4^countlg
+    private static final double CUB_INV_COUNT_2 = 1.0d / CUB_COUNT_2;
+    // cubic dt^3 = 1 / count^3 = 1 / 8^countlg
+    private static final double CUB_INV_COUNT_3 = 1.0d / CUB_COUNT_3;
+
+    // quad break into lines
+    // quadratic error in subpixels
+    private static final double QUAD_DEC_ERR_SUBPIX
+        = MarlinProperties.getQuadDecD2() * (NORM_SUBPIXELS / 8.0d); // 0.5 pixel
+
+    // TestNonAARasterization (JDK-8170879): quads
+    // bad paths (62916/100000 == 62,92%, 103818 bad pixels (avg = 1,65), 6514 warnings (avg = 0,10)
+
+    // quadratic bind length to decrement step
+    public static final double QUAD_DEC_BND
+        = 8.0d * QUAD_DEC_ERR_SUBPIX;
+
+//////////////////////////////////////////////////////////////////////////////
+//  SCAN LINE
+//////////////////////////////////////////////////////////////////////////////
+    // crossings ie subpixel edge x coordinates
+    private int[] crossings;
+    // auxiliary storage for crossings (merge sort)
+    private int[] aux_crossings;
+
+    // indices into the segment pointer lists. They indicate the "active"
+    // sublist in the segment lists (the portion of the list that contains
+    // all the segments that cross the next scan line).
+    private int edgeCount;
+    private int[] edgePtrs;
+    // auxiliary storage for edge pointers (merge sort)
+    private int[] aux_edgePtrs;
+
+    // max used for both edgePtrs and crossings (stats only)
+    private int activeEdgeMaxUsed;
+
+    // crossings ref (dirty)
+    private final IntArrayCache.Reference crossings_ref;
+    // edgePtrs ref (dirty)
+    private final IntArrayCache.Reference edgePtrs_ref;
+    // merge sort initial arrays (large enough to satisfy most usages) (1024)
+    // aux_crossings ref (dirty)
+    private final IntArrayCache.Reference aux_crossings_ref;
+    // aux_edgePtrs ref (dirty)
+    private final IntArrayCache.Reference aux_edgePtrs_ref;
+
+//////////////////////////////////////////////////////////////////////////////
+//  EDGE LIST
+//////////////////////////////////////////////////////////////////////////////
+    private int edgeMinY = Integer.MAX_VALUE;
+    private int edgeMaxY = Integer.MIN_VALUE;
+    private double edgeMinX = Double.POSITIVE_INFINITY;
+    private double edgeMaxX = Double.NEGATIVE_INFINITY;
+
+    // edges [ints] stored in off-heap memory
+    private final OffHeapArray edges;
+
+    private int[] edgeBuckets;
+    private int[] edgeBucketCounts; // 2*newedges + (1 if pruning needed)
+    // used range for edgeBuckets / edgeBucketCounts
+    private int buckets_minY;
+    private int buckets_maxY;
+
+    // edgeBuckets ref (clean)
+    private final IntArrayCache.Reference edgeBuckets_ref;
+    // edgeBucketCounts ref (clean)
+    private final IntArrayCache.Reference edgeBucketCounts_ref;
+
+    // Flattens using adaptive forward differencing. This only carries out
+    // one iteration of the AFD loop. All it does is update AFD variables (i.e.
+    // X0, Y0, D*[X|Y], COUNT; not variables used for computing scanline crossings).
+    private void quadBreakIntoLinesAndAdd(double x0, double y0,
+                                          final DCurve c,
+                                          final double x2, final double y2)
+    {
+        int count = 1; // dt = 1 / count
+
+        // maximum(ddX|Y) = norm(dbx, dby) * dt^2 (= 1)
+        double maxDD = Math.abs(c.dbx) + Math.abs(c.dby);
+
+        final double _DEC_BND = QUAD_DEC_BND;
+
+        while (maxDD >= _DEC_BND) {
+            // divide step by half:
+            maxDD /= 4.0d; // error divided by 2^2 = 4
+
+            count <<= 1;
+            if (DO_STATS) {
+                rdrCtx.stats.stat_rdr_quadBreak_dec.add(count);
+            }
+        }
+
+        int nL = 0; // line count
+        if (count > 1) {
+            final double icount = 1.0d / count; // dt
+            final double icount2 = icount * icount; // dt^2
+
+            final double ddx = c.dbx * icount2;
+            final double ddy = c.dby * icount2;
+            double dx = c.bx * icount2 + c.cx * icount;
+            double dy = c.by * icount2 + c.cy * icount;
+
+            double x1, y1;
+
+            while (--count > 0) {
+                x1 = x0 + dx;
+                dx += ddx;
+                y1 = y0 + dy;
+                dy += ddy;
+
+                addLine(x0, y0, x1, y1);
+
+                if (DO_STATS) { nL++; }
+                x0 = x1;
+                y0 = y1;
+            }
+        }
+        addLine(x0, y0, x2, y2);
+
+        if (DO_STATS) {
+            rdrCtx.stats.stat_rdr_quadBreak.add(nL + 1);
+        }
+    }
+
+    // x0, y0 and x3,y3 are the endpoints of the curve. We could compute these
+    // using c.xat(0),c.yat(0) and c.xat(1),c.yat(1), but this might introduce
+    // numerical errors, and our callers already have the exact values.
+    // Another alternative would be to pass all the control points, and call
+    // c.set here, but then too many numbers are passed around.
+    private void curveBreakIntoLinesAndAdd(double x0, double y0,
+                                           final DCurve c,
+                                           final double x3, final double y3)
+    {
+        int count           = CUB_COUNT;
+        final double icount  = CUB_INV_COUNT;   // dt
+        final double icount2 = CUB_INV_COUNT_2; // dt^2
+        final double icount3 = CUB_INV_COUNT_3; // dt^3
+
+        // the dx and dy refer to forward differencing variables, not the last
+        // coefficients of the "points" polynomial
+        double dddx, dddy, ddx, ddy, dx, dy;
+        dddx = 2.0d * c.dax * icount3;
+        dddy = 2.0d * c.day * icount3;
+        ddx = dddx + c.dbx * icount2;
+        ddy = dddy + c.dby * icount2;
+        dx = c.ax * icount3 + c.bx * icount2 + c.cx * icount;
+        dy = c.ay * icount3 + c.by * icount2 + c.cy * icount;
+
+        // we use x0, y0 to walk the line
+        double x1 = x0, y1 = y0;
+        int nL = 0; // line count
+
+        final double _DEC_BND = CUB_DEC_BND;
+        final double _INC_BND = CUB_INC_BND;
+
+        while (count > 0) {
+            // divide step by half:
+            while (Math.abs(ddx) + Math.abs(ddy) >= _DEC_BND) {
+                dddx /= 8.0d;
+                dddy /= 8.0d;
+                ddx = ddx / 4.0d - dddx;
+                ddy = ddy / 4.0d - dddy;
+                dx = (dx - ddx) / 2.0d;
+                dy = (dy - ddy) / 2.0d;
+
+                count <<= 1;
+                if (DO_STATS) {
+                    rdrCtx.stats.stat_rdr_curveBreak_dec.add(count);
+                }
+            }
+
+            // double step:
+            // can only do this on even "count" values, because we must divide count by 2
+            while (count % 2 == 0
+                   && Math.abs(dx) + Math.abs(dy) <= _INC_BND)
+            {
+                dx = 2.0d * dx + ddx;
+                dy = 2.0d * dy + ddy;
+                ddx = 4.0d * (ddx + dddx);
+                ddy = 4.0d * (ddy + dddy);
+                dddx *= 8.0d;
+                dddy *= 8.0d;
+
+                count >>= 1;
+                if (DO_STATS) {
+                    rdrCtx.stats.stat_rdr_curveBreak_inc.add(count);
+                }
+            }
+            if (--count > 0) {
+                x1 += dx;
+                dx += ddx;
+                ddx += dddx;
+                y1 += dy;
+                dy += ddy;
+                ddy += dddy;
+            } else {
+                x1 = x3;
+                y1 = y3;
+            }
+
+            addLine(x0, y0, x1, y1);
+
+            if (DO_STATS) { nL++; }
+            x0 = x1;
+            y0 = y1;
+        }
+        if (DO_STATS) {
+            rdrCtx.stats.stat_rdr_curveBreak.add(nL);
+        }
+    }
+
+    private void addLine(double x1, double y1, double x2, double y2) {
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_addLine.start();
+        }
+        if (DO_STATS) {
+            rdrCtx.stats.stat_rdr_addLine.add(1);
+        }
+        int or = 1; // orientation of the line. 1 if y increases, 0 otherwise.
+        if (y2 < y1) {
+            or = 0;
+            double tmp = y2;
+            y2 = y1;
+            y1 = tmp;
+            tmp = x2;
+            x2 = x1;
+            x1 = tmp;
+        }
+
+        // convert subpixel coordinates [double] into pixel positions [int]
+
+        // The index of the pixel that holds the next HPC is at ceil(trueY - 0.5)
+        // Since y1 and y2 are biased by -0.5 in tosubpixy(), this is simply
+        // ceil(y1) or ceil(y2)
+        // upper integer (inclusive)
+        final int firstCrossing = FloatMath.max(FloatMath.ceil_int(y1), boundsMinY);
+
+        // note: use boundsMaxY (last Y exclusive) to compute correct coverage
+        // upper integer (exclusive)
+        final int lastCrossing  = FloatMath.min(FloatMath.ceil_int(y2), boundsMaxY);
+
+        /* skip horizontal lines in pixel space and clip edges
+           out of y range [boundsMinY; boundsMaxY] */
+        if (firstCrossing >= lastCrossing) {
+            if (DO_MONITORS) {
+                rdrCtx.stats.mon_rdr_addLine.stop();
+            }
+            if (DO_STATS) {
+                rdrCtx.stats.stat_rdr_addLine_skip.add(1);
+            }
+            return;
+        }
+
+        // edge min/max X/Y are in subpixel space (half-open interval):
+        // note: Use integer crossings to ensure consistent range within
+        // edgeBuckets / edgeBucketCounts arrays in case of NaN values (int = 0)
+        if (firstCrossing < edgeMinY) {
+            edgeMinY = firstCrossing;
+        }
+        if (lastCrossing > edgeMaxY) {
+            edgeMaxY = lastCrossing;
+        }
+
+        final double slope = (x1 - x2) / (y1 - y2);
+
+        if (slope >= 0.0d) { // <==> x1 < x2
+            if (x1 < edgeMinX) {
+                edgeMinX = x1;
+            }
+            if (x2 > edgeMaxX) {
+                edgeMaxX = x2;
+            }
+        } else {
+            if (x2 < edgeMinX) {
+                edgeMinX = x2;
+            }
+            if (x1 > edgeMaxX) {
+                edgeMaxX = x1;
+            }
+        }
+
+        // local variables for performance:
+        final int _SIZEOF_EDGE_BYTES = SIZEOF_EDGE_BYTES;
+
+        final OffHeapArray _edges = edges;
+
+        // get free pointer (ie length in bytes)
+        final int edgePtr = _edges.used;
+
+        // use substraction to avoid integer overflow:
+        if (_edges.length - edgePtr < _SIZEOF_EDGE_BYTES) {
+            // suppose _edges.length > _SIZEOF_EDGE_BYTES
+            // so doubling size is enough to add needed bytes
+            // note: throw IOOB if neededSize > 2Gb:
+            final long edgeNewSize = ArrayCacheConst.getNewLargeSize(
+                                        _edges.length,
+                                        edgePtr + _SIZEOF_EDGE_BYTES);
+
+            if (DO_STATS) {
+                rdrCtx.stats.stat_rdr_edges_resizes.add(edgeNewSize);
+            }
+            _edges.resize(edgeNewSize);
+        }
+
+
+        final Unsafe _unsafe = OffHeapArray.UNSAFE;
+        final long SIZE_INT = 4L;
+        long addr   = _edges.address + edgePtr;
+
+        // The x value must be bumped up to its position at the next HPC we will evaluate.
+        // "firstcrossing" is the (sub)pixel number where the next crossing occurs
+        // thus, the actual coordinate of the next HPC is "firstcrossing + 0.5"
+        // so the Y distance we cover is "firstcrossing + 0.5 - trueY".
+        // Note that since y1 (and y2) are already biased by -0.5 in tosubpixy(), we have
+        // y1 = trueY - 0.5
+        // trueY = y1 + 0.5
+        // firstcrossing + 0.5 - trueY = firstcrossing + 0.5 - (y1 + 0.5)
+        //                             = firstcrossing - y1
+        // The x coordinate at that HPC is then:
+        // x1_intercept = x1 + (firstcrossing - y1) * slope
+        // The next VPC is then given by:
+        // VPC index = ceil(x1_intercept - 0.5), or alternately
+        // VPC index = floor(x1_intercept - 0.5 + 1 - epsilon)
+        // epsilon is hard to pin down in floating point, but easy in fixed point, so if
+        // we convert to fixed point then these operations get easier:
+        // long x1_fixed = x1_intercept * 2^32;  (fixed point 32.32 format)
+        // curx = next VPC = fixed_floor(x1_fixed - 2^31 + 2^32 - 1)
+        //                 = fixed_floor(x1_fixed + 2^31 - 1)
+        //                 = fixed_floor(x1_fixed + 0x7FFFFFFF)
+        // and error       = fixed_fract(x1_fixed + 0x7FFFFFFF)
+        final double x1_intercept = x1 + (firstCrossing - y1) * slope;
+
+        // inlined scalb(x1_intercept, 32):
+        final long x1_fixed_biased = ((long) (POWER_2_TO_32 * x1_intercept))
+                                     + 0x7FFFFFFFL;
+        // curx:
+        // last bit corresponds to the orientation
+        _unsafe.putInt(addr, (((int) (x1_fixed_biased >> 31L)) & ALL_BUT_LSB) | or);
+        addr += SIZE_INT;
+        _unsafe.putInt(addr,  ((int)  x1_fixed_biased) >>> 1);
+        addr += SIZE_INT;
+
+        // inlined scalb(slope, 32):
+        final long slope_fixed = (long) (POWER_2_TO_32 * slope);
+
+        // last bit set to 0 to keep orientation:
+        _unsafe.putInt(addr, (((int) (slope_fixed >> 31L)) & ALL_BUT_LSB));
+        addr += SIZE_INT;
+        _unsafe.putInt(addr,  ((int)  slope_fixed) >>> 1);
+        addr += SIZE_INT;
+
+        final int[] _edgeBuckets      = edgeBuckets;
+        final int[] _edgeBucketCounts = edgeBucketCounts;
+
+        final int _boundsMinY = boundsMinY;
+
+        // each bucket is a linked list. this method adds ptr to the
+        // start of the "bucket"th linked list.
+        final int bucketIdx = firstCrossing - _boundsMinY;
+
+        // pointer from bucket
+        _unsafe.putInt(addr, _edgeBuckets[bucketIdx]);
+        addr += SIZE_INT;
+        // y max (exclusive)
+        _unsafe.putInt(addr,  lastCrossing);
+
+        // Update buckets:
+        // directly the edge struct "pointer"
+        _edgeBuckets[bucketIdx]       = edgePtr;
+        _edgeBucketCounts[bucketIdx] += 2; // 1 << 1
+        // last bit means edge end
+        _edgeBucketCounts[lastCrossing - _boundsMinY] |= 0x1;
+
+        // update free pointer (ie length in bytes)
+        _edges.used += _SIZEOF_EDGE_BYTES;
+
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_addLine.stop();
+        }
+    }
+
+// END EDGE LIST
+//////////////////////////////////////////////////////////////////////////////
+
+    // Cache to store RLE-encoded coverage mask of the current primitive
+    final MarlinCache cache;
+
+    // Bounds of the drawing region, at subpixel precision.
+    private int boundsMinX, boundsMinY, boundsMaxX, boundsMaxY;
+
+    // Current winding rule
+    private int windingRule;
+
+    // Current drawing position, i.e., final point of last segment
+    private double x0, y0;
+
+    // Position of most recent 'moveTo' command
+    private double sx0, sy0;
+
+    // per-thread renderer context
+    final DRendererContext rdrCtx;
+    // dirty curve
+    private final DCurve curve;
+
+    // clean alpha array (zero filled)
+    private int[] alphaLine;
+
+    // alphaLine ref (clean)
+    private final IntArrayCache.Reference alphaLine_ref;
+
+    private boolean enableBlkFlags = false;
+    private boolean prevUseBlkFlags = false;
+
+    /* block flags (0|1) */
+    private int[] blkFlags;
+
+    // blkFlags ref (clean)
+    private final IntArrayCache.Reference blkFlags_ref;
+
+    DRenderer(final DRendererContext rdrCtx) {
+        this.rdrCtx = rdrCtx;
+
+        this.edges = rdrCtx.newOffHeapArray(INITIAL_EDGES_CAPACITY); // 96K
+
+        this.curve = rdrCtx.curve;
+
+        edgeBuckets_ref      = rdrCtx.newCleanIntArrayRef(INITIAL_BUCKET_ARRAY); // 64K
+        edgeBucketCounts_ref = rdrCtx.newCleanIntArrayRef(INITIAL_BUCKET_ARRAY); // 64K
+
+        edgeBuckets      = edgeBuckets_ref.initial;
+        edgeBucketCounts = edgeBucketCounts_ref.initial;
+
+        // 2048 (pixelsize) pixel large
+        alphaLine_ref = rdrCtx.newCleanIntArrayRef(INITIAL_AA_ARRAY); // 8K
+        alphaLine     = alphaLine_ref.initial;
+
+        this.cache = rdrCtx.cache;
+
+        crossings_ref     = rdrCtx.newDirtyIntArrayRef(INITIAL_CROSSING_COUNT); // 2K
+        aux_crossings_ref = rdrCtx.newDirtyIntArrayRef(INITIAL_CROSSING_COUNT); // 2K
+        edgePtrs_ref      = rdrCtx.newDirtyIntArrayRef(INITIAL_CROSSING_COUNT); // 2K
+        aux_edgePtrs_ref  = rdrCtx.newDirtyIntArrayRef(INITIAL_CROSSING_COUNT); // 2K
+
+        crossings     = crossings_ref.initial;
+        aux_crossings = aux_crossings_ref.initial;
+        edgePtrs      = edgePtrs_ref.initial;
+        aux_edgePtrs  = aux_edgePtrs_ref.initial;
+
+        blkFlags_ref = rdrCtx.newCleanIntArrayRef(INITIAL_ARRAY); // 1K = 1 tile line
+        blkFlags     = blkFlags_ref.initial;
+    }
+
+    DRenderer init(final int pix_boundsX, final int pix_boundsY,
+                  final int pix_boundsWidth, final int pix_boundsHeight,
+                  final int windingRule)
+    {
+        this.windingRule = windingRule;
+
+        // bounds as half-open intervals: minX <= x < maxX and minY <= y < maxY
+        this.boundsMinX =  pix_boundsX << SUBPIXEL_LG_POSITIONS_X;
+        this.boundsMaxX =
+            (pix_boundsX + pix_boundsWidth) << SUBPIXEL_LG_POSITIONS_X;
+        this.boundsMinY =  pix_boundsY << SUBPIXEL_LG_POSITIONS_Y;
+        this.boundsMaxY =
+            (pix_boundsY + pix_boundsHeight) << SUBPIXEL_LG_POSITIONS_Y;
+
+        if (DO_LOG_BOUNDS) {
+            MarlinUtils.logInfo("boundsXY = [" + boundsMinX + " ... "
+                                + boundsMaxX + "[ [" + boundsMinY + " ... "
+                                + boundsMaxY + "[");
+        }
+
+        // see addLine: ceil(boundsMaxY) => boundsMaxY + 1
+        // +1 for edgeBucketCounts
+        final int edgeBucketsLength = (boundsMaxY - boundsMinY) + 1;
+
+        if (edgeBucketsLength > INITIAL_BUCKET_ARRAY) {
+            if (DO_STATS) {
+                rdrCtx.stats.stat_array_renderer_edgeBuckets
+                    .add(edgeBucketsLength);
+                rdrCtx.stats.stat_array_renderer_edgeBucketCounts
+                    .add(edgeBucketsLength);
+            }
+            edgeBuckets = edgeBuckets_ref.getArray(edgeBucketsLength);
+            edgeBucketCounts = edgeBucketCounts_ref.getArray(edgeBucketsLength);
+        }
+
+        edgeMinY = Integer.MAX_VALUE;
+        edgeMaxY = Integer.MIN_VALUE;
+        edgeMinX = Double.POSITIVE_INFINITY;
+        edgeMaxX = Double.NEGATIVE_INFINITY;
+
+        // reset used mark:
+        edgeCount = 0;
+        activeEdgeMaxUsed = 0;
+        edges.used = 0;
+
+        return this; // fluent API
+    }
+
+    /**
+     * Disposes this renderer and recycle it clean up before reusing this instance
+     */
+    void dispose() {
+        if (DO_STATS) {
+            rdrCtx.stats.stat_rdr_activeEdges.add(activeEdgeMaxUsed);
+            rdrCtx.stats.stat_rdr_edges.add(edges.used);
+            rdrCtx.stats.stat_rdr_edges_count.add(edges.used / SIZEOF_EDGE_BYTES);
+            rdrCtx.stats.hist_rdr_edges_count.add(edges.used / SIZEOF_EDGE_BYTES);
+            rdrCtx.stats.totalOffHeap += edges.length;
+        }
+        // Return arrays:
+        crossings = crossings_ref.putArray(crossings);
+        aux_crossings = aux_crossings_ref.putArray(aux_crossings);
+
+        edgePtrs = edgePtrs_ref.putArray(edgePtrs);
+        aux_edgePtrs = aux_edgePtrs_ref.putArray(aux_edgePtrs);
+
+        alphaLine = alphaLine_ref.putArray(alphaLine, 0, 0); // already zero filled
+        blkFlags  = blkFlags_ref.putArray(blkFlags, 0, 0); // already zero filled
+
+        if (edgeMinY != Integer.MAX_VALUE) {
+            // if context is maked as DIRTY:
+            if (rdrCtx.dirty) {
+                // may happen if an exception if thrown in the pipeline processing:
+                // clear completely buckets arrays:
+                buckets_minY = 0;
+                buckets_maxY = boundsMaxY - boundsMinY;
+            }
+            // clear only used part
+            edgeBuckets = edgeBuckets_ref.putArray(edgeBuckets, buckets_minY,
+                                                                buckets_maxY);
+            edgeBucketCounts = edgeBucketCounts_ref.putArray(edgeBucketCounts,
+                                                             buckets_minY,
+                                                             buckets_maxY + 1);
+        } else {
+            // unused arrays
+            edgeBuckets = edgeBuckets_ref.putArray(edgeBuckets, 0, 0);
+            edgeBucketCounts = edgeBucketCounts_ref.putArray(edgeBucketCounts, 0, 0);
+        }
+
+        // At last: resize back off-heap edges to initial size
+        if (edges.length != INITIAL_EDGES_CAPACITY) {
+            // note: may throw OOME:
+            edges.resize(INITIAL_EDGES_CAPACITY);
+        }
+        if (DO_CLEAN_DIRTY) {
+            // Force zero-fill dirty arrays:
+            edges.fill(BYTE_0);
+        }
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_endRendering.stop();
+        }
+        // recycle the RendererContext instance
+        DMarlinRenderingEngine.returnRendererContext(rdrCtx);
+    }
+
+    private static double tosubpixx(final double pix_x) {
+        return SUBPIXEL_SCALE_X * pix_x;
+    }
+
+    private static double tosubpixy(final double pix_y) {
+        // shift y by -0.5 for fast ceil(y - 0.5):
+        return SUBPIXEL_SCALE_Y * pix_y - 0.5d;
+    }
+
+    @Override
+    public void moveTo(double pix_x0, double pix_y0) {
+        closePath();
+        final double sx = tosubpixx(pix_x0);
+        final double sy = tosubpixy(pix_y0);
+        this.sx0 = sx;
+        this.sy0 = sy;
+        this.x0 = sx;
+        this.y0 = sy;
+    }
+
+    @Override
+    public void lineTo(double pix_x1, double pix_y1) {
+        final double x1 = tosubpixx(pix_x1);
+        final double y1 = tosubpixy(pix_y1);
+        addLine(x0, y0, x1, y1);
+        x0 = x1;
+        y0 = y1;
+    }
+
+    @Override
+    public void curveTo(double x1, double y1,
+                        double x2, double y2,
+                        double x3, double y3)
+    {
+        final double xe = tosubpixx(x3);
+        final double ye = tosubpixy(y3);
+        curve.set(x0, y0, tosubpixx(x1), tosubpixy(y1),
+                          tosubpixx(x2), tosubpixy(y2), xe, ye);
+        curveBreakIntoLinesAndAdd(x0, y0, curve, xe, ye);
+        x0 = xe;
+        y0 = ye;
+    }
+
+    @Override
+    public void quadTo(double x1, double y1, double x2, double y2) {
+        final double xe = tosubpixx(x2);
+        final double ye = tosubpixy(y2);
+        curve.set(x0, y0, tosubpixx(x1), tosubpixy(y1), xe, ye);
+        quadBreakIntoLinesAndAdd(x0, y0, curve, xe, ye);
+        x0 = xe;
+        y0 = ye;
+    }
+
+    @Override
+    public void closePath() {
+        addLine(x0, y0, sx0, sy0);
+        x0 = sx0;
+        y0 = sy0;
+    }
+
+    @Override
+    public void pathDone() {
+        closePath();
+    }
+
+    @Override
+    public long getNativeConsumer() {
+        throw new InternalError("Renderer does not use a native consumer.");
+    }
+
+    private void _endRendering(final int ymin, final int ymax) {
+        if (DISABLE_RENDER) {
+            return;
+        }
+
+        // Get X bounds as true pixel boundaries to compute correct pixel coverage:
+        final int bboxx0 = bbox_spminX;
+        final int bboxx1 = bbox_spmaxX;
+
+        final boolean windingRuleEvenOdd = (windingRule == WIND_EVEN_ODD);
+
+        // Useful when processing tile line by tile line
+        final int[] _alpha = alphaLine;
+
+        // local vars (performance):
+        final MarlinCache _cache = cache;
+        final OffHeapArray _edges = edges;
+        final int[] _edgeBuckets = edgeBuckets;
+        final int[] _edgeBucketCounts = edgeBucketCounts;
+
+        int[] _crossings = this.crossings;
+        int[] _edgePtrs  = this.edgePtrs;
+
+        // merge sort auxiliary storage:
+        int[] _aux_crossings = this.aux_crossings;
+        int[] _aux_edgePtrs  = this.aux_edgePtrs;
+
+        // copy constants:
+        final long _OFF_ERROR    = OFF_ERROR;
+        final long _OFF_BUMP_X   = OFF_BUMP_X;
+        final long _OFF_BUMP_ERR = OFF_BUMP_ERR;
+
+        final long _OFF_NEXT     = OFF_NEXT;
+        final long _OFF_YMAX     = OFF_YMAX;
+
+        final int _ALL_BUT_LSB   = ALL_BUT_LSB;
+        final int _ERR_STEP_MAX  = ERR_STEP_MAX;
+
+        // unsafe I/O:
+        final Unsafe _unsafe = OffHeapArray.UNSAFE;
+        final long    addr0  = _edges.address;
+        long addr;
+        final int _SUBPIXEL_LG_POSITIONS_X = SUBPIXEL_LG_POSITIONS_X;
+        final int _SUBPIXEL_LG_POSITIONS_Y = SUBPIXEL_LG_POSITIONS_Y;
+        final int _SUBPIXEL_MASK_X = SUBPIXEL_MASK_X;
+        final int _SUBPIXEL_MASK_Y = SUBPIXEL_MASK_Y;
+        final int _SUBPIXEL_POSITIONS_X = SUBPIXEL_POSITIONS_X;
+
+        final int _MIN_VALUE = Integer.MIN_VALUE;
+        final int _MAX_VALUE = Integer.MAX_VALUE;
+
+        // Now we iterate through the scanlines. We must tell emitRow the coord
+        // of the first non-transparent pixel, so we must keep accumulators for
+        // the first and last pixels of the section of the current pixel row
+        // that we will emit.
+        // We also need to accumulate pix_bbox, but the iterator does it
+        // for us. We will just get the values from it once this loop is done
+        int minX = _MAX_VALUE;
+        int maxX = _MIN_VALUE;
+
+        int y = ymin;
+        int bucket = y - boundsMinY;
+
+        int numCrossings = this.edgeCount;
+        int edgePtrsLen = _edgePtrs.length;
+        int crossingsLen = _crossings.length;
+        int _arrayMaxUsed = activeEdgeMaxUsed;
+        int ptrLen = 0, newCount, ptrEnd;
+
+        int bucketcount, i, j, ecur;
+        int cross, lastCross;
+        int x0, x1, tmp, sum, prev, curx, curxo, crorientation, err;
+        int pix_x, pix_xmaxm1, pix_xmax;
+
+        int low, high, mid, prevNumCrossings;
+        boolean useBinarySearch;
+
+        final int[] _blkFlags = blkFlags;
+        final int _BLK_SIZE_LG = BLOCK_SIZE_LG;
+        final int _BLK_SIZE = BLOCK_SIZE;
+
+        final boolean _enableBlkFlagsHeuristics = ENABLE_BLOCK_FLAGS_HEURISTICS && this.enableBlkFlags;
+
+        // Use block flags if large pixel span and few crossings:
+        // ie mean(distance between crossings) is high
+        boolean useBlkFlags = this.prevUseBlkFlags;
+
+        final int stroking = rdrCtx.stroking;
+
+        int lastY = -1; // last emited row
+
+
+        // Iteration on scanlines
+        for (; y < ymax; y++, bucket++) {
+            // --- from former ScanLineIterator.next()
+            bucketcount = _edgeBucketCounts[bucket];
+
+            // marker on previously sorted edges:
+            prevNumCrossings = numCrossings;
+
+            // bucketCount indicates new edge / edge end:
+            if (bucketcount != 0) {
+                if (DO_STATS) {
+                    rdrCtx.stats.stat_rdr_activeEdges_updates.add(numCrossings);
+                }
+
+                // last bit set to 1 means that edges ends
+                if ((bucketcount & 0x1) != 0) {
+                    // eviction in active edge list
+                    // cache edges[] address + offset
+                    addr = addr0 + _OFF_YMAX;
+
+                    for (i = 0, newCount = 0; i < numCrossings; i++) {
+                        // get the pointer to the edge
+                        ecur = _edgePtrs[i];
+                        // random access so use unsafe:
+                        if (_unsafe.getInt(addr + ecur) > y) {
+                            _edgePtrs[newCount++] = ecur;
+                        }
+                    }
+                    // update marker on sorted edges minus removed edges:
+                    prevNumCrossings = numCrossings = newCount;
+                }
+
+                ptrLen = bucketcount >> 1; // number of new edge
+
+                if (ptrLen != 0) {
+                    if (DO_STATS) {
+                        rdrCtx.stats.stat_rdr_activeEdges_adds.add(ptrLen);
+                        if (ptrLen > 10) {
+                            rdrCtx.stats.stat_rdr_activeEdges_adds_high.add(ptrLen);
+                        }
+                    }
+                    ptrEnd = numCrossings + ptrLen;
+
+                    if (edgePtrsLen < ptrEnd) {
+                        if (DO_STATS) {
+                            rdrCtx.stats.stat_array_renderer_edgePtrs.add(ptrEnd);
+                        }
+                        this.edgePtrs = _edgePtrs
+                            = edgePtrs_ref.widenArray(_edgePtrs, numCrossings,
+                                                      ptrEnd);
+
+                        edgePtrsLen = _edgePtrs.length;
+                        // Get larger auxiliary storage:
+                        aux_edgePtrs_ref.putArray(_aux_edgePtrs);
+
+                        // use ArrayCache.getNewSize() to use the same growing
+                        // factor than widenArray():
+                        if (DO_STATS) {
+                            rdrCtx.stats.stat_array_renderer_aux_edgePtrs.add(ptrEnd);
+                        }
+                        this.aux_edgePtrs = _aux_edgePtrs
+                            = aux_edgePtrs_ref.getArray(
+                                ArrayCacheConst.getNewSize(numCrossings, ptrEnd)
+                            );
+                    }
+
+                    // cache edges[] address + offset
+                    addr = addr0 + _OFF_NEXT;
+
+                    // add new edges to active edge list:
+                    for (ecur = _edgeBuckets[bucket];
+                         numCrossings < ptrEnd; numCrossings++)
+                    {
+                        // store the pointer to the edge
+                        _edgePtrs[numCrossings] = ecur;
+                        // random access so use unsafe:
+                        ecur = _unsafe.getInt(addr + ecur);
+                    }
+
+                    if (crossingsLen < numCrossings) {
+                        // Get larger array:
+                        crossings_ref.putArray(_crossings);
+
+                        if (DO_STATS) {
+                            rdrCtx.stats.stat_array_renderer_crossings
+                                .add(numCrossings);
+                        }
+                        this.crossings = _crossings
+                            = crossings_ref.getArray(numCrossings);
+
+                        // Get larger auxiliary storage:
+                        aux_crossings_ref.putArray(_aux_crossings);
+
+                        if (DO_STATS) {
+                            rdrCtx.stats.stat_array_renderer_aux_crossings
+                                .add(numCrossings);
+                        }
+                        this.aux_crossings = _aux_crossings
+                            = aux_crossings_ref.getArray(numCrossings);
+
+                        crossingsLen = _crossings.length;
+                    }
+                    if (DO_STATS) {
+                        // update max used mark
+                        if (numCrossings > _arrayMaxUsed) {
+                            _arrayMaxUsed = numCrossings;
+                        }
+                    }
+                } // ptrLen != 0
+            } // bucketCount != 0
+
+
+            if (numCrossings != 0) {
+                /*
+                 * thresholds to switch to optimized merge sort
+                 * for newly added edges + final merge pass.
+                 */
+                if ((ptrLen < 10) || (numCrossings < 40)) {
+                    if (DO_STATS) {
+                        rdrCtx.stats.hist_rdr_crossings.add(numCrossings);
+                        rdrCtx.stats.hist_rdr_crossings_adds.add(ptrLen);
+                    }
+
+                    /*
+                     * threshold to use binary insertion sort instead of
+                     * straight insertion sort (to reduce minimize comparisons).
+                     */
+                    useBinarySearch = (numCrossings >= 20);
+
+                    // if small enough:
+                    lastCross = _MIN_VALUE;
+
+                    for (i = 0; i < numCrossings; i++) {
+                        // get the pointer to the edge
+                        ecur = _edgePtrs[i];
+
+                        /* convert subpixel coordinates into pixel
+                            positions for coming scanline */
+                        /* note: it is faster to always update edges even
+                           if it is removed from AEL for coming or last scanline */
+
+                        // random access so use unsafe:
+                        addr = addr0 + ecur; // ecur + OFF_F_CURX
+
+                        // get current crossing:
+                        curx = _unsafe.getInt(addr);
+
+                        // update crossing with orientation at last bit:
+                        cross = curx;
+
+                        // Increment x using DDA (fixed point):
+                        curx += _unsafe.getInt(addr + _OFF_BUMP_X);
+
+                        // Increment error:
+                        err  =  _unsafe.getInt(addr + _OFF_ERROR)
+                              + _unsafe.getInt(addr + _OFF_BUMP_ERR);
+
+                        // Manual carry handling:
+                        // keep sign and carry bit only and ignore last bit (preserve orientation):
+                        _unsafe.putInt(addr,               curx - ((err >> 30) & _ALL_BUT_LSB));
+                        _unsafe.putInt(addr + _OFF_ERROR, (err & _ERR_STEP_MAX));
+
+                        if (DO_STATS) {
+                            rdrCtx.stats.stat_rdr_crossings_updates.add(numCrossings);
+                        }
+
+                        // insertion sort of crossings:
+                        if (cross < lastCross) {
+                            if (DO_STATS) {
+                                rdrCtx.stats.stat_rdr_crossings_sorts.add(i);
+                            }
+
+                            /* use binary search for newly added edges
+                               in crossings if arrays are large enough */
+                            if (useBinarySearch && (i >= prevNumCrossings)) {
+                                if (DO_STATS) {
+                                    rdrCtx.stats.stat_rdr_crossings_bsearch.add(i);
+                                }
+                                low = 0;
+                                high = i - 1;
+
+                                do {
+                                    // note: use signed shift (not >>>) for performance
+                                    // as indices are small enough to exceed Integer.MAX_VALUE
+                                    mid = (low + high) >> 1;
+
+                                    if (_crossings[mid] < cross) {
+                                        low = mid + 1;
+                                    } else {
+                                        high = mid - 1;
+                                    }
+                                } while (low <= high);
+
+                                for (j = i - 1; j >= low; j--) {
+                                    _crossings[j + 1] = _crossings[j];
+                                    _edgePtrs [j + 1] = _edgePtrs[j];
+                                }
+                                _crossings[low] = cross;
+                                _edgePtrs [low] = ecur;
+
+                            } else {
+                                j = i - 1;
+                                _crossings[i] = _crossings[j];
+                                _edgePtrs[i] = _edgePtrs[j];
+
+                                while ((--j >= 0) && (_crossings[j] > cross)) {
+                                    _crossings[j + 1] = _crossings[j];
+                                    _edgePtrs [j + 1] = _edgePtrs[j];
+                                }
+                                _crossings[j + 1] = cross;
+                                _edgePtrs [j + 1] = ecur;
+                            }
+
+                        } else {
+                            _crossings[i] = lastCross = cross;
+                        }
+                    }
+                } else {
+                    if (DO_STATS) {
+                        rdrCtx.stats.stat_rdr_crossings_msorts.add(numCrossings);
+                        rdrCtx.stats.hist_rdr_crossings_ratio
+                            .add((1000 * ptrLen) / numCrossings);
+                        rdrCtx.stats.hist_rdr_crossings_msorts.add(numCrossings);
+                        rdrCtx.stats.hist_rdr_crossings_msorts_adds.add(ptrLen);
+                    }
+
+                    // Copy sorted data in auxiliary arrays
+                    // and perform insertion sort on almost sorted data
+                    // (ie i < prevNumCrossings):
+
+                    lastCross = _MIN_VALUE;
+
+                    for (i = 0; i < numCrossings; i++) {
+                        // get the pointer to the edge
+                        ecur = _edgePtrs[i];
+
+                        /* convert subpixel coordinates into pixel
+                            positions for coming scanline */
+                        /* note: it is faster to always update edges even
+                           if it is removed from AEL for coming or last scanline */
+
+                        // random access so use unsafe:
+                        addr = addr0 + ecur; // ecur + OFF_F_CURX
+
+                        // get current crossing:
+                        curx = _unsafe.getInt(addr);
+
+                        // update crossing with orientation at last bit:
+                        cross = curx;
+
+                        // Increment x using DDA (fixed point):
+                        curx += _unsafe.getInt(addr + _OFF_BUMP_X);
+
+                        // Increment error:
+                        err  =  _unsafe.getInt(addr + _OFF_ERROR)
+                              + _unsafe.getInt(addr + _OFF_BUMP_ERR);
+
+                        // Manual carry handling:
+                        // keep sign and carry bit only and ignore last bit (preserve orientation):
+                        _unsafe.putInt(addr,               curx - ((err >> 30) & _ALL_BUT_LSB));
+                        _unsafe.putInt(addr + _OFF_ERROR, (err & _ERR_STEP_MAX));
+
+                        if (DO_STATS) {
+                            rdrCtx.stats.stat_rdr_crossings_updates.add(numCrossings);
+                        }
+
+                        if (i >= prevNumCrossings) {
+                            // simply store crossing as edgePtrs is in-place:
+                            // will be copied and sorted efficiently by mergesort later:
+                            _crossings[i]     = cross;
+
+                        } else if (cross < lastCross) {
+                            if (DO_STATS) {
+                                rdrCtx.stats.stat_rdr_crossings_sorts.add(i);
+                            }
+
+                            // (straight) insertion sort of crossings:
+                            j = i - 1;
+                            _aux_crossings[i] = _aux_crossings[j];
+                            _aux_edgePtrs[i] = _aux_edgePtrs[j];
+
+                            while ((--j >= 0) && (_aux_crossings[j] > cross)) {
+                                _aux_crossings[j + 1] = _aux_crossings[j];
+                                _aux_edgePtrs [j + 1] = _aux_edgePtrs[j];
+                            }
+                            _aux_crossings[j + 1] = cross;
+                            _aux_edgePtrs [j + 1] = ecur;
+
+                        } else {
+                            // auxiliary storage:
+                            _aux_crossings[i] = lastCross = cross;
+                            _aux_edgePtrs [i] = ecur;
+                        }
+                    }
+
+                    // use Mergesort using auxiliary arrays (sort only right part)
+                    MergeSort.mergeSortNoCopy(_crossings,     _edgePtrs,
+                                              _aux_crossings, _aux_edgePtrs,
+                                              numCrossings,   prevNumCrossings);
+                }
+
+                // reset ptrLen
+                ptrLen = 0;
+                // --- from former ScanLineIterator.next()
+
+
+                /* note: bboxx0 and bboxx1 must be pixel boundaries
+                   to have correct coverage computation */
+
+                // right shift on crossings to get the x-coordinate:
+                curxo = _crossings[0];
+                x0    = curxo >> 1;
+                if (x0 < minX) {
+                    minX = x0; // subpixel coordinate
+                }
+
+                x1 = _crossings[numCrossings - 1] >> 1;
+                if (x1 > maxX) {
+                    maxX = x1; // subpixel coordinate
+                }
+
+
+                // compute pixel coverages
+                prev = curx = x0;
+                // to turn {0, 1} into {-1, 1}, multiply by 2 and subtract 1.
+                // last bit contains orientation (0 or 1)
+                crorientation = ((curxo & 0x1) << 1) - 1;
+
+                if (windingRuleEvenOdd) {
+                    sum = crorientation;
+
+                    // Even Odd winding rule: take care of mask ie sum(orientations)
+                    for (i = 1; i < numCrossings; i++) {
+                        curxo = _crossings[i];
+                        curx  =  curxo >> 1;
+                        // to turn {0, 1} into {-1, 1}, multiply by 2 and subtract 1.
+                        // last bit contains orientation (0 or 1)
+                        crorientation = ((curxo & 0x1) << 1) - 1;
+
+                        if ((sum & 0x1) != 0) {
+                            // TODO: perform line clipping on left-right sides
+                            // to avoid such bound checks:
+                            x0 = (prev > bboxx0) ? prev : bboxx0;
+
+                            if (curx < bboxx1) {
+                                x1 = curx;
+                            } else {
+                                x1 = bboxx1;
+                                // skip right side (fast exit loop):
+                                i = numCrossings;
+                            }
+
+                            if (x0 < x1) {
+                                x0 -= bboxx0; // turn x0, x1 from coords to indices
+                                x1 -= bboxx0; // in the alpha array.
+
+                                pix_x      =  x0      >> _SUBPIXEL_LG_POSITIONS_X;
+                                pix_xmaxm1 = (x1 - 1) >> _SUBPIXEL_LG_POSITIONS_X;
+
+                                if (pix_x == pix_xmaxm1) {
+                                    // Start and end in same pixel
+                                    tmp = (x1 - x0); // number of subpixels
+                                    _alpha[pix_x    ] += tmp;
+                                    _alpha[pix_x + 1] -= tmp;
+
+                                    if (useBlkFlags) {
+                                        // flag used blocks:
+                                        // note: block processing handles extra pixel:
+                                        _blkFlags[pix_x    >> _BLK_SIZE_LG] = 1;
+                                    }
+                                } else {
+                                    tmp = (x0 & _SUBPIXEL_MASK_X);
+                                    _alpha[pix_x    ]
+                                        += (_SUBPIXEL_POSITIONS_X - tmp);
+                                    _alpha[pix_x + 1]
+                                        += tmp;
+
+                                    pix_xmax = x1 >> _SUBPIXEL_LG_POSITIONS_X;
+
+                                    tmp = (x1 & _SUBPIXEL_MASK_X);
+                                    _alpha[pix_xmax    ]
+                                        -= (_SUBPIXEL_POSITIONS_X - tmp);
+                                    _alpha[pix_xmax + 1]
+                                        -= tmp;
+
+                                    if (useBlkFlags) {
+                                        // flag used blocks:
+                                        // note: block processing handles extra pixel:
+                                        _blkFlags[pix_x    >> _BLK_SIZE_LG] = 1;
+                                        _blkFlags[pix_xmax >> _BLK_SIZE_LG] = 1;
+                                    }
+                                }
+                            }
+                        }
+
+                        sum += crorientation;
+                        prev = curx;
+                    }
+                } else {
+                    // Non-zero winding rule: optimize that case (default)
+                    // and avoid processing intermediate crossings
+                    for (i = 1, sum = 0;; i++) {
+                        sum += crorientation;
+
+                        if (sum != 0) {
+                            // prev = min(curx)
+                            if (prev > curx) {
+                                prev = curx;
+                            }
+                        } else {
+                            // TODO: perform line clipping on left-right sides
+                            // to avoid such bound checks:
+                            x0 = (prev > bboxx0) ? prev : bboxx0;
+
+                            if (curx < bboxx1) {
+                                x1 = curx;
+                            } else {
+                                x1 = bboxx1;
+                                // skip right side (fast exit loop):
+                                i = numCrossings;
+                            }
+
+                            if (x0 < x1) {
+                                x0 -= bboxx0; // turn x0, x1 from coords to indices
+                                x1 -= bboxx0; // in the alpha array.
+
+                                pix_x      =  x0      >> _SUBPIXEL_LG_POSITIONS_X;
+                                pix_xmaxm1 = (x1 - 1) >> _SUBPIXEL_LG_POSITIONS_X;
+
+                                if (pix_x == pix_xmaxm1) {
+                                    // Start and end in same pixel
+                                    tmp = (x1 - x0); // number of subpixels
+                                    _alpha[pix_x    ] += tmp;
+                                    _alpha[pix_x + 1] -= tmp;
+
+                                    if (useBlkFlags) {
+                                        // flag used blocks:
+                                        // note: block processing handles extra pixel:
+                                        _blkFlags[pix_x    >> _BLK_SIZE_LG] = 1;
+                                    }
+                                } else {
+                                    tmp = (x0 & _SUBPIXEL_MASK_X);
+                                    _alpha[pix_x    ]
+                                        += (_SUBPIXEL_POSITIONS_X - tmp);
+                                    _alpha[pix_x + 1]
+                                        += tmp;
+
+                                    pix_xmax = x1 >> _SUBPIXEL_LG_POSITIONS_X;
+
+                                    tmp = (x1 & _SUBPIXEL_MASK_X);
+                                    _alpha[pix_xmax    ]
+                                        -= (_SUBPIXEL_POSITIONS_X - tmp);
+                                    _alpha[pix_xmax + 1]
+                                        -= tmp;
+
+                                    if (useBlkFlags) {
+                                        // flag used blocks:
+                                        // note: block processing handles extra pixel:
+                                        _blkFlags[pix_x    >> _BLK_SIZE_LG] = 1;
+                                        _blkFlags[pix_xmax >> _BLK_SIZE_LG] = 1;
+                                    }
+                                }
+                            }
+                            prev = _MAX_VALUE;
+                        }
+
+                        if (i == numCrossings) {
+                            break;
+                        }
+
+                        curxo = _crossings[i];
+                        curx  =  curxo >> 1;
+                        // to turn {0, 1} into {-1, 1}, multiply by 2 and subtract 1.
+                        // last bit contains orientation (0 or 1)
+                        crorientation = ((curxo & 0x1) << 1) - 1;
+                    }
+                }
+            } // numCrossings > 0
+
+            // even if this last row had no crossings, alpha will be zeroed
+            // from the last emitRow call. But this doesn't matter because
+            // maxX < minX, so no row will be emitted to the MarlinCache.
+            if ((y & _SUBPIXEL_MASK_Y) == _SUBPIXEL_MASK_Y) {
+                lastY = y >> _SUBPIXEL_LG_POSITIONS_Y;
+
+                // convert subpixel to pixel coordinate within boundaries:
+                minX = FloatMath.max(minX, bboxx0) >> _SUBPIXEL_LG_POSITIONS_X;
+                maxX = FloatMath.min(maxX, bboxx1) >> _SUBPIXEL_LG_POSITIONS_X;
+
+                if (maxX >= minX) {
+                    // note: alpha array will be zeroed by copyAARow()
+                    // +1 because alpha [pix_minX; pix_maxX[
+                    // fix range [x0; x1[
+                    // note: if x1=bboxx1, then alpha is written up to bboxx1+1
+                    // inclusive: alpha[bboxx1] ignored, alpha[bboxx1+1] == 0
+                    // (normally so never cleared below)
+                    copyAARow(_alpha, lastY, minX, maxX + 1, useBlkFlags);
+
+                    // speculative for next pixel row (scanline coherence):
+                    if (_enableBlkFlagsHeuristics) {
+                        // Use block flags if large pixel span and few crossings:
+                        // ie mean(distance between crossings) is larger than
+                        // 1 block size;
+
+                        // fast check width:
+                        maxX -= minX;
+
+                        // if stroking: numCrossings /= 2
+                        // => shift numCrossings by 1
+                        // condition = (width / (numCrossings - 1)) > blockSize
+                        useBlkFlags = (maxX > _BLK_SIZE) && (maxX >
+                            (((numCrossings >> stroking) - 1) << _BLK_SIZE_LG));
+
+                        if (DO_STATS) {
+                            tmp = FloatMath.max(1,
+                                    ((numCrossings >> stroking) - 1));
+                            rdrCtx.stats.hist_tile_generator_encoding_dist
+                                .add(maxX / tmp);
+                        }
+                    }
+                } else {
+                    _cache.clearAARow(lastY);
+                }
+                minX = _MAX_VALUE;
+                maxX = _MIN_VALUE;
+            }
+        } // scan line iterator
+
+        // Emit final row
+        y--;
+        y >>= _SUBPIXEL_LG_POSITIONS_Y;
+
+        // convert subpixel to pixel coordinate within boundaries:
+        minX = FloatMath.max(minX, bboxx0) >> _SUBPIXEL_LG_POSITIONS_X;
+        maxX = FloatMath.min(maxX, bboxx1) >> _SUBPIXEL_LG_POSITIONS_X;
+
+        if (maxX >= minX) {
+            // note: alpha array will be zeroed by copyAARow()
+            // +1 because alpha [pix_minX; pix_maxX[
+            // fix range [x0; x1[
+            // note: if x1=bboxx1, then alpha is written up to bboxx1+1
+            // inclusive: alpha[bboxx1] ignored then cleared and
+            // alpha[bboxx1+1] == 0 (normally so never cleared after)
+            copyAARow(_alpha, y, minX, maxX + 1, useBlkFlags);
+        } else if (y != lastY) {
+            _cache.clearAARow(y);
+        }
+
+        // update member:
+        edgeCount = numCrossings;
+        prevUseBlkFlags = useBlkFlags;
+
+        if (DO_STATS) {
+            // update max used mark
+            activeEdgeMaxUsed = _arrayMaxUsed;
+        }
+    }
+
+    boolean endRendering() {
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_endRendering.start();
+        }
+        if (edgeMinY == Integer.MAX_VALUE) {
+            return false; // undefined edges bounds
+        }
+
+        // bounds as half-open intervals
+        final int spminX = FloatMath.max(FloatMath.ceil_int(edgeMinX - 0.5d), boundsMinX);
+        final int spmaxX = FloatMath.min(FloatMath.ceil_int(edgeMaxX - 0.5d), boundsMaxX);
+
+        // edge Min/Max Y are already rounded to subpixels within bounds:
+        final int spminY = edgeMinY;
+        final int spmaxY = edgeMaxY;
+
+        buckets_minY = spminY - boundsMinY;
+        buckets_maxY = spmaxY - boundsMinY;
+
+        if (DO_LOG_BOUNDS) {
+            MarlinUtils.logInfo("edgesXY = [" + edgeMinX + " ... " + edgeMaxX
+                                + "[ [" + edgeMinY + " ... " + edgeMaxY + "[");
+            MarlinUtils.logInfo("spXY    = [" + spminX + " ... " + spmaxX
+                                + "[ [" + spminY + " ... " + spmaxY + "[");
+        }
+
+        // test clipping for shapes out of bounds
+        if ((spminX >= spmaxX) || (spminY >= spmaxY)) {
+            return false;
+        }
+
+        // half open intervals
+        // inclusive:
+        final int pminX =  spminX                    >> SUBPIXEL_LG_POSITIONS_X;
+        // exclusive:
+        final int pmaxX = (spmaxX + SUBPIXEL_MASK_X) >> SUBPIXEL_LG_POSITIONS_X;
+        // inclusive:
+        final int pminY =  spminY                    >> SUBPIXEL_LG_POSITIONS_Y;
+        // exclusive:
+        final int pmaxY = (spmaxY + SUBPIXEL_MASK_Y) >> SUBPIXEL_LG_POSITIONS_Y;
+
+        // store BBox to answer ptg.getBBox():
+        this.cache.init(pminX, pminY, pmaxX, pmaxY);
+
+        // Heuristics for using block flags:
+        if (ENABLE_BLOCK_FLAGS) {
+            enableBlkFlags = this.cache.useRLE;
+            prevUseBlkFlags = enableBlkFlags && !ENABLE_BLOCK_FLAGS_HEURISTICS;
+
+            if (enableBlkFlags) {
+                // ensure blockFlags array is large enough:
+                // note: +2 to ensure enough space left at end
+                final int blkLen = ((pmaxX - pminX) >> BLOCK_SIZE_LG) + 2;
+                if (blkLen > INITIAL_ARRAY) {
+                    blkFlags = blkFlags_ref.getArray(blkLen);
+                }
+            }
+        }
+
+        // memorize the rendering bounding box:
+        /* note: bbox_spminX and bbox_spmaxX must be pixel boundaries
+           to have correct coverage computation */
+        // inclusive:
+        bbox_spminX = pminX << SUBPIXEL_LG_POSITIONS_X;
+        // exclusive:
+        bbox_spmaxX = pmaxX << SUBPIXEL_LG_POSITIONS_X;
+        // inclusive:
+        bbox_spminY = spminY;
+        // exclusive:
+        bbox_spmaxY = spmaxY;
+
+        if (DO_LOG_BOUNDS) {
+            MarlinUtils.logInfo("pXY       = [" + pminX + " ... " + pmaxX
+                                + "[ [" + pminY + " ... " + pmaxY + "[");
+            MarlinUtils.logInfo("bbox_spXY = [" + bbox_spminX + " ... "
+                                + bbox_spmaxX + "[ [" + bbox_spminY + " ... "
+                                + bbox_spmaxY + "[");
+        }
+
+        // Prepare alpha line:
+        // add 2 to better deal with the last pixel in a pixel row.
+        final int width = (pmaxX - pminX) + 2;
+
+        // Useful when processing tile line by tile line
+        if (width > INITIAL_AA_ARRAY) {
+            if (DO_STATS) {
+                rdrCtx.stats.stat_array_renderer_alphaline.add(width);
+            }
+            alphaLine = alphaLine_ref.getArray(width);
+        }
+
+        // process first tile line:
+        endRendering(pminY);
+
+        return true;
+    }
+
+    private int bbox_spminX, bbox_spmaxX, bbox_spminY, bbox_spmaxY;
+
+    void endRendering(final int pminY) {
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_endRendering_Y.start();
+        }
+
+        final int spminY       = pminY << SUBPIXEL_LG_POSITIONS_Y;
+        final int fixed_spminY = FloatMath.max(bbox_spminY, spminY);
+
+        // avoid rendering for last call to nextTile()
+        if (fixed_spminY < bbox_spmaxY) {
+            // process a complete tile line ie scanlines for 32 rows
+            final int spmaxY = FloatMath.min(bbox_spmaxY, spminY + SUBPIXEL_TILE);
+
+            // process tile line [0 - 32]
+            cache.resetTileLine(pminY);
+
+            // Process only one tile line:
+            _endRendering(fixed_spminY, spmaxY);
+        }
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_endRendering_Y.stop();
+        }
+    }
+
+    void copyAARow(final int[] alphaRow,
+                   final int pix_y, final int pix_from, final int pix_to,
+                   final boolean useBlockFlags)
+    {
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_copyAARow.start();
+        }
+        if (useBlockFlags) {
+            if (DO_STATS) {
+                rdrCtx.stats.hist_tile_generator_encoding.add(1);
+            }
+            cache.copyAARowRLE_WithBlockFlags(blkFlags, alphaRow, pix_y, pix_from, pix_to);
+        } else {
+            if (DO_STATS) {
+                rdrCtx.stats.hist_tile_generator_encoding.add(0);
+            }
+            cache.copyAARowNoRLE(alphaRow, pix_y, pix_from, pix_to);
+        }
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_copyAARow.stop();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DRendererContext.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,260 @@
+/*
+ * 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.  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.java2d.marlin;
+
+import java.awt.geom.Path2D;
+import java.lang.ref.WeakReference;
+import java.util.concurrent.atomic.AtomicInteger;
+import sun.java2d.ReentrantContext;
+import sun.java2d.marlin.ArrayCacheConst.CacheStats;
+import sun.java2d.marlin.DMarlinRenderingEngine.NormalizingPathIterator;
+
+/**
+ * This class is a renderer context dedicated to a single thread
+ */
+final class DRendererContext extends ReentrantContext implements IRendererContext {
+
+    // RendererContext creation counter
+    private static final AtomicInteger CTX_COUNT = new AtomicInteger(1);
+
+    /**
+     * Create a new renderer context
+     *
+     * @return new RendererContext instance
+     */
+    static DRendererContext createContext() {
+        return new DRendererContext("ctx"
+                       + Integer.toString(CTX_COUNT.getAndIncrement()));
+    }
+
+    // Smallest object used as Cleaner's parent reference
+    private final Object cleanerObj;
+    // dirty flag indicating an exception occured during pipeline in pathTo()
+    boolean dirty = false;
+    // shared data
+    final double[] double6 = new double[6];
+    // shared curve (dirty) (Renderer / Stroker)
+    final DCurve curve = new DCurve();
+    // MarlinRenderingEngine NormalizingPathIterator NearestPixelCenter:
+    final NormalizingPathIterator nPCPathIterator;
+    // MarlinRenderingEngine NearestPixelQuarter NormalizingPathIterator:
+    final NormalizingPathIterator nPQPathIterator;
+    // MarlinRenderingEngine.TransformingPathConsumer2D
+    final DTransformingPathConsumer2D transformerPC2D;
+    // recycled Path2D instance (weak)
+    private WeakReference<Path2D.Double> refPath2D = null;
+    final DRenderer renderer;
+    final DStroker stroker;
+    // Simplifies out collinear lines
+    final DCollinearSimplifier simplifier = new DCollinearSimplifier();
+    final DDasher dasher;
+    final MarlinTileGenerator ptg;
+    final MarlinCache cache;
+    // flag indicating the shape is stroked (1) or filled (0)
+    int stroking = 0;
+
+    // Array caches:
+    /* clean int[] cache (zero-filled) = 5 refs */
+    private final IntArrayCache cleanIntCache = new IntArrayCache(true, 5);
+    /* dirty int[] cache = 4 refs */
+    private final IntArrayCache dirtyIntCache = new IntArrayCache(false, 4);
+    /* dirty double[] cache = 3 refs */
+    private final DoubleArrayCache dirtyDoubleCache = new DoubleArrayCache(false, 3);
+    /* dirty byte[] cache = 1 ref */
+    private final ByteArrayCache dirtyByteCache = new ByteArrayCache(false, 1);
+
+    // RendererContext statistics
+    final RendererStats stats;
+
+    final PathConsumer2DAdapter p2dAdapter = new PathConsumer2DAdapter();
+
+
+    /**
+     * Constructor
+     *
+     * @param name context name (debugging)
+     */
+    DRendererContext(final String name) {
+        if (LOG_CREATE_CONTEXT) {
+            MarlinUtils.logInfo("new RendererContext = " + name);
+        }
+        this.cleanerObj = new Object();
+
+        // create first stats (needed by newOffHeapArray):
+        if (DO_STATS || DO_MONITORS) {
+            stats = RendererStats.createInstance(cleanerObj, name);
+            // push cache stats:
+            stats.cacheStats = new CacheStats[] { cleanIntCache.stats,
+                dirtyIntCache.stats, dirtyDoubleCache.stats, dirtyByteCache.stats
+            };
+        } else {
+            stats = null;
+        }
+
+        // NormalizingPathIterator instances:
+        nPCPathIterator = new NormalizingPathIterator.NearestPixelCenter(double6);
+        nPQPathIterator  = new NormalizingPathIterator.NearestPixelQuarter(double6);
+
+        // MarlinRenderingEngine.TransformingPathConsumer2D
+        transformerPC2D = new DTransformingPathConsumer2D();
+
+        // Renderer:
+        cache = new MarlinCache(this);
+        renderer = new DRenderer(this); // needs MarlinCache from rdrCtx.cache
+        ptg = new MarlinTileGenerator(stats, renderer, cache);
+
+        stroker = new DStroker(this);
+        dasher = new DDasher(this);
+    }
+
+    /**
+     * Disposes this renderer context:
+     * clean up before reusing this context
+     */
+    void dispose() {
+        if (DO_STATS) {
+            if (stats.totalOffHeap > stats.totalOffHeapMax) {
+                stats.totalOffHeapMax = stats.totalOffHeap;
+            }
+            stats.totalOffHeap = 0L;
+        }
+        stroking = 0;
+        // if context is maked as DIRTY:
+        if (dirty) {
+            // may happen if an exception if thrown in the pipeline processing:
+            // force cleanup of all possible pipelined blocks (except Renderer):
+
+            // NormalizingPathIterator instances:
+            this.nPCPathIterator.dispose();
+            this.nPQPathIterator.dispose();
+            // Dasher:
+            this.dasher.dispose();
+            // Stroker:
+            this.stroker.dispose();
+
+            // mark context as CLEAN:
+            dirty = false;
+        }
+    }
+
+    Path2D.Double getPath2D() {
+        // resolve reference:
+        Path2D.Double p2d
+            = (refPath2D != null) ? refPath2D.get() : null;
+
+        // create a new Path2D ?
+        if (p2d == null) {
+            p2d = new Path2D.Double(Path2D.WIND_NON_ZERO, INITIAL_EDGES_COUNT); // 32K
+
+            // update weak reference:
+            refPath2D = new WeakReference<Path2D.Double>(p2d);
+        }
+        // reset the path anyway:
+        p2d.reset();
+        return p2d;
+    }
+
+    @Override
+    public RendererStats stats() {
+        return stats;
+    }
+
+    @Override
+    public OffHeapArray newOffHeapArray(final long initialSize) {
+        if (DO_STATS) {
+            stats.totalOffHeapInitial += initialSize;
+        }
+        return new OffHeapArray(cleanerObj, initialSize);
+    }
+
+    @Override
+    public IntArrayCache.Reference newCleanIntArrayRef(final int initialSize) {
+        return cleanIntCache.createRef(initialSize);
+    }
+
+    IntArrayCache.Reference newDirtyIntArrayRef(final int initialSize) {
+        return dirtyIntCache.createRef(initialSize);
+    }
+
+    DoubleArrayCache.Reference newDirtyDoubleArrayRef(final int initialSize) {
+        return dirtyDoubleCache.createRef(initialSize);
+    }
+
+    ByteArrayCache.Reference newDirtyByteArrayRef(final int initialSize) {
+        return dirtyByteCache.createRef(initialSize);
+    }
+
+    static final class PathConsumer2DAdapter implements DPathConsumer2D {
+        private sun.awt.geom.PathConsumer2D out;
+
+        PathConsumer2DAdapter() {}
+
+        PathConsumer2DAdapter init(sun.awt.geom.PathConsumer2D out) {
+            this.out = out;
+            return this;
+        }
+
+        @Override
+        public void moveTo(double x0, double y0) {
+            out.moveTo((float)x0, (float)y0);
+        }
+
+        @Override
+        public void lineTo(double x1, double y1) {
+            out.lineTo((float)x1, (float)y1);
+        }
+
+        @Override
+        public void closePath() {
+            out.closePath();
+        }
+
+        @Override
+        public void pathDone() {
+            out.pathDone();
+        }
+
+        @Override
+        public void curveTo(double x1, double y1,
+                            double x2, double y2,
+                            double x3, double y3)
+        {
+            out.curveTo((float)x1, (float)y1,
+                    (float)x2, (float)y2,
+                    (float)x3, (float)y3);
+        }
+
+        @Override
+        public void quadTo(double x1, double y1, double x2, double y2) {
+            out.quadTo((float)x1, (float)y1, (float)x2, (float)y2);
+        }
+
+        @Override
+        public long getNativeConsumer() {
+            throw new InternalError("Not using a native peer");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DStroker.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,1325 @@
+/*
+ * 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.  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.java2d.marlin;
+
+import java.util.Arrays;
+
+// TODO: some of the arithmetic here is too verbose and prone to hard to
+// debug typos. We should consider making a small Point/Vector class that
+// has methods like plus(Point), minus(Point), dot(Point), cross(Point)and such
+final class DStroker implements DPathConsumer2D, MarlinConst {
+
+    private static final int MOVE_TO = 0;
+    private static final int DRAWING_OP_TO = 1; // ie. curve, line, or quad
+    private static final int CLOSE = 2;
+
+    /**
+     * Constant value for join style.
+     */
+    public static final int JOIN_MITER = 0;
+
+    /**
+     * Constant value for join style.
+     */
+    public static final int JOIN_ROUND = 1;
+
+    /**
+     * Constant value for join style.
+     */
+    public static final int JOIN_BEVEL = 2;
+
+    /**
+     * Constant value for end cap style.
+     */
+    public static final int CAP_BUTT = 0;
+
+    /**
+     * Constant value for end cap style.
+     */
+    public static final int CAP_ROUND = 1;
+
+    /**
+     * Constant value for end cap style.
+     */
+    public static final int CAP_SQUARE = 2;
+
+    // pisces used to use fixed point arithmetic with 16 decimal digits. I
+    // didn't want to change the values of the constant below when I converted
+    // it to floating point, so that's why the divisions by 2^16 are there.
+    private static final double ROUND_JOIN_THRESHOLD = 1000.0d/65536.0d;
+
+    private static final double C = 0.5522847498307933d;
+
+    private static final int MAX_N_CURVES = 11;
+
+    private DPathConsumer2D out;
+
+    private int capStyle;
+    private int joinStyle;
+
+    private double lineWidth2;
+    private double invHalfLineWidth2Sq;
+
+    private final double[] offset0 = new double[2];
+    private final double[] offset1 = new double[2];
+    private final double[] offset2 = new double[2];
+    private final double[] miter = new double[2];
+    private double miterLimitSq;
+
+    private int prev;
+
+    // The starting point of the path, and the slope there.
+    private double sx0, sy0, sdx, sdy;
+    // the current point and the slope there.
+    private double cx0, cy0, cdx, cdy; // c stands for current
+    // vectors that when added to (sx0,sy0) and (cx0,cy0) respectively yield the
+    // first and last points on the left parallel path. Since this path is
+    // parallel, it's slope at any point is parallel to the slope of the
+    // original path (thought they may have different directions), so these
+    // could be computed from sdx,sdy and cdx,cdy (and vice versa), but that
+    // would be error prone and hard to read, so we keep these anyway.
+    private double smx, smy, cmx, cmy;
+
+    private final PolyStack reverse;
+
+    // This is where the curve to be processed is put. We give it
+    // enough room to store all curves.
+    private final double[] middle = new double[MAX_N_CURVES * 6 + 2];
+    private final double[] lp = new double[8];
+    private final double[] rp = new double[8];
+    private final double[] subdivTs = new double[MAX_N_CURVES - 1];
+
+    // per-thread renderer context
+    final DRendererContext rdrCtx;
+
+    // dirty curve
+    final DCurve curve;
+
+    /**
+     * Constructs a <code>DStroker</code>.
+     * @param rdrCtx per-thread renderer context
+     */
+    DStroker(final DRendererContext rdrCtx) {
+        this.rdrCtx = rdrCtx;
+
+        this.reverse = new PolyStack(rdrCtx);
+        this.curve = rdrCtx.curve;
+    }
+
+    /**
+     * Inits the <code>DStroker</code>.
+     *
+     * @param pc2d an output <code>DPathConsumer2D</code>.
+     * @param lineWidth the desired line width in pixels
+     * @param capStyle the desired end cap style, one of
+     * <code>CAP_BUTT</code>, <code>CAP_ROUND</code> or
+     * <code>CAP_SQUARE</code>.
+     * @param joinStyle the desired line join style, one of
+     * <code>JOIN_MITER</code>, <code>JOIN_ROUND</code> or
+     * <code>JOIN_BEVEL</code>.
+     * @param miterLimit the desired miter limit
+     * @return this instance
+     */
+    DStroker init(DPathConsumer2D pc2d,
+              double lineWidth,
+              int capStyle,
+              int joinStyle,
+              double miterLimit)
+    {
+        this.out = pc2d;
+
+        this.lineWidth2 = lineWidth / 2.0d;
+        this.invHalfLineWidth2Sq = 1.0d / (2.0d * lineWidth2 * lineWidth2);
+        this.capStyle = capStyle;
+        this.joinStyle = joinStyle;
+
+        double limit = miterLimit * lineWidth2;
+        this.miterLimitSq = limit * limit;
+
+        this.prev = CLOSE;
+
+        rdrCtx.stroking = 1;
+
+        return this; // fluent API
+    }
+
+    /**
+     * Disposes this stroker:
+     * clean up before reusing this instance
+     */
+    void dispose() {
+        reverse.dispose();
+
+        if (DO_CLEAN_DIRTY) {
+            // Force zero-fill dirty arrays:
+            Arrays.fill(offset0, 0.0d);
+            Arrays.fill(offset1, 0.0d);
+            Arrays.fill(offset2, 0.0d);
+            Arrays.fill(miter, 0.0d);
+            Arrays.fill(middle, 0.0d);
+            Arrays.fill(lp, 0.0d);
+            Arrays.fill(rp, 0.0d);
+            Arrays.fill(subdivTs, 0.0d);
+        }
+    }
+
+    private static void computeOffset(final double lx, final double ly,
+                                      final double w, final double[] m)
+    {
+        double len = lx*lx + ly*ly;
+        if (len == 0.0d) {
+            m[0] = 0.0d;
+            m[1] = 0.0d;
+        } else {
+            len = Math.sqrt(len);
+            m[0] =  (ly * w) / len;
+            m[1] = -(lx * w) / len;
+        }
+    }
+
+    // Returns true if the vectors (dx1, dy1) and (dx2, dy2) are
+    // clockwise (if dx1,dy1 needs to be rotated clockwise to close
+    // the smallest angle between it and dx2,dy2).
+    // This is equivalent to detecting whether a point q is on the right side
+    // of a line passing through points p1, p2 where p2 = p1+(dx1,dy1) and
+    // q = p2+(dx2,dy2), which is the same as saying p1, p2, q are in a
+    // clockwise order.
+    // NOTE: "clockwise" here assumes coordinates with 0,0 at the bottom left.
+    private static boolean isCW(final double dx1, final double dy1,
+                                final double dx2, final double dy2)
+    {
+        return dx1 * dy2 <= dy1 * dx2;
+    }
+
+    private void drawRoundJoin(double x, double y,
+                               double omx, double omy, double mx, double my,
+                               boolean rev,
+                               double threshold)
+    {
+        if ((omx == 0.0d && omy == 0.0d) || (mx == 0.0d && my == 0.0d)) {
+            return;
+        }
+
+        double domx = omx - mx;
+        double domy = omy - my;
+        double len = domx*domx + domy*domy;
+        if (len < threshold) {
+            return;
+        }
+
+        if (rev) {
+            omx = -omx;
+            omy = -omy;
+            mx  = -mx;
+            my  = -my;
+        }
+        drawRoundJoin(x, y, omx, omy, mx, my, rev);
+    }
+
+    private void drawRoundJoin(double cx, double cy,
+                               double omx, double omy,
+                               double mx, double my,
+                               boolean rev)
+    {
+        // The sign of the dot product of mx,my and omx,omy is equal to the
+        // the sign of the cosine of ext
+        // (ext is the angle between omx,omy and mx,my).
+        final double cosext = omx * mx + omy * my;
+        // If it is >=0, we know that abs(ext) is <= 90 degrees, so we only
+        // need 1 curve to approximate the circle section that joins omx,omy
+        // and mx,my.
+        final int numCurves = (cosext >= 0.0d) ? 1 : 2;
+
+        switch (numCurves) {
+        case 1:
+            drawBezApproxForArc(cx, cy, omx, omy, mx, my, rev);
+            break;
+        case 2:
+            // we need to split the arc into 2 arcs spanning the same angle.
+            // The point we want will be one of the 2 intersections of the
+            // perpendicular bisector of the chord (omx,omy)->(mx,my) and the
+            // circle. We could find this by scaling the vector
+            // (omx+mx, omy+my)/2 so that it has length=lineWidth2 (and thus lies
+            // on the circle), but that can have numerical problems when the angle
+            // between omx,omy and mx,my is close to 180 degrees. So we compute a
+            // normal of (omx,omy)-(mx,my). This will be the direction of the
+            // perpendicular bisector. To get one of the intersections, we just scale
+            // this vector that its length is lineWidth2 (this works because the
+            // perpendicular bisector goes through the origin). This scaling doesn't
+            // have numerical problems because we know that lineWidth2 divided by
+            // this normal's length is at least 0.5 and at most sqrt(2)/2 (because
+            // we know the angle of the arc is > 90 degrees).
+            double nx = my - omy, ny = omx - mx;
+            double nlen = Math.sqrt(nx*nx + ny*ny);
+            double scale = lineWidth2/nlen;
+            double mmx = nx * scale, mmy = ny * scale;
+
+            // if (isCW(omx, omy, mx, my) != isCW(mmx, mmy, mx, my)) then we've
+            // computed the wrong intersection so we get the other one.
+            // The test above is equivalent to if (rev).
+            if (rev) {
+                mmx = -mmx;
+                mmy = -mmy;
+            }
+            drawBezApproxForArc(cx, cy, omx, omy, mmx, mmy, rev);
+            drawBezApproxForArc(cx, cy, mmx, mmy, mx, my, rev);
+            break;
+        default:
+        }
+    }
+
+    // the input arc defined by omx,omy and mx,my must span <= 90 degrees.
+    private void drawBezApproxForArc(final double cx, final double cy,
+                                     final double omx, final double omy,
+                                     final double mx, final double my,
+                                     boolean rev)
+    {
+        final double cosext2 = (omx * mx + omy * my) * invHalfLineWidth2Sq;
+
+        // check round off errors producing cos(ext) > 1 and a NaN below
+        // cos(ext) == 1 implies colinear segments and an empty join anyway
+        if (cosext2 >= 0.5d) {
+            // just return to avoid generating a flat curve:
+            return;
+        }
+
+        // cv is the length of P1-P0 and P2-P3 divided by the radius of the arc
+        // (so, cv assumes the arc has radius 1). P0, P1, P2, P3 are the points that
+        // define the bezier curve we're computing.
+        // It is computed using the constraints that P1-P0 and P3-P2 are parallel
+        // to the arc tangents at the endpoints, and that |P1-P0|=|P3-P2|.
+        double cv = ((4.0d / 3.0d) * Math.sqrt(0.5d - cosext2) /
+                            (1.0d + Math.sqrt(cosext2 + 0.5d)));
+        // if clockwise, we need to negate cv.
+        if (rev) { // rev is equivalent to isCW(omx, omy, mx, my)
+            cv = -cv;
+        }
+        final double x1 = cx + omx;
+        final double y1 = cy + omy;
+        final double x2 = x1 - cv * omy;
+        final double y2 = y1 + cv * omx;
+
+        final double x4 = cx + mx;
+        final double y4 = cy + my;
+        final double x3 = x4 + cv * my;
+        final double y3 = y4 - cv * mx;
+
+        emitCurveTo(x1, y1, x2, y2, x3, y3, x4, y4, rev);
+    }
+
+    private void drawRoundCap(double cx, double cy, double mx, double my) {
+        final double Cmx = C * mx;
+        final double Cmy = C * my;
+        emitCurveTo(cx + mx - Cmy, cy + my + Cmx,
+                    cx - my + Cmx, cy + mx + Cmy,
+                    cx - my,       cy + mx);
+        emitCurveTo(cx - my - Cmx, cy + mx - Cmy,
+                    cx - mx - Cmy, cy - my + Cmx,
+                    cx - mx,       cy - my);
+    }
+
+    // Return the intersection point of the lines (x0, y0) -> (x1, y1)
+    // and (x0p, y0p) -> (x1p, y1p) in m[off] and m[off+1]
+    private static void computeMiter(final double x0, final double y0,
+                                     final double x1, final double y1,
+                                     final double x0p, final double y0p,
+                                     final double x1p, final double y1p,
+                                     final double[] m, int off)
+    {
+        double x10 = x1 - x0;
+        double y10 = y1 - y0;
+        double x10p = x1p - x0p;
+        double y10p = y1p - y0p;
+
+        // if this is 0, the lines are parallel. If they go in the
+        // same direction, there is no intersection so m[off] and
+        // m[off+1] will contain infinity, so no miter will be drawn.
+        // If they go in the same direction that means that the start of the
+        // current segment and the end of the previous segment have the same
+        // tangent, in which case this method won't even be involved in
+        // miter drawing because it won't be called by drawMiter (because
+        // (mx == omx && my == omy) will be true, and drawMiter will return
+        // immediately).
+        double den = x10*y10p - x10p*y10;
+        double t = x10p*(y0-y0p) - y10p*(x0-x0p);
+        t /= den;
+        m[off++] = x0 + t*x10;
+        m[off]   = y0 + t*y10;
+    }
+
+    // Return the intersection point of the lines (x0, y0) -> (x1, y1)
+    // and (x0p, y0p) -> (x1p, y1p) in m[off] and m[off+1]
+    private static void safeComputeMiter(final double x0, final double y0,
+                                         final double x1, final double y1,
+                                         final double x0p, final double y0p,
+                                         final double x1p, final double y1p,
+                                         final double[] m, int off)
+    {
+        double x10 = x1 - x0;
+        double y10 = y1 - y0;
+        double x10p = x1p - x0p;
+        double y10p = y1p - y0p;
+
+        // if this is 0, the lines are parallel. If they go in the
+        // same direction, there is no intersection so m[off] and
+        // m[off+1] will contain infinity, so no miter will be drawn.
+        // If they go in the same direction that means that the start of the
+        // current segment and the end of the previous segment have the same
+        // tangent, in which case this method won't even be involved in
+        // miter drawing because it won't be called by drawMiter (because
+        // (mx == omx && my == omy) will be true, and drawMiter will return
+        // immediately).
+        double den = x10*y10p - x10p*y10;
+        if (den == 0.0d) {
+            m[off++] = (x0 + x0p) / 2.0d;
+            m[off]   = (y0 + y0p) / 2.0d;
+            return;
+        }
+        double t = x10p*(y0-y0p) - y10p*(x0-x0p);
+        t /= den;
+        m[off++] = x0 + t*x10;
+        m[off] = y0 + t*y10;
+    }
+
+    private void drawMiter(final double pdx, final double pdy,
+                           final double x0, final double y0,
+                           final double dx, final double dy,
+                           double omx, double omy, double mx, double my,
+                           boolean rev)
+    {
+        if ((mx == omx && my == omy) ||
+            (pdx == 0.0d && pdy == 0.0d) ||
+            (dx == 0.0d && dy == 0.0d))
+        {
+            return;
+        }
+
+        if (rev) {
+            omx = -omx;
+            omy = -omy;
+            mx  = -mx;
+            my  = -my;
+        }
+
+        computeMiter((x0 - pdx) + omx, (y0 - pdy) + omy, x0 + omx, y0 + omy,
+                     (dx + x0) + mx, (dy + y0) + my, x0 + mx, y0 + my,
+                     miter, 0);
+
+        final double miterX = miter[0];
+        final double miterY = miter[1];
+        double lenSq = (miterX-x0)*(miterX-x0) + (miterY-y0)*(miterY-y0);
+
+        // If the lines are parallel, lenSq will be either NaN or +inf
+        // (actually, I'm not sure if the latter is possible. The important
+        // thing is that -inf is not possible, because lenSq is a square).
+        // For both of those values, the comparison below will fail and
+        // no miter will be drawn, which is correct.
+        if (lenSq < miterLimitSq) {
+            emitLineTo(miterX, miterY, rev);
+        }
+    }
+
+    @Override
+    public void moveTo(double x0, double y0) {
+        if (prev == DRAWING_OP_TO) {
+            finish();
+        }
+        this.sx0 = this.cx0 = x0;
+        this.sy0 = this.cy0 = y0;
+        this.cdx = this.sdx = 1.0d;
+        this.cdy = this.sdy = 0.0d;
+        this.prev = MOVE_TO;
+    }
+
+    @Override
+    public void lineTo(double x1, double y1) {
+        double dx = x1 - cx0;
+        double dy = y1 - cy0;
+        if (dx == 0.0d && dy == 0.0d) {
+            dx = 1.0d;
+        }
+        computeOffset(dx, dy, lineWidth2, offset0);
+        final double mx = offset0[0];
+        final double my = offset0[1];
+
+        drawJoin(cdx, cdy, cx0, cy0, dx, dy, cmx, cmy, mx, my);
+
+        emitLineTo(cx0 + mx, cy0 + my);
+        emitLineTo( x1 + mx,  y1 + my);
+
+        emitLineToRev(cx0 - mx, cy0 - my);
+        emitLineToRev( x1 - mx,  y1 - my);
+
+        this.cmx = mx;
+        this.cmy = my;
+        this.cdx = dx;
+        this.cdy = dy;
+        this.cx0 = x1;
+        this.cy0 = y1;
+        this.prev = DRAWING_OP_TO;
+    }
+
+    @Override
+    public void closePath() {
+        if (prev != DRAWING_OP_TO) {
+            if (prev == CLOSE) {
+                return;
+            }
+            emitMoveTo(cx0, cy0 - lineWidth2);
+            this.cmx = this.smx = 0.0d;
+            this.cmy = this.smy = -lineWidth2;
+            this.cdx = this.sdx = 1.0d;
+            this.cdy = this.sdy = 0.0d;
+            finish();
+            return;
+        }
+
+        if (cx0 != sx0 || cy0 != sy0) {
+            lineTo(sx0, sy0);
+        }
+
+        drawJoin(cdx, cdy, cx0, cy0, sdx, sdy, cmx, cmy, smx, smy);
+
+        emitLineTo(sx0 + smx, sy0 + smy);
+
+        emitMoveTo(sx0 - smx, sy0 - smy);
+        emitReverse();
+
+        this.prev = CLOSE;
+        emitClose();
+    }
+
+    private void emitReverse() {
+        reverse.popAll(out);
+    }
+
+    @Override
+    public void pathDone() {
+        if (prev == DRAWING_OP_TO) {
+            finish();
+        }
+
+        out.pathDone();
+
+        // this shouldn't matter since this object won't be used
+        // after the call to this method.
+        this.prev = CLOSE;
+
+        // Dispose this instance:
+        dispose();
+    }
+
+    private void finish() {
+        if (capStyle == CAP_ROUND) {
+            drawRoundCap(cx0, cy0, cmx, cmy);
+        } else if (capStyle == CAP_SQUARE) {
+            emitLineTo(cx0 - cmy + cmx, cy0 + cmx + cmy);
+            emitLineTo(cx0 - cmy - cmx, cy0 + cmx - cmy);
+        }
+
+        emitReverse();
+
+        if (capStyle == CAP_ROUND) {
+            drawRoundCap(sx0, sy0, -smx, -smy);
+        } else if (capStyle == CAP_SQUARE) {
+            emitLineTo(sx0 + smy - smx, sy0 - smx - smy);
+            emitLineTo(sx0 + smy + smx, sy0 - smx + smy);
+        }
+
+        emitClose();
+    }
+
+    private void emitMoveTo(final double x0, final double y0) {
+        out.moveTo(x0, y0);
+    }
+
+    private void emitLineTo(final double x1, final double y1) {
+        out.lineTo(x1, y1);
+    }
+
+    private void emitLineToRev(final double x1, final double y1) {
+        reverse.pushLine(x1, y1);
+    }
+
+    private void emitLineTo(final double x1, final double y1,
+                            final boolean rev)
+    {
+        if (rev) {
+            emitLineToRev(x1, y1);
+        } else {
+            emitLineTo(x1, y1);
+        }
+    }
+
+    private void emitQuadTo(final double x1, final double y1,
+                            final double x2, final double y2)
+    {
+        out.quadTo(x1, y1, x2, y2);
+    }
+
+    private void emitQuadToRev(final double x0, final double y0,
+                               final double x1, final double y1)
+    {
+        reverse.pushQuad(x0, y0, x1, y1);
+    }
+
+    private void emitCurveTo(final double x1, final double y1,
+                             final double x2, final double y2,
+                             final double x3, final double y3)
+    {
+        out.curveTo(x1, y1, x2, y2, x3, y3);
+    }
+
+    private void emitCurveToRev(final double x0, final double y0,
+                                final double x1, final double y1,
+                                final double x2, final double y2)
+    {
+        reverse.pushCubic(x0, y0, x1, y1, x2, y2);
+    }
+
+    private void emitCurveTo(final double x0, final double y0,
+                             final double x1, final double y1,
+                             final double x2, final double y2,
+                             final double x3, final double y3, final boolean rev)
+    {
+        if (rev) {
+            reverse.pushCubic(x0, y0, x1, y1, x2, y2);
+        } else {
+            out.curveTo(x1, y1, x2, y2, x3, y3);
+        }
+    }
+
+    private void emitClose() {
+        out.closePath();
+    }
+
+    private void drawJoin(double pdx, double pdy,
+                          double x0, double y0,
+                          double dx, double dy,
+                          double omx, double omy,
+                          double mx, double my)
+    {
+        if (prev != DRAWING_OP_TO) {
+            emitMoveTo(x0 + mx, y0 + my);
+            this.sdx = dx;
+            this.sdy = dy;
+            this.smx = mx;
+            this.smy = my;
+        } else {
+            boolean cw = isCW(pdx, pdy, dx, dy);
+            if (joinStyle == JOIN_MITER) {
+                drawMiter(pdx, pdy, x0, y0, dx, dy, omx, omy, mx, my, cw);
+            } else if (joinStyle == JOIN_ROUND) {
+                drawRoundJoin(x0, y0,
+                              omx, omy,
+                              mx, my, cw,
+                              ROUND_JOIN_THRESHOLD);
+            }
+            emitLineTo(x0, y0, !cw);
+        }
+        prev = DRAWING_OP_TO;
+    }
+
+    private static boolean within(final double x1, final double y1,
+                                  final double x2, final double y2,
+                                  final double ERR)
+    {
+        assert ERR > 0 : "";
+        // compare taxicab distance. ERR will always be small, so using
+        // true distance won't give much benefit
+        return (DHelpers.within(x1, x2, ERR) &&  // we want to avoid calling Math.abs
+                DHelpers.within(y1, y2, ERR)); // this is just as good.
+    }
+
+    private void getLineOffsets(double x1, double y1,
+                                double x2, double y2,
+                                double[] left, double[] right) {
+        computeOffset(x2 - x1, y2 - y1, lineWidth2, offset0);
+        final double mx = offset0[0];
+        final double my = offset0[1];
+        left[0] = x1 + mx;
+        left[1] = y1 + my;
+        left[2] = x2 + mx;
+        left[3] = y2 + my;
+        right[0] = x1 - mx;
+        right[1] = y1 - my;
+        right[2] = x2 - mx;
+        right[3] = y2 - my;
+    }
+
+    private int computeOffsetCubic(double[] pts, final int off,
+                                   double[] leftOff, double[] rightOff)
+    {
+        // if p1=p2 or p3=p4 it means that the derivative at the endpoint
+        // vanishes, which creates problems with computeOffset. Usually
+        // this happens when this stroker object is trying to widen
+        // a curve with a cusp. What happens is that curveTo splits
+        // the input curve at the cusp, and passes it to this function.
+        // because of inaccuracies in the splitting, we consider points
+        // equal if they're very close to each other.
+        final double x1 = pts[off + 0], y1 = pts[off + 1];
+        final double x2 = pts[off + 2], y2 = pts[off + 3];
+        final double x3 = pts[off + 4], y3 = pts[off + 5];
+        final double x4 = pts[off + 6], y4 = pts[off + 7];
+
+        double dx4 = x4 - x3;
+        double dy4 = y4 - y3;
+        double dx1 = x2 - x1;
+        double dy1 = y2 - y1;
+
+        // if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4,
+        // in which case ignore if p1 == p2
+        final boolean p1eqp2 = within(x1, y1, x2, y2, 6.0d * Math.ulp(y2));
+        final boolean p3eqp4 = within(x3, y3, x4, y4, 6.0d * Math.ulp(y4));
+        if (p1eqp2 && p3eqp4) {
+            getLineOffsets(x1, y1, x4, y4, leftOff, rightOff);
+            return 4;
+        } else if (p1eqp2) {
+            dx1 = x3 - x1;
+            dy1 = y3 - y1;
+        } else if (p3eqp4) {
+            dx4 = x4 - x2;
+            dy4 = y4 - y2;
+        }
+
+        // if p2-p1 and p4-p3 are parallel, that must mean this curve is a line
+        double dotsq = (dx1 * dx4 + dy1 * dy4);
+        dotsq *= dotsq;
+        double l1sq = dx1 * dx1 + dy1 * dy1, l4sq = dx4 * dx4 + dy4 * dy4;
+        if (DHelpers.within(dotsq, l1sq * l4sq, 4.0d * Math.ulp(dotsq))) {
+            getLineOffsets(x1, y1, x4, y4, leftOff, rightOff);
+            return 4;
+        }
+
+//      What we're trying to do in this function is to approximate an ideal
+//      offset curve (call it I) of the input curve B using a bezier curve Bp.
+//      The constraints I use to get the equations are:
+//
+//      1. The computed curve Bp should go through I(0) and I(1). These are
+//      x1p, y1p, x4p, y4p, which are p1p and p4p. We still need to find
+//      4 variables: the x and y components of p2p and p3p (i.e. x2p, y2p, x3p, y3p).
+//
+//      2. Bp should have slope equal in absolute value to I at the endpoints. So,
+//      (by the way, the operator || in the comments below means "aligned with".
+//      It is defined on vectors, so when we say I'(0) || Bp'(0) we mean that
+//      vectors I'(0) and Bp'(0) are aligned, which is the same as saying
+//      that the tangent lines of I and Bp at 0 are parallel. Mathematically
+//      this means (I'(t) || Bp'(t)) <==> (I'(t) = c * Bp'(t)) where c is some
+//      nonzero constant.)
+//      I'(0) || Bp'(0) and I'(1) || Bp'(1). Obviously, I'(0) || B'(0) and
+//      I'(1) || B'(1); therefore, Bp'(0) || B'(0) and Bp'(1) || B'(1).
+//      We know that Bp'(0) || (p2p-p1p) and Bp'(1) || (p4p-p3p) and the same
+//      is true for any bezier curve; therefore, we get the equations
+//          (1) p2p = c1 * (p2-p1) + p1p
+//          (2) p3p = c2 * (p4-p3) + p4p
+//      We know p1p, p4p, p2, p1, p3, and p4; therefore, this reduces the number
+//      of unknowns from 4 to 2 (i.e. just c1 and c2).
+//      To eliminate these 2 unknowns we use the following constraint:
+//
+//      3. Bp(0.5) == I(0.5). Bp(0.5)=(x,y) and I(0.5)=(xi,yi), and I should note
+//      that I(0.5) is *the only* reason for computing dxm,dym. This gives us
+//          (3) Bp(0.5) = (p1p + 3 * (p2p + p3p) + p4p)/8, which is equivalent to
+//          (4) p2p + p3p = (Bp(0.5)*8 - p1p - p4p) / 3
+//      We can substitute (1) and (2) from above into (4) and we get:
+//          (5) c1*(p2-p1) + c2*(p4-p3) = (Bp(0.5)*8 - p1p - p4p)/3 - p1p - p4p
+//      which is equivalent to
+//          (6) c1*(p2-p1) + c2*(p4-p3) = (4/3) * (Bp(0.5) * 2 - p1p - p4p)
+//
+//      The right side of this is a 2D vector, and we know I(0.5), which gives us
+//      Bp(0.5), which gives us the value of the right side.
+//      The left side is just a matrix vector multiplication in disguise. It is
+//
+//      [x2-x1, x4-x3][c1]
+//      [y2-y1, y4-y3][c2]
+//      which, is equal to
+//      [dx1, dx4][c1]
+//      [dy1, dy4][c2]
+//      At this point we are left with a simple linear system and we solve it by
+//      getting the inverse of the matrix above. Then we use [c1,c2] to compute
+//      p2p and p3p.
+
+        double x = (x1 + 3.0d * (x2 + x3) + x4) / 8.0d;
+        double y = (y1 + 3.0d * (y2 + y3) + y4) / 8.0d;
+        // (dxm,dym) is some tangent of B at t=0.5. This means it's equal to
+        // c*B'(0.5) for some constant c.
+        double dxm = x3 + x4 - x1 - x2, dym = y3 + y4 - y1 - y2;
+
+        // this computes the offsets at t=0, 0.5, 1, using the property that
+        // for any bezier curve the vectors p2-p1 and p4-p3 are parallel to
+        // the (dx/dt, dy/dt) vectors at the endpoints.
+        computeOffset(dx1, dy1, lineWidth2, offset0);
+        computeOffset(dxm, dym, lineWidth2, offset1);
+        computeOffset(dx4, dy4, lineWidth2, offset2);
+        double x1p = x1 + offset0[0]; // start
+        double y1p = y1 + offset0[1]; // point
+        double xi  = x  + offset1[0]; // interpolation
+        double yi  = y  + offset1[1]; // point
+        double x4p = x4 + offset2[0]; // end
+        double y4p = y4 + offset2[1]; // point
+
+        double invdet43 = 4.0d / (3.0d * (dx1 * dy4 - dy1 * dx4));
+
+        double two_pi_m_p1_m_p4x = 2.0d * xi - x1p - x4p;
+        double two_pi_m_p1_m_p4y = 2.0d * yi - y1p - y4p;
+        double c1 = invdet43 * (dy4 * two_pi_m_p1_m_p4x - dx4 * two_pi_m_p1_m_p4y);
+        double c2 = invdet43 * (dx1 * two_pi_m_p1_m_p4y - dy1 * two_pi_m_p1_m_p4x);
+
+        double x2p, y2p, x3p, y3p;
+        x2p = x1p + c1*dx1;
+        y2p = y1p + c1*dy1;
+        x3p = x4p + c2*dx4;
+        y3p = y4p + c2*dy4;
+
+        leftOff[0] = x1p; leftOff[1] = y1p;
+        leftOff[2] = x2p; leftOff[3] = y2p;
+        leftOff[4] = x3p; leftOff[5] = y3p;
+        leftOff[6] = x4p; leftOff[7] = y4p;
+
+        x1p = x1 - offset0[0]; y1p = y1 - offset0[1];
+        xi = xi - 2.0d * offset1[0]; yi = yi - 2.0d * offset1[1];
+        x4p = x4 - offset2[0]; y4p = y4 - offset2[1];
+
+        two_pi_m_p1_m_p4x = 2.0d * xi - x1p - x4p;
+        two_pi_m_p1_m_p4y = 2.0d * yi - y1p - y4p;
+        c1 = invdet43 * (dy4 * two_pi_m_p1_m_p4x - dx4 * two_pi_m_p1_m_p4y);
+        c2 = invdet43 * (dx1 * two_pi_m_p1_m_p4y - dy1 * two_pi_m_p1_m_p4x);
+
+        x2p = x1p + c1*dx1;
+        y2p = y1p + c1*dy1;
+        x3p = x4p + c2*dx4;
+        y3p = y4p + c2*dy4;
+
+        rightOff[0] = x1p; rightOff[1] = y1p;
+        rightOff[2] = x2p; rightOff[3] = y2p;
+        rightOff[4] = x3p; rightOff[5] = y3p;
+        rightOff[6] = x4p; rightOff[7] = y4p;
+        return 8;
+    }
+
+    // compute offset curves using bezier spline through t=0.5 (i.e.
+    // ComputedCurve(0.5) == IdealParallelCurve(0.5))
+    // return the kind of curve in the right and left arrays.
+    private int computeOffsetQuad(double[] pts, final int off,
+                                  double[] leftOff, double[] rightOff)
+    {
+        final double x1 = pts[off + 0], y1 = pts[off + 1];
+        final double x2 = pts[off + 2], y2 = pts[off + 3];
+        final double x3 = pts[off + 4], y3 = pts[off + 5];
+
+        final double dx3 = x3 - x2;
+        final double dy3 = y3 - y2;
+        final double dx1 = x2 - x1;
+        final double dy1 = y2 - y1;
+
+        // if p1=p2 or p3=p4 it means that the derivative at the endpoint
+        // vanishes, which creates problems with computeOffset. Usually
+        // this happens when this stroker object is trying to widen
+        // a curve with a cusp. What happens is that curveTo splits
+        // the input curve at the cusp, and passes it to this function.
+        // because of inaccuracies in the splitting, we consider points
+        // equal if they're very close to each other.
+
+        // if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4,
+        // in which case ignore.
+        final boolean p1eqp2 = within(x1, y1, x2, y2, 6.0d * Math.ulp(y2));
+        final boolean p2eqp3 = within(x2, y2, x3, y3, 6.0d * Math.ulp(y3));
+        if (p1eqp2 || p2eqp3) {
+            getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
+            return 4;
+        }
+
+        // if p2-p1 and p4-p3 are parallel, that must mean this curve is a line
+        double dotsq = (dx1 * dx3 + dy1 * dy3);
+        dotsq *= dotsq;
+        double l1sq = dx1 * dx1 + dy1 * dy1, l3sq = dx3 * dx3 + dy3 * dy3;
+        if (DHelpers.within(dotsq, l1sq * l3sq, 4.0d * Math.ulp(dotsq))) {
+            getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
+            return 4;
+        }
+
+        // this computes the offsets at t=0, 0.5, 1, using the property that
+        // for any bezier curve the vectors p2-p1 and p4-p3 are parallel to
+        // the (dx/dt, dy/dt) vectors at the endpoints.
+        computeOffset(dx1, dy1, lineWidth2, offset0);
+        computeOffset(dx3, dy3, lineWidth2, offset1);
+
+        double x1p = x1 + offset0[0]; // start
+        double y1p = y1 + offset0[1]; // point
+        double x3p = x3 + offset1[0]; // end
+        double y3p = y3 + offset1[1]; // point
+        safeComputeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, leftOff, 2);
+        leftOff[0] = x1p; leftOff[1] = y1p;
+        leftOff[4] = x3p; leftOff[5] = y3p;
+
+        x1p = x1 - offset0[0]; y1p = y1 - offset0[1];
+        x3p = x3 - offset1[0]; y3p = y3 - offset1[1];
+        safeComputeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, rightOff, 2);
+        rightOff[0] = x1p; rightOff[1] = y1p;
+        rightOff[4] = x3p; rightOff[5] = y3p;
+        return 6;
+    }
+
+    // finds values of t where the curve in pts should be subdivided in order
+    // to get good offset curves a distance of w away from the middle curve.
+    // Stores the points in ts, and returns how many of them there were.
+    private static int findSubdivPoints(final DCurve c, double[] pts, double[] ts,
+                                        final int type, final double w)
+    {
+        final double x12 = pts[2] - pts[0];
+        final double y12 = pts[3] - pts[1];
+        // if the curve is already parallel to either axis we gain nothing
+        // from rotating it.
+        if (y12 != 0.0d && x12 != 0.0d) {
+            // we rotate it so that the first vector in the control polygon is
+            // parallel to the x-axis. This will ensure that rotated quarter
+            // circles won't be subdivided.
+            final double hypot = Math.sqrt(x12 * x12 + y12 * y12);
+            final double cos = x12 / hypot;
+            final double sin = y12 / hypot;
+            final double x1 = cos * pts[0] + sin * pts[1];
+            final double y1 = cos * pts[1] - sin * pts[0];
+            final double x2 = cos * pts[2] + sin * pts[3];
+            final double y2 = cos * pts[3] - sin * pts[2];
+            final double x3 = cos * pts[4] + sin * pts[5];
+            final double y3 = cos * pts[5] - sin * pts[4];
+
+            switch(type) {
+            case 8:
+                final double x4 = cos * pts[6] + sin * pts[7];
+                final double y4 = cos * pts[7] - sin * pts[6];
+                c.set(x1, y1, x2, y2, x3, y3, x4, y4);
+                break;
+            case 6:
+                c.set(x1, y1, x2, y2, x3, y3);
+                break;
+            default:
+            }
+        } else {
+            c.set(pts, type);
+        }
+
+        int ret = 0;
+        // we subdivide at values of t such that the remaining rotated
+        // curves are monotonic in x and y.
+        ret += c.dxRoots(ts, ret);
+        ret += c.dyRoots(ts, ret);
+        // subdivide at inflection points.
+        if (type == 8) {
+            // quadratic curves can't have inflection points
+            ret += c.infPoints(ts, ret);
+        }
+
+        // now we must subdivide at points where one of the offset curves will have
+        // a cusp. This happens at ts where the radius of curvature is equal to w.
+        ret += c.rootsOfROCMinusW(ts, ret, w, 0.0001d);
+
+        ret = DHelpers.filterOutNotInAB(ts, 0, ret, 0.0001d, 0.9999d);
+        DHelpers.isort(ts, 0, ret);
+        return ret;
+    }
+
+    @Override public void curveTo(double x1, double y1,
+                                  double x2, double y2,
+                                  double x3, double y3)
+    {
+        final double[] mid = middle;
+
+        mid[0] = cx0; mid[1] = cy0;
+        mid[2] = x1;  mid[3] = y1;
+        mid[4] = x2;  mid[5] = y2;
+        mid[6] = x3;  mid[7] = y3;
+
+        // need these so we can update the state at the end of this method
+        final double xf = mid[6], yf = mid[7];
+        double dxs = mid[2] - mid[0];
+        double dys = mid[3] - mid[1];
+        double dxf = mid[6] - mid[4];
+        double dyf = mid[7] - mid[5];
+
+        boolean p1eqp2 = (dxs == 0.0d && dys == 0.0d);
+        boolean p3eqp4 = (dxf == 0.0d && dyf == 0.0d);
+        if (p1eqp2) {
+            dxs = mid[4] - mid[0];
+            dys = mid[5] - mid[1];
+            if (dxs == 0.0d && dys == 0.0d) {
+                dxs = mid[6] - mid[0];
+                dys = mid[7] - mid[1];
+            }
+        }
+        if (p3eqp4) {
+            dxf = mid[6] - mid[2];
+            dyf = mid[7] - mid[3];
+            if (dxf == 0.0d && dyf == 0.0d) {
+                dxf = mid[6] - mid[0];
+                dyf = mid[7] - mid[1];
+            }
+        }
+        if (dxs == 0.0d && dys == 0.0d) {
+            // this happens if the "curve" is just a point
+            lineTo(mid[0], mid[1]);
+            return;
+        }
+
+        // if these vectors are too small, normalize them, to avoid future
+        // precision problems.
+        if (Math.abs(dxs) < 0.1d && Math.abs(dys) < 0.1d) {
+            double len = Math.sqrt(dxs*dxs + dys*dys);
+            dxs /= len;
+            dys /= len;
+        }
+        if (Math.abs(dxf) < 0.1d && Math.abs(dyf) < 0.1d) {
+            double len = Math.sqrt(dxf*dxf + dyf*dyf);
+            dxf /= len;
+            dyf /= len;
+        }
+
+        computeOffset(dxs, dys, lineWidth2, offset0);
+        drawJoin(cdx, cdy, cx0, cy0, dxs, dys, cmx, cmy, offset0[0], offset0[1]);
+
+        final int nSplits = findSubdivPoints(curve, mid, subdivTs, 8, lineWidth2);
+
+        double prevT = 0.0d;
+        for (int i = 0, off = 0; i < nSplits; i++, off += 6) {
+            final double t = subdivTs[i];
+            DHelpers.subdivideCubicAt((t - prevT) / (1.0d - prevT),
+                                     mid, off, mid, off, mid, off + 6);
+            prevT = t;
+        }
+
+        final double[] l = lp;
+        final double[] r = rp;
+
+        int kind = 0;
+        for (int i = 0, off = 0; i <= nSplits; i++, off += 6) {
+            kind = computeOffsetCubic(mid, off, l, r);
+
+            emitLineTo(l[0], l[1]);
+
+            switch(kind) {
+            case 8:
+                emitCurveTo(l[2], l[3], l[4], l[5], l[6], l[7]);
+                emitCurveToRev(r[0], r[1], r[2], r[3], r[4], r[5]);
+                break;
+            case 4:
+                emitLineTo(l[2], l[3]);
+                emitLineToRev(r[0], r[1]);
+                break;
+            default:
+            }
+            emitLineToRev(r[kind - 2], r[kind - 1]);
+        }
+
+        this.cmx = (l[kind - 2] - r[kind - 2]) / 2.0d;
+        this.cmy = (l[kind - 1] - r[kind - 1]) / 2.0d;
+        this.cdx = dxf;
+        this.cdy = dyf;
+        this.cx0 = xf;
+        this.cy0 = yf;
+        this.prev = DRAWING_OP_TO;
+    }
+
+    @Override public void quadTo(double x1, double y1, double x2, double y2) {
+        final double[] mid = middle;
+
+        mid[0] = cx0; mid[1] = cy0;
+        mid[2] = x1;  mid[3] = y1;
+        mid[4] = x2;  mid[5] = y2;
+
+        // need these so we can update the state at the end of this method
+        final double xf = mid[4], yf = mid[5];
+        double dxs = mid[2] - mid[0];
+        double dys = mid[3] - mid[1];
+        double dxf = mid[4] - mid[2];
+        double dyf = mid[5] - mid[3];
+        if ((dxs == 0.0d && dys == 0.0d) || (dxf == 0.0d && dyf == 0.0d)) {
+            dxs = dxf = mid[4] - mid[0];
+            dys = dyf = mid[5] - mid[1];
+        }
+        if (dxs == 0.0d && dys == 0.0d) {
+            // this happens if the "curve" is just a point
+            lineTo(mid[0], mid[1]);
+            return;
+        }
+        // if these vectors are too small, normalize them, to avoid future
+        // precision problems.
+        if (Math.abs(dxs) < 0.1d && Math.abs(dys) < 0.1d) {
+            double len = Math.sqrt(dxs*dxs + dys*dys);
+            dxs /= len;
+            dys /= len;
+        }
+        if (Math.abs(dxf) < 0.1d && Math.abs(dyf) < 0.1d) {
+            double len = Math.sqrt(dxf*dxf + dyf*dyf);
+            dxf /= len;
+            dyf /= len;
+        }
+
+        computeOffset(dxs, dys, lineWidth2, offset0);
+        drawJoin(cdx, cdy, cx0, cy0, dxs, dys, cmx, cmy, offset0[0], offset0[1]);
+
+        int nSplits = findSubdivPoints(curve, mid, subdivTs, 6, lineWidth2);
+
+        double prevt = 0.0d;
+        for (int i = 0, off = 0; i < nSplits; i++, off += 4) {
+            final double t = subdivTs[i];
+            DHelpers.subdivideQuadAt((t - prevt) / (1.0d - prevt),
+                                    mid, off, mid, off, mid, off + 4);
+            prevt = t;
+        }
+
+        final double[] l = lp;
+        final double[] r = rp;
+
+        int kind = 0;
+        for (int i = 0, off = 0; i <= nSplits; i++, off += 4) {
+            kind = computeOffsetQuad(mid, off, l, r);
+
+            emitLineTo(l[0], l[1]);
+
+            switch(kind) {
+            case 6:
+                emitQuadTo(l[2], l[3], l[4], l[5]);
+                emitQuadToRev(r[0], r[1], r[2], r[3]);
+                break;
+            case 4:
+                emitLineTo(l[2], l[3]);
+                emitLineToRev(r[0], r[1]);
+                break;
+            default:
+            }
+            emitLineToRev(r[kind - 2], r[kind - 1]);
+        }
+
+        this.cmx = (l[kind - 2] - r[kind - 2]) / 2.0d;
+        this.cmy = (l[kind - 1] - r[kind - 1]) / 2.0d;
+        this.cdx = dxf;
+        this.cdy = dyf;
+        this.cx0 = xf;
+        this.cy0 = yf;
+        this.prev = DRAWING_OP_TO;
+    }
+
+    @Override public long getNativeConsumer() {
+        throw new InternalError("Stroker doesn't use a native consumer");
+    }
+
+    // a stack of polynomial curves where each curve shares endpoints with
+    // adjacent ones.
+    static final class PolyStack {
+        private static final byte TYPE_LINETO  = (byte) 0;
+        private static final byte TYPE_QUADTO  = (byte) 1;
+        private static final byte TYPE_CUBICTO = (byte) 2;
+
+        // curves capacity = edges count (8192) = edges x 2 (coords)
+        private static final int INITIAL_CURVES_COUNT = INITIAL_EDGES_COUNT << 1;
+
+        // types capacity = edges count (4096)
+        private static final int INITIAL_TYPES_COUNT = INITIAL_EDGES_COUNT;
+
+        double[] curves;
+        int end;
+        byte[] curveTypes;
+        int numCurves;
+
+        // per-thread renderer context
+        final DRendererContext rdrCtx;
+
+        // curves ref (dirty)
+        final DoubleArrayCache.Reference curves_ref;
+        // curveTypes ref (dirty)
+        final ByteArrayCache.Reference curveTypes_ref;
+
+        // used marks (stats only)
+        int curveTypesUseMark;
+        int curvesUseMark;
+
+        /**
+         * Constructor
+         * @param rdrCtx per-thread renderer context
+         */
+        PolyStack(final DRendererContext rdrCtx) {
+            this.rdrCtx = rdrCtx;
+
+            curves_ref = rdrCtx.newDirtyDoubleArrayRef(INITIAL_CURVES_COUNT); // 32K
+            curves     = curves_ref.initial;
+
+            curveTypes_ref = rdrCtx.newDirtyByteArrayRef(INITIAL_TYPES_COUNT); // 4K
+            curveTypes     = curveTypes_ref.initial;
+            numCurves = 0;
+            end = 0;
+
+            if (DO_STATS) {
+                curveTypesUseMark = 0;
+                curvesUseMark = 0;
+            }
+        }
+
+        /**
+         * Disposes this PolyStack:
+         * clean up before reusing this instance
+         */
+        void dispose() {
+            end = 0;
+            numCurves = 0;
+
+            if (DO_STATS) {
+                rdrCtx.stats.stat_rdr_poly_stack_types.add(curveTypesUseMark);
+                rdrCtx.stats.stat_rdr_poly_stack_curves.add(curvesUseMark);
+                rdrCtx.stats.hist_rdr_poly_stack_curves.add(curvesUseMark);
+
+                // reset marks
+                curveTypesUseMark = 0;
+                curvesUseMark = 0;
+            }
+
+            // Return arrays:
+            // curves and curveTypes are kept dirty
+            curves     = curves_ref.putArray(curves);
+            curveTypes = curveTypes_ref.putArray(curveTypes);
+        }
+
+        private void ensureSpace(final int n) {
+            // use substraction to avoid integer overflow:
+            if (curves.length - end < n) {
+                if (DO_STATS) {
+                    rdrCtx.stats.stat_array_stroker_polystack_curves
+                        .add(end + n);
+                }
+                curves = curves_ref.widenArray(curves, end, end + n);
+            }
+            if (curveTypes.length <= numCurves) {
+                if (DO_STATS) {
+                    rdrCtx.stats.stat_array_stroker_polystack_curveTypes
+                        .add(numCurves + 1);
+                }
+                curveTypes = curveTypes_ref.widenArray(curveTypes,
+                                                       numCurves,
+                                                       numCurves + 1);
+            }
+        }
+
+        void pushCubic(double x0, double y0,
+                       double x1, double y1,
+                       double x2, double y2)
+        {
+            ensureSpace(6);
+            curveTypes[numCurves++] = TYPE_CUBICTO;
+            // we reverse the coordinate order to make popping easier
+            final double[] _curves = curves;
+            int e = end;
+            _curves[e++] = x2;    _curves[e++] = y2;
+            _curves[e++] = x1;    _curves[e++] = y1;
+            _curves[e++] = x0;    _curves[e++] = y0;
+            end = e;
+        }
+
+        void pushQuad(double x0, double y0,
+                      double x1, double y1)
+        {
+            ensureSpace(4);
+            curveTypes[numCurves++] = TYPE_QUADTO;
+            final double[] _curves = curves;
+            int e = end;
+            _curves[e++] = x1;    _curves[e++] = y1;
+            _curves[e++] = x0;    _curves[e++] = y0;
+            end = e;
+        }
+
+        void pushLine(double x, double y) {
+            ensureSpace(2);
+            curveTypes[numCurves++] = TYPE_LINETO;
+            curves[end++] = x;    curves[end++] = y;
+        }
+
+        void popAll(DPathConsumer2D io) {
+            if (DO_STATS) {
+                // update used marks:
+                if (numCurves > curveTypesUseMark) {
+                    curveTypesUseMark = numCurves;
+                }
+                if (end > curvesUseMark) {
+                    curvesUseMark = end;
+                }
+            }
+            final byte[]  _curveTypes = curveTypes;
+            final double[] _curves = curves;
+            int nc = numCurves;
+            int e  = end;
+
+            while (nc != 0) {
+                switch(_curveTypes[--nc]) {
+                case TYPE_LINETO:
+                    e -= 2;
+                    io.lineTo(_curves[e], _curves[e+1]);
+                    continue;
+                case TYPE_QUADTO:
+                    e -= 4;
+                    io.quadTo(_curves[e+0], _curves[e+1],
+                              _curves[e+2], _curves[e+3]);
+                    continue;
+                case TYPE_CUBICTO:
+                    e -= 6;
+                    io.curveTo(_curves[e+0], _curves[e+1],
+                               _curves[e+2], _curves[e+3],
+                               _curves[e+4], _curves[e+5]);
+                    continue;
+                default:
+                }
+            }
+            numCurves = 0;
+            end = 0;
+        }
+
+        @Override
+        public String toString() {
+            String ret = "";
+            int nc = numCurves;
+            int last = end;
+            int len;
+            while (nc != 0) {
+                switch(curveTypes[--nc]) {
+                case TYPE_LINETO:
+                    len = 2;
+                    ret += "line: ";
+                    break;
+                case TYPE_QUADTO:
+                    len = 4;
+                    ret += "quad: ";
+                    break;
+                case TYPE_CUBICTO:
+                    len = 6;
+                    ret += "cubic: ";
+                    break;
+                default:
+                    len = 0;
+                }
+                last -= len;
+                ret += Arrays.toString(Arrays.copyOfRange(curves, last, last+len))
+                                       + "\n";
+            }
+            return ret;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DTransformingPathConsumer2D.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,277 @@
+/*
+ * 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.  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.java2d.marlin;
+
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Path2D;
+
+final class DTransformingPathConsumer2D {
+
+    DTransformingPathConsumer2D() {
+        // used by DRendererContext
+    }
+
+    // recycled DPathConsumer2D instance from wrapPath2d()
+    private final Path2DWrapper        wp_Path2DWrapper        = new Path2DWrapper();
+
+    DPathConsumer2D wrapPath2d(Path2D.Double p2d)
+    {
+        return wp_Path2DWrapper.init(p2d);
+    }
+
+    // recycled DPathConsumer2D instances from deltaTransformConsumer()
+    private final DeltaScaleFilter     dt_DeltaScaleFilter     = new DeltaScaleFilter();
+    private final DeltaTransformFilter dt_DeltaTransformFilter = new DeltaTransformFilter();
+
+    DPathConsumer2D deltaTransformConsumer(DPathConsumer2D out,
+                                          AffineTransform at)
+    {
+        if (at == null) {
+            return out;
+        }
+        double mxx = at.getScaleX();
+        double mxy = at.getShearX();
+        double myx = at.getShearY();
+        double myy = at.getScaleY();
+
+        if (mxy == 0.0d && myx == 0.0d) {
+            if (mxx == 1.0d && myy == 1.0d) {
+                return out;
+            } else {
+                return dt_DeltaScaleFilter.init(out, mxx, myy);
+            }
+        } else {
+            return dt_DeltaTransformFilter.init(out, mxx, mxy, myx, myy);
+        }
+    }
+
+    // recycled DPathConsumer2D instances from inverseDeltaTransformConsumer()
+    private final DeltaScaleFilter     iv_DeltaScaleFilter     = new DeltaScaleFilter();
+    private final DeltaTransformFilter iv_DeltaTransformFilter = new DeltaTransformFilter();
+
+    DPathConsumer2D inverseDeltaTransformConsumer(DPathConsumer2D out,
+                                                 AffineTransform at)
+    {
+        if (at == null) {
+            return out;
+        }
+        double mxx = at.getScaleX();
+        double mxy = at.getShearX();
+        double myx = at.getShearY();
+        double myy = at.getScaleY();
+
+        if (mxy == 0.0d && myx == 0.0d) {
+            if (mxx == 1.0d && myy == 1.0d) {
+                return out;
+            } else {
+                return iv_DeltaScaleFilter.init(out, 1.0d/mxx, 1.0d/myy);
+            }
+        } else {
+            double det = mxx * myy - mxy * myx;
+            return iv_DeltaTransformFilter.init(out,
+                                                myy / det,
+                                               -mxy / det,
+                                               -myx / det,
+                                                mxx / det);
+        }
+    }
+
+
+    static final class DeltaScaleFilter implements DPathConsumer2D {
+        private DPathConsumer2D out;
+        private double sx, sy;
+
+        DeltaScaleFilter() {}
+
+        DeltaScaleFilter init(DPathConsumer2D out,
+                              double mxx, double myy)
+        {
+            this.out = out;
+            sx = mxx;
+            sy = myy;
+            return this; // fluent API
+        }
+
+        @Override
+        public void moveTo(double x0, double y0) {
+            out.moveTo(x0 * sx, y0 * sy);
+        }
+
+        @Override
+        public void lineTo(double x1, double y1) {
+            out.lineTo(x1 * sx, y1 * sy);
+        }
+
+        @Override
+        public void quadTo(double x1, double y1,
+                           double x2, double y2)
+        {
+            out.quadTo(x1 * sx, y1 * sy,
+                       x2 * sx, y2 * sy);
+        }
+
+        @Override
+        public void curveTo(double x1, double y1,
+                            double x2, double y2,
+                            double x3, double y3)
+        {
+            out.curveTo(x1 * sx, y1 * sy,
+                        x2 * sx, y2 * sy,
+                        x3 * sx, y3 * sy);
+        }
+
+        @Override
+        public void closePath() {
+            out.closePath();
+        }
+
+        @Override
+        public void pathDone() {
+            out.pathDone();
+        }
+
+        @Override
+        public long getNativeConsumer() {
+            return 0;
+        }
+    }
+
+    static final class DeltaTransformFilter implements DPathConsumer2D {
+        private DPathConsumer2D out;
+        private double mxx, mxy, myx, myy;
+
+        DeltaTransformFilter() {}
+
+        DeltaTransformFilter init(DPathConsumer2D out,
+                                  double mxx, double mxy,
+                                  double myx, double myy)
+        {
+            this.out = out;
+            this.mxx = mxx;
+            this.mxy = mxy;
+            this.myx = myx;
+            this.myy = myy;
+            return this; // fluent API
+        }
+
+        @Override
+        public void moveTo(double x0, double y0) {
+            out.moveTo(x0 * mxx + y0 * mxy,
+                       x0 * myx + y0 * myy);
+        }
+
+        @Override
+        public void lineTo(double x1, double y1) {
+            out.lineTo(x1 * mxx + y1 * mxy,
+                       x1 * myx + y1 * myy);
+        }
+
+        @Override
+        public void quadTo(double x1, double y1,
+                           double x2, double y2)
+        {
+            out.quadTo(x1 * mxx + y1 * mxy,
+                       x1 * myx + y1 * myy,
+                       x2 * mxx + y2 * mxy,
+                       x2 * myx + y2 * myy);
+        }
+
+        @Override
+        public void curveTo(double x1, double y1,
+                            double x2, double y2,
+                            double x3, double y3)
+        {
+            out.curveTo(x1 * mxx + y1 * mxy,
+                        x1 * myx + y1 * myy,
+                        x2 * mxx + y2 * mxy,
+                        x2 * myx + y2 * myy,
+                        x3 * mxx + y3 * mxy,
+                        x3 * myx + y3 * myy);
+        }
+
+        @Override
+        public void closePath() {
+            out.closePath();
+        }
+
+        @Override
+        public void pathDone() {
+            out.pathDone();
+        }
+
+        @Override
+        public long getNativeConsumer() {
+            return 0;
+        }
+    }
+
+    static final class Path2DWrapper implements DPathConsumer2D {
+        private Path2D.Double p2d;
+
+        Path2DWrapper() {}
+
+        Path2DWrapper init(Path2D.Double p2d) {
+            this.p2d = p2d;
+            return this;
+        }
+
+        @Override
+        public void moveTo(double x0, double y0) {
+            p2d.moveTo(x0, y0);
+        }
+
+        @Override
+        public void lineTo(double x1, double y1) {
+            p2d.lineTo(x1, y1);
+        }
+
+        @Override
+        public void closePath() {
+            p2d.closePath();
+        }
+
+        @Override
+        public void pathDone() {}
+
+        @Override
+        public void curveTo(double x1, double y1,
+                            double x2, double y2,
+                            double x3, double y3)
+        {
+            p2d.curveTo(x1, y1, x2, y2, x3, y3);
+        }
+
+        @Override
+        public void quadTo(double x1, double y1, double x2, double y2) {
+            p2d.quadTo(x1, y1, x2, y2);
+        }
+
+        @Override
+        public long getNativeConsumer() {
+            throw new InternalError("Not using a native peer");
+        }
+    }
+}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Dasher.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Dasher.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,11 +39,16 @@
  * semantics are unclear.
  *
  */
-final class Dasher implements sun.awt.geom.PathConsumer2D, MarlinConst {
+final class Dasher implements PathConsumer2D, MarlinConst {
 
     static final int REC_LIMIT = 4;
     static final float ERR = 0.01f;
-    static final float MIN_T_INC = 1f / (1 << REC_LIMIT);
+    static final float MIN_T_INC = 1.0f / (1 << REC_LIMIT);
+
+    // More than 24 bits of mantissa means we can no longer accurately
+    // measure the number of times cycled through the dash array so we
+    // punt and override the phase to just be 0 past that point.
+    static final float MAX_CYCLES = 16000000.0f;
 
     private PathConsumer2D out;
     private float[] dash;
@@ -106,26 +111,56 @@
     Dasher init(final PathConsumer2D out, float[] dash, int dashLen,
                 float phase, boolean recycleDashes)
     {
-        if (phase < 0f) {
-            throw new IllegalArgumentException("phase < 0 !");
-        }
         this.out = out;
 
         // Normalize so 0 <= phase < dash[0]
-        int idx = 0;
+        int sidx = 0;
         dashOn = true;
-        float d;
-        while (phase >= (d = dash[idx])) {
-            phase -= d;
-            idx = (idx + 1) % dashLen;
-            dashOn = !dashOn;
+        float sum = 0.0f;
+        for (float d : dash) {
+            sum += d;
+        }
+        float cycles = phase / sum;
+        if (phase < 0.0f) {
+            if (-cycles >= MAX_CYCLES) {
+                phase = 0.0f;
+            } else {
+                int fullcycles = FloatMath.floor_int(-cycles);
+                if ((fullcycles & dash.length & 1) != 0) {
+                    dashOn = !dashOn;
+                }
+                phase += fullcycles * sum;
+                while (phase < 0.0f) {
+                    if (--sidx < 0) {
+                        sidx = dash.length - 1;
+                    }
+                    phase += dash[sidx];
+                    dashOn = !dashOn;
+                }
+            }
+        } else if (phase > 0) {
+            if (cycles >= MAX_CYCLES) {
+                phase = 0.0f;
+            } else {
+                int fullcycles = FloatMath.floor_int(cycles);
+                if ((fullcycles & dash.length & 1) != 0) {
+                    dashOn = !dashOn;
+                }
+                phase -= fullcycles * sum;
+                float d;
+                while (phase >= (d = dash[sidx])) {
+                    phase -= d;
+                    sidx = (sidx + 1) % dash.length;
+                    dashOn = !dashOn;
+                }
+            }
         }
 
         this.dash = dash;
         this.dashLen = dashLen;
         this.startPhase = this.phase = phase;
         this.startDashOn = dashOn;
-        this.startIdx = idx;
+        this.startIdx = sidx;
         this.starting = true;
         needsMoveTo = false;
         firstSegidx = 0;
@@ -142,7 +177,7 @@
     void dispose() {
         if (DO_CLEAN_DIRTY) {
             // Force zero-fill dirty arrays:
-            Arrays.fill(curCurvepts, 0f);
+            Arrays.fill(curCurvepts, 0.0f);
         }
         // Return arrays:
         if (recycleDashes) {
@@ -151,6 +186,21 @@
         firstSegmentsBuffer = firstSegmentsBuffer_ref.putArray(firstSegmentsBuffer);
     }
 
+    float[] copyDashArray(final float[] dashes) {
+        final int len = dashes.length;
+        final float[] newDashes;
+        if (len <= MarlinConst.INITIAL_ARRAY) {
+            newDashes = dashes_ref.initial;
+        } else {
+            if (DO_STATS) {
+                rdrCtx.stats.stat_array_dasher_dasher.add(len);
+            }
+            newDashes = dashes_ref.getArray(len);
+        }
+        System.arraycopy(dashes, 0, newDashes, 0, len);
+        return newDashes;
+    }
+
     @Override
     public void moveTo(float x0, float y0) {
         if (firstSegidx > 0) {
@@ -202,13 +252,12 @@
     private int firstSegidx;
 
     // precondition: pts must be in relative coordinates (relative to x0,y0)
-    // fullCurve is true iff the curve in pts has not been split.
     private void goTo(float[] pts, int off, final int type) {
         float x = pts[off + type - 4];
         float y = pts[off + type - 3];
         if (dashOn) {
             if (starting) {
-                int len = type - 2 + 1;
+                int len = type - 1; // - 2 + 1
                 int segIdx = firstSegidx;
                 float[] buf = firstSegmentsBuffer;
                 if (segIdx + len  > buf.length) {
@@ -247,7 +296,7 @@
         float dy = y1 - y0;
 
         float len = dx*dx + dy*dy;
-        if (len == 0f) {
+        if (len == 0.0f) {
             return;
         }
         len = (float) Math.sqrt(len);
@@ -275,7 +324,7 @@
                 phase += len;
                 // TODO: compare float values using epsilon:
                 if (len == leftInThisDashSegment) {
-                    phase = 0f;
+                    phase = 0.0f;
                     idx = (idx + 1) % dashLen;
                     dashOn = !dashOn;
                 }
@@ -285,7 +334,7 @@
             dashdx = _dash[idx] * cx;
             dashdy = _dash[idx] * cy;
 
-            if (phase == 0f) {
+            if (phase == 0.0f) {
                 _curCurvepts[0] = x0 + dashdx;
                 _curCurvepts[1] = y0 + dashdy;
             } else {
@@ -300,7 +349,7 @@
             // Advance to next dash segment
             idx = (idx + 1) % dashLen;
             dashOn = !dashOn;
-            phase = 0f;
+            phase = 0.0f;
         }
     }
 
@@ -317,13 +366,13 @@
 
         // initially the current curve is at curCurvepts[0...type]
         int curCurveoff = 0;
-        float lastSplitT = 0f;
+        float lastSplitT = 0.0f;
         float t;
         float leftInThisDashSegment = dash[idx] - phase;
 
-        while ((t = li.next(leftInThisDashSegment)) < 1f) {
-            if (t != 0f) {
-                Helpers.subdivideAt((t - lastSplitT) / (1f - lastSplitT),
+        while ((t = li.next(leftInThisDashSegment)) < 1.0f) {
+            if (t != 0.0f) {
+                Helpers.subdivideAt((t - lastSplitT) / (1.0f - lastSplitT),
                                     curCurvepts, curCurveoff,
                                     curCurvepts, 0,
                                     curCurvepts, type, type);
@@ -334,13 +383,13 @@
             // Advance to next dash segment
             idx = (idx + 1) % dashLen;
             dashOn = !dashOn;
-            phase = 0f;
+            phase = 0.0f;
             leftInThisDashSegment = dash[idx];
         }
         goTo(curCurvepts, curCurveoff+2, type);
         phase += li.lastSegLen();
         if (phase >= dash[idx]) {
-            phase = 0f;
+            phase = 0.0f;
             idx = (idx + 1) % dashLen;
             dashOn = !dashOn;
         }
@@ -395,7 +444,7 @@
 
         // the lengths of the lines of the control polygon. Only its first
         // curveType/2 - 1 elements are valid. This is an optimization. See
-        // next(float) for more detail.
+        // next() for more detail.
         private final float[] curLeafCtrlPolyLengths = new float[3];
 
         LengthIterator() {
@@ -420,13 +469,13 @@
             if (DO_CLEAN_DIRTY) {
                 final int recLimit = recCurveStack.length - 1;
                 for (int i = recLimit; i >= 0; i--) {
-                    Arrays.fill(recCurveStack[i], 0f);
+                    Arrays.fill(recCurveStack[i], 0.0f);
                 }
                 Arrays.fill(sides, Side.LEFT);
-                Arrays.fill(curLeafCtrlPolyLengths, 0f);
-                Arrays.fill(nextRoots, 0f);
-                Arrays.fill(flatLeafCoefCache, 0f);
-                flatLeafCoefCache[2] = -1f;
+                Arrays.fill(curLeafCtrlPolyLengths, 0.0f);
+                Arrays.fill(nextRoots, 0.0f);
+                Arrays.fill(flatLeafCoefCache, 0.0f);
+                flatLeafCoefCache[2] = -1.0f;
             }
         }
 
@@ -435,12 +484,12 @@
             System.arraycopy(pts, 0, recCurveStack[0], 0, 8);
             this.curveType = type;
             this.recLevel = 0;
-            this.lastT = 0f;
-            this.lenAtLastT = 0f;
-            this.nextT = 0f;
-            this.lenAtNextT = 0f;
+            this.lastT = 0.0f;
+            this.lenAtLastT = 0.0f;
+            this.nextT = 0.0f;
+            this.lenAtNextT = 0.0f;
             goLeft(); // initializes nextT and lenAtNextT properly
-            this.lenAtLastSplit = 0f;
+            this.lenAtLastSplit = 0.0f;
             if (recLevel > 0) {
                 this.sides[0] = Side.LEFT;
                 this.done = false;
@@ -449,7 +498,7 @@
                 this.sides[0] = Side.RIGHT;
                 this.done = true;
             }
-            this.lastSegLen = 0f;
+            this.lastSegLen = 0.0f;
         }
 
         // 0 == false, 1 == true, -1 == invalid cached value.
@@ -462,7 +511,7 @@
                 // the test below is equivalent to !within(len1/len2, 1, err).
                 // It is using a multiplication instead of a division, so it
                 // should be a bit faster.
-                if (!Helpers.within(len1, len2, err*len2)) {
+                if (!Helpers.within(len1, len2, err * len2)) {
                     cachedHaveLowAcceleration = 0;
                     return false;
                 }
@@ -493,7 +542,7 @@
         // form (see inside next() for what that means). The cache is
         // invalid when it's third element is negative, since in any
         // valid flattened curve, this would be >= 0.
-        private final float[] flatLeafCoefCache = new float[]{0f, 0f, -1f, 0f};
+        private final float[] flatLeafCoefCache = new float[]{0.0f, 0.0f, -1.0f, 0.0f};
 
         // returns the t value where the remaining curve should be split in
         // order for the left subdivided curve to have length len. If len
@@ -503,7 +552,7 @@
             while (lenAtNextT < targetLength) {
                 if (done) {
                     lastSegLen = lenAtNextT - lenAtLastSplit;
-                    return 1f;
+                    return 1.0f;
                 }
                 goToNextLeaf();
             }
@@ -520,19 +569,19 @@
                 // gives us the desired length.
                 final float[] _flatLeafCoefCache = flatLeafCoefCache;
 
-                if (_flatLeafCoefCache[2] < 0) {
-                    float x = 0f + curLeafCtrlPolyLengths[0],
-                          y = x  + curLeafCtrlPolyLengths[1];
+                if (_flatLeafCoefCache[2] < 0.0f) {
+                    float x =     curLeafCtrlPolyLengths[0],
+                          y = x + curLeafCtrlPolyLengths[1];
                     if (curveType == 8) {
                         float z = y + curLeafCtrlPolyLengths[2];
-                        _flatLeafCoefCache[0] = 3f * (x - y) + z;
-                        _flatLeafCoefCache[1] = 3f * (y - 2f * x);
-                        _flatLeafCoefCache[2] = 3f * x;
+                        _flatLeafCoefCache[0] = 3.0f * (x - y) + z;
+                        _flatLeafCoefCache[1] = 3.0f * (y - 2.0f * x);
+                        _flatLeafCoefCache[2] = 3.0f * x;
                         _flatLeafCoefCache[3] = -z;
                     } else if (curveType == 6) {
-                        _flatLeafCoefCache[0] = 0f;
-                        _flatLeafCoefCache[1] = y - 2f * x;
-                        _flatLeafCoefCache[2] = 2f * x;
+                        _flatLeafCoefCache[0] = 0.0f;
+                        _flatLeafCoefCache[1] = y - 2.0f * x;
+                        _flatLeafCoefCache[2] = 2.0f * x;
                         _flatLeafCoefCache[3] = -y;
                     }
                 }
@@ -544,7 +593,7 @@
                 // we use cubicRootsInAB here, because we want only roots in 0, 1,
                 // and our quadratic root finder doesn't filter, so it's just a
                 // matter of convenience.
-                int n = Helpers.cubicRootsInAB(a, b, c, d, nextRoots, 0, 0, 1);
+                int n = Helpers.cubicRootsInAB(a, b, c, d, nextRoots, 0, 0.0f, 1.0f);
                 if (n == 1 && !Float.isNaN(nextRoots[0])) {
                     t = nextRoots[0];
                 }
@@ -552,8 +601,8 @@
             // t is relative to the current leaf, so we must make it a valid parameter
             // of the original curve.
             t = t * (nextT - lastT) + lastT;
-            if (t >= 1f) {
-                t = 1f;
+            if (t >= 1.0f) {
+                t = 1.0f;
                 done = true;
             }
             // even if done = true, if we're here, that means targetLength
@@ -600,13 +649,13 @@
         // go to the leftmost node from the current node. Return its length.
         private void goLeft() {
             float len = onLeaf();
-            if (len >= 0f) {
+            if (len >= 0.0f) {
                 lastT = nextT;
                 lenAtLastT = lenAtNextT;
                 nextT += (1 << (REC_LIMIT - recLevel)) * MIN_T_INC;
                 lenAtNextT += len;
                 // invalidate caches
-                flatLeafCoefCache[2] = -1f;
+                flatLeafCoefCache[2] = -1.0f;
                 cachedHaveLowAcceleration = -1;
             } else {
                 Helpers.subdivide(recCurveStack[recLevel], 0,
@@ -622,7 +671,7 @@
         // the length of the leaf if we are on a leaf.
         private float onLeaf() {
             float[] curve = recCurveStack[recLevel];
-            float polyLen = 0f;
+            float polyLen = 0.0f;
 
             float x0 = curve[0], y0 = curve[1];
             for (int i = 2; i < curveType; i += 2) {
@@ -638,9 +687,9 @@
                                                   curve[curveType-2],
                                                   curve[curveType-1]);
             if ((polyLen - lineLen) < ERR || recLevel == REC_LIMIT) {
-                return (polyLen + lineLen) / 2f;
+                return (polyLen + lineLen) / 2.0f;
             }
-            return -1f;
+            return -1.0f;
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/DoubleArrayCache.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,273 @@
+/*
+ * 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.  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.java2d.marlin;
+
+import static sun.java2d.marlin.ArrayCacheConst.ARRAY_SIZES;
+import static sun.java2d.marlin.ArrayCacheConst.BUCKETS;
+import static sun.java2d.marlin.ArrayCacheConst.MAX_ARRAY_SIZE;
+import static sun.java2d.marlin.MarlinUtils.logInfo;
+import static sun.java2d.marlin.MarlinUtils.logException;
+
+import java.lang.ref.WeakReference;
+import java.util.Arrays;
+
+import sun.java2d.marlin.ArrayCacheConst.BucketStats;
+import sun.java2d.marlin.ArrayCacheConst.CacheStats;
+
+/*
+ * Note that the [BYTE/INT/FLOAT/DOUBLE]ArrayCache files are nearly identical except
+ * for a few type and name differences. Typically, the [BYTE]ArrayCache.java file
+ * is edited manually and then [INT/FLOAT/DOUBLE]ArrayCache.java
+ * files are generated with the following command lines:
+ */
+// % sed -e 's/(b\yte)[ ]*//g' -e 's/b\yte/int/g' -e 's/B\yte/Int/g' < B\yteArrayCache.java > IntArrayCache.java
+// % sed -e 's/(b\yte)[ ]*0/0.0f/g' -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
+// % sed -e 's/(b\yte)[ ]*0/0.0d/g' -e 's/(b\yte)[ ]*/(double) /g' -e 's/b\yte/double/g' -e 's/B\yte/Double/g' < B\yteArrayCache.java > DoubleArrayCache.java
+
+final class DoubleArrayCache implements MarlinConst {
+
+    final boolean clean;
+    private final int bucketCapacity;
+    private WeakReference<Bucket[]> refBuckets = null;
+    final CacheStats stats;
+
+    DoubleArrayCache(final boolean clean, final int bucketCapacity) {
+        this.clean = clean;
+        this.bucketCapacity = bucketCapacity;
+        this.stats = (DO_STATS) ?
+            new CacheStats(getLogPrefix(clean) + "DoubleArrayCache") : null;
+    }
+
+    Bucket getCacheBucket(final int length) {
+        final int bucket = ArrayCacheConst.getBucket(length);
+        return getBuckets()[bucket];
+    }
+
+    private Bucket[] getBuckets() {
+        // resolve reference:
+        Bucket[] buckets = (refBuckets != null) ? refBuckets.get() : null;
+
+        // create a new buckets ?
+        if (buckets == null) {
+            buckets = new Bucket[BUCKETS];
+
+            for (int i = 0; i < BUCKETS; i++) {
+                buckets[i] = new Bucket(clean, ARRAY_SIZES[i], bucketCapacity,
+                        (DO_STATS) ? stats.bucketStats[i] : null);
+            }
+
+            // update weak reference:
+            refBuckets = new WeakReference<Bucket[]>(buckets);
+        }
+        return buckets;
+    }
+
+    Reference createRef(final int initialSize) {
+        return new Reference(this, initialSize);
+    }
+
+    static final class Reference {
+
+        // initial array reference (direct access)
+        final double[] initial;
+        private final boolean clean;
+        private final DoubleArrayCache cache;
+
+        Reference(final DoubleArrayCache cache, final int initialSize) {
+            this.cache = cache;
+            this.clean = cache.clean;
+            this.initial = createArray(initialSize, clean);
+            if (DO_STATS) {
+                cache.stats.totalInitial += initialSize;
+            }
+        }
+
+        double[] getArray(final int length) {
+            if (length <= MAX_ARRAY_SIZE) {
+                return cache.getCacheBucket(length).getArray();
+            }
+            if (DO_STATS) {
+                cache.stats.oversize++;
+            }
+            if (DO_LOG_OVERSIZE) {
+                logInfo(getLogPrefix(clean) + "DoubleArrayCache: "
+                        + "getArray[oversize]: length=\t" + length);
+            }
+            return createArray(length, clean);
+        }
+
+        double[] widenArray(final double[] array, final int usedSize,
+                          final int needSize)
+        {
+            final int length = array.length;
+            if (DO_CHECKS && length >= needSize) {
+                return array;
+            }
+            if (DO_STATS) {
+                cache.stats.resize++;
+            }
+
+            // maybe change bucket:
+            // ensure getNewSize() > newSize:
+            final double[] res = getArray(ArrayCacheConst.getNewSize(usedSize, needSize));
+
+            // use wrapper to ensure proper copy:
+            System.arraycopy(array, 0, res, 0, usedSize); // copy only used elements
+
+            // maybe return current array:
+            putArray(array, 0, usedSize); // ensure array is cleared
+
+            if (DO_LOG_WIDEN_ARRAY) {
+                logInfo(getLogPrefix(clean) + "DoubleArrayCache: "
+                        + "widenArray[" + res.length
+                        + "]: usedSize=\t" + usedSize + "\tlength=\t" + length
+                        + "\tneeded length=\t" + needSize);
+            }
+            return res;
+        }
+
+        double[] putArray(final double[] array)
+        {
+            // dirty array helper:
+            return putArray(array, 0, array.length);
+        }
+
+        double[] putArray(final double[] array, final int fromIndex,
+                        final int toIndex)
+        {
+            if (array.length <= MAX_ARRAY_SIZE) {
+                if ((clean || DO_CLEAN_DIRTY) && (toIndex != 0)) {
+                    // clean-up array of dirty part[fromIndex; toIndex[
+                    fill(array, fromIndex, toIndex, 0.0d);
+                }
+                // ensure to never store initial arrays in cache:
+                if (array != initial) {
+                    cache.getCacheBucket(array.length).putArray(array);
+                }
+            }
+            return initial;
+        }
+    }
+
+    static final class Bucket {
+
+        private int tail = 0;
+        private final int arraySize;
+        private final boolean clean;
+        private final double[][] arrays;
+        private final BucketStats stats;
+
+        Bucket(final boolean clean, final int arraySize,
+               final int capacity, final BucketStats stats)
+        {
+            this.arraySize = arraySize;
+            this.clean = clean;
+            this.stats = stats;
+            this.arrays = new double[capacity][];
+        }
+
+        double[] getArray() {
+            if (DO_STATS) {
+                stats.getOp++;
+            }
+            // use cache:
+            if (tail != 0) {
+                final double[] array = arrays[--tail];
+                arrays[tail] = null;
+                return array;
+            }
+            if (DO_STATS) {
+                stats.createOp++;
+            }
+            return createArray(arraySize, clean);
+        }
+
+        void putArray(final double[] array)
+        {
+            if (DO_CHECKS && (array.length != arraySize)) {
+                logInfo(getLogPrefix(clean) + "DoubleArrayCache: "
+                        + "bad length = " + array.length);
+                return;
+            }
+            if (DO_STATS) {
+                stats.returnOp++;
+            }
+            // fill cache:
+            if (arrays.length > tail) {
+                arrays[tail++] = array;
+
+                if (DO_STATS) {
+                    stats.updateMaxSize(tail);
+                }
+            } else if (DO_CHECKS) {
+                logInfo(getLogPrefix(clean) + "DoubleArrayCache: "
+                        + "array capacity exceeded !");
+            }
+        }
+    }
+
+    static double[] createArray(final int length, final boolean clean) {
+        if (clean) {
+            return new double[length];
+        }
+        // use JDK9 Unsafe.allocateUninitializedArray(class, length):
+        return (double[]) OffHeapArray.UNSAFE.allocateUninitializedArray(double.class, length);
+    }
+
+    static void fill(final double[] array, final int fromIndex,
+                     final int toIndex, final double value)
+    {
+        // clear array data:
+        Arrays.fill(array, fromIndex, toIndex, value);
+        if (DO_CHECKS) {
+            check(array, fromIndex, toIndex, value);
+        }
+    }
+
+    static void check(final double[] array, final int fromIndex,
+                      final int toIndex, final double value)
+    {
+        if (DO_CHECKS) {
+            // check zero on full array:
+            for (int i = 0; i < array.length; i++) {
+                if (array[i] != value) {
+                    logException("Invalid value at: " + i + " = " + array[i]
+                            + " from: " + fromIndex + " to: " + toIndex + "\n"
+                            + Arrays.toString(array), new Throwable());
+
+                    // ensure array is correctly filled:
+                    Arrays.fill(array, value);
+
+                    return;
+                }
+            }
+        }
+    }
+
+    static String getLogPrefix(final boolean clean) {
+        return (clean) ? "Clean" : "Dirty";
+    }
+}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/FloatArrayCache.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/FloatArrayCache.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package sun.java2d.marlin;
 
 import static sun.java2d.marlin.ArrayCacheConst.ARRAY_SIZES;
@@ -37,13 +38,14 @@
 import sun.java2d.marlin.ArrayCacheConst.CacheStats;
 
 /*
- * Note that the [BYTE/INT/FLOAT]ArrayCache files are nearly identical except
+ * Note that the [BYTE/INT/FLOAT/DOUBLE]ArrayCache files are nearly identical except
  * for a few type and name differences. Typically, the [BYTE]ArrayCache.java file
- * is edited manually and then [INT]ArrayCache.java and [FLOAT]ArrayCache.java
+ * is edited manually and then [INT/FLOAT/DOUBLE]ArrayCache.java
  * files are generated with the following command lines:
  */
 // % sed -e 's/(b\yte)[ ]*//g' -e 's/b\yte/int/g' -e 's/B\yte/Int/g' < B\yteArrayCache.java > IntArrayCache.java
-// % sed -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
+// % sed -e 's/(b\yte)[ ]*0/0.0f/g' -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
+// % sed -e 's/(b\yte)[ ]*0/0.0d/g' -e 's/(b\yte)[ ]*/(double) /g' -e 's/b\yte/double/g' -e 's/B\yte/Double/g' < B\yteArrayCache.java > DoubleArrayCache.java
 
 final class FloatArrayCache implements MarlinConst {
 
@@ -159,7 +161,7 @@
             if (array.length <= MAX_ARRAY_SIZE) {
                 if ((clean || DO_CLEAN_DIRTY) && (toIndex != 0)) {
                     // clean-up array of dirty part[fromIndex; toIndex[
-                    fill(array, fromIndex, toIndex, (float) 0);
+                    fill(array, fromIndex, toIndex, 0.0f);
                 }
                 // ensure to never store initial arrays in cache:
                 if (array != initial) {
@@ -231,8 +233,8 @@
         if (clean) {
             return new float[length];
         }
-       // use JDK9 Unsafe.allocateUninitializedArray(class, length):
-       return (float[]) OffHeapArray.UNSAFE.allocateUninitializedArray(float.class, length);
+        // use JDK9 Unsafe.allocateUninitializedArray(class, length):
+        return (float[]) OffHeapArray.UNSAFE.allocateUninitializedArray(float.class, length);
     }
 
     static void fill(final float[] array, final int fromIndex,
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/FloatMath.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/FloatMath.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -22,10 +22,9 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package sun.java2d.marlin;
 
-import jdk.internal.math.FloatConsts;
-
 /**
  * Faster Math ceil / floor routines derived from StrictMath
  */
@@ -34,17 +33,17 @@
     // overflow / NaN handling enabled:
     static final boolean CHECK_OVERFLOW = true;
     static final boolean CHECK_NAN = true;
+    // Copied from sun.misc.FloatConsts:
+    public static final int FLOAT_SIGNIFICAND_WIDTH = 24;   // sun.misc.FloatConsts.SIGNIFICAND_WIDTH
+    public static final int FLOAT_EXP_BIAS = 127;           // sun.misc.FloatConsts.EXP_BIAS
+    public static final int FLOAT_EXP_BIT_MASK = 2139095040;// sun.misc.FloatConsts.EXP_BIT_MASK
+    public static final int FLOAT_SIGNIF_BIT_MASK = 8388607;// sun.misc.FloatConsts.SIGNIF_BIT_MASK
 
     private FloatMath() {
         // utility class
     }
 
     // faster inlined min/max functions in the branch prediction is high
-    static float max(final float a, final float b) {
-        // no NaN handling
-        return (a >= b) ? a : b;
-    }
-
     static int max(final int a, final int b) {
         return (a >= b) ? a : b;
     }
@@ -77,9 +76,9 @@
         // compute only once Float.floatToRawIntBits(a)
         final int doppel = Float.floatToRawIntBits(a);
 
-        final int exponent = ((doppel & FloatConsts.EXP_BIT_MASK)
-                >> (FloatConsts.SIGNIFICAND_WIDTH - 1))
-                - FloatConsts.EXP_BIAS;
+        final int exponent = ((doppel & FLOAT_EXP_BIT_MASK)
+                >> (FLOAT_SIGNIFICAND_WIDTH - 1))
+                - FLOAT_EXP_BIAS;
 
         if (exponent < 0) {
             /*
@@ -87,8 +86,8 @@
              * floorOrceil(-0.0) => -0.0
              * floorOrceil(+0.0) => +0.0
              */
-            return ((a == 0) ? a :
-                    ( (a < 0f) ? -0f : 1f) );
+            return ((a == 0.0f) ? a :
+                    ( (a < 0.0f) ? -0.0f : 1.0f) );
         }
         if (CHECK_OVERFLOW && (exponent >= 23)) { // 52 for double
             /*
@@ -101,7 +100,7 @@
         assert exponent >= 0 && exponent <= 22; // 51 for double
 
         final int intpart = doppel
-                & (~(FloatConsts.SIGNIF_BIT_MASK >> exponent));
+                & (~(FLOAT_SIGNIF_BIT_MASK >> exponent));
 
         if (intpart == doppel) {
             return a; // integral value (including 0)
@@ -134,9 +133,9 @@
         // compute only once Float.floatToRawIntBits(a)
         final int doppel = Float.floatToRawIntBits(a);
 
-        final int exponent = ((doppel & FloatConsts.EXP_BIT_MASK)
-                >> (FloatConsts.SIGNIFICAND_WIDTH - 1))
-                - FloatConsts.EXP_BIAS;
+        final int exponent = ((doppel & FLOAT_EXP_BIT_MASK)
+                >> (FLOAT_SIGNIFICAND_WIDTH - 1))
+                - FLOAT_EXP_BIAS;
 
         if (exponent < 0) {
             /*
@@ -144,8 +143,8 @@
              * floorOrceil(-0.0) => -0.0
              * floorOrceil(+0.0) => +0.0
              */
-            return ((a == 0) ? a :
-                    ( (a < 0f) ? -1f : 0f) );
+            return ((a == 0.0f) ? a :
+                    ( (a < 0.0f) ? -1.0f : 0.0f) );
         }
         if (CHECK_OVERFLOW && (exponent >= 23)) { // 52 for double
             /*
@@ -158,7 +157,7 @@
         assert exponent >= 0 && exponent <= 22; // 51 for double
 
         final int intpart = doppel
-                & (~(FloatConsts.SIGNIF_BIT_MASK >> exponent));
+                & (~(FLOAT_SIGNIF_BIT_MASK >> exponent));
 
         if (intpart == doppel) {
             return a; // integral value (including 0)
@@ -191,6 +190,26 @@
     }
 
     /**
+     * Faster alternative to ceil(double) optimized for the integer domain
+     * and supporting NaN and +/-Infinity.
+     *
+     * @param a a value.
+     * @return the largest (closest to positive infinity) integer value
+     * that less than or equal to the argument and is equal to a mathematical
+     * integer.
+     */
+    public static int ceil_int(final double a) {
+        final int intpart = (int) a;
+
+        if (a <= intpart
+                || (CHECK_OVERFLOW && intpart == Integer.MAX_VALUE)
+                || CHECK_NAN && Double.isNaN(a)) {
+            return intpart;
+        }
+        return intpart + 1;
+    }
+
+    /**
      * Faster alternative to floor(float) optimized for the integer domain
      * and supporting NaN and +/-Infinity.
      *
@@ -209,4 +228,24 @@
         }
         return intpart - 1;
     }
+
+    /**
+     * Faster alternative to floor(double) optimized for the integer domain
+     * and supporting NaN and +/-Infinity.
+     *
+     * @param a a value.
+     * @return the largest (closest to positive infinity) floating-point value
+     * that less than or equal to the argument and is equal to a mathematical
+     * integer.
+     */
+    public static int floor_int(final double a) {
+        final int intpart = (int) a;
+
+        if (a >= intpart
+                || (CHECK_OVERFLOW && intpart == Integer.MIN_VALUE)
+                || CHECK_NAN && Double.isNaN(a)) {
+            return intpart;
+        }
+        return intpart - 1;
+    }
 }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Helpers.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Helpers.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,27 +52,27 @@
     {
         int ret = off;
         float t;
-        if (a != 0f) {
+        if (a != 0.0f) {
             final float dis = b*b - 4*a*c;
-            if (dis > 0f) {
-                final float sqrtDis = (float)Math.sqrt(dis);
+            if (dis > 0.0f) {
+                final float sqrtDis = (float) Math.sqrt(dis);
                 // depending on the sign of b we use a slightly different
                 // algorithm than the traditional one to find one of the roots
                 // so we can avoid adding numbers of different signs (which
                 // might result in loss of precision).
-                if (b >= 0f) {
-                    zeroes[ret++] = (2f * c) / (-b - sqrtDis);
-                    zeroes[ret++] = (-b - sqrtDis) / (2f * a);
+                if (b >= 0.0f) {
+                    zeroes[ret++] = (2.0f * c) / (-b - sqrtDis);
+                    zeroes[ret++] = (-b - sqrtDis) / (2.0f * a);
                 } else {
-                    zeroes[ret++] = (-b + sqrtDis) / (2f * a);
-                    zeroes[ret++] = (2f * c) / (-b + sqrtDis);
+                    zeroes[ret++] = (-b + sqrtDis) / (2.0f * a);
+                    zeroes[ret++] = (2.0f * c) / (-b + sqrtDis);
                 }
-            } else if (dis == 0f) {
-                t = (-b) / (2f * a);
+            } else if (dis == 0.0f) {
+                t = (-b) / (2.0f * a);
                 zeroes[ret++] = t;
             }
         } else {
-            if (b != 0f) {
+            if (b != 0.0f) {
                 t = (-c) / b;
                 zeroes[ret++] = t;
             }
@@ -85,7 +85,7 @@
                               float[] pts, final int off,
                               final float A, final float B)
     {
-        if (d == 0f) {
+        if (d == 0.0f) {
             int num = quadraticRoots(a, b, c, pts, off);
             return filterOutNotInAB(pts, off, num, A, B) - off;
         }
@@ -109,8 +109,8 @@
         // q = Q/2
         // instead and use those values for simplicity of the code.
         double sq_A = a * a;
-        double p = (1.0/3.0) * ((-1.0/3.0) * sq_A + b);
-        double q = (1.0/2.0) * ((2.0/27.0) * a * sq_A - (1.0/3.0) * a * b + c);
+        double p = (1.0d/3.0d) * ((-1.0d/3.0d) * sq_A + b);
+        double q = (1.0d/2.0d) * ((2.0d/27.0d) * a * sq_A - (1.0d/3.0d) * a * b + c);
 
         // use Cardano's formula
 
@@ -118,30 +118,30 @@
         double D = q * q + cb_p;
 
         int num;
-        if (D < 0.0) {
+        if (D < 0.0d) {
             // see: http://en.wikipedia.org/wiki/Cubic_function#Trigonometric_.28and_hyperbolic.29_method
-            final double phi = (1.0/3.0) * acos(-q / sqrt(-cb_p));
-            final double t = 2.0 * sqrt(-p);
+            final double phi = (1.0d/3.0d) * acos(-q / sqrt(-cb_p));
+            final double t = 2.0d * sqrt(-p);
 
-            pts[ off+0 ] =  (float)( t * cos(phi));
-            pts[ off+1 ] =  (float)(-t * cos(phi + (PI / 3.0)));
-            pts[ off+2 ] =  (float)(-t * cos(phi - (PI / 3.0)));
+            pts[ off+0 ] = (float) ( t * cos(phi));
+            pts[ off+1 ] = (float) (-t * cos(phi + (PI / 3.0d)));
+            pts[ off+2 ] = (float) (-t * cos(phi - (PI / 3.0d)));
             num = 3;
         } else {
             final double sqrt_D = sqrt(D);
             final double u = cbrt(sqrt_D - q);
             final double v = - cbrt(sqrt_D + q);
 
-            pts[ off ] = (float)(u + v);
+            pts[ off ] = (float) (u + v);
             num = 1;
 
-            if (within(D, 0.0, 1e-8)) {
-                pts[off+1] = -(pts[off] / 2f);
+            if (within(D, 0.0d, 1e-8d)) {
+                pts[off+1] = -(pts[off] / 2.0f);
                 num = 2;
             }
         }
 
-        final float sub = (1f/3f) * a;
+        final float sub = (1.0f/3.0f) * a;
 
         for (int i = 0; i < num; ++i) {
             pts[ off+i ] -= sub;
@@ -178,7 +178,7 @@
 
     static float polyLineLength(float[] poly, final int off, final int nCoords) {
         assert nCoords % 2 == 0 && poly.length >= off + nCoords : "";
-        float acc = 0;
+        float acc = 0.0f;
         for (int i = off + 2; i < off + nCoords; i += 2) {
             acc += linelen(poly[i], poly[i+1], poly[i-2], poly[i-1]);
         }
@@ -188,7 +188,7 @@
     static float linelen(float x1, float y1, float x2, float y2) {
         final float dx = x2 - x1;
         final float dy = y2 - y1;
-        return (float)Math.sqrt(dx*dx + dy*dy);
+        return (float) Math.sqrt(dx*dx + dy*dy);
     }
 
     static void subdivide(float[] src, int srcoff, float[] left, int leftoff,
@@ -218,8 +218,8 @@
     }
 
     // Most of these are copied from classes in java.awt.geom because we need
-    // float versions of these functions, and Line2D, CubicCurve2D,
-    // QuadCurve2D don't provide them.
+    // both single and double precision variants of these functions, and Line2D,
+    // CubicCurve2D, QuadCurve2D don't provide them.
     /**
      * Subdivides the cubic curve specified by the coordinates
      * stored in the <code>src</code> array at indices <code>srcoff</code>
@@ -268,18 +268,18 @@
             right[rightoff + 6] = x2;
             right[rightoff + 7] = y2;
         }
-        x1 = (x1 + ctrlx1) / 2f;
-        y1 = (y1 + ctrly1) / 2f;
-        x2 = (x2 + ctrlx2) / 2f;
-        y2 = (y2 + ctrly2) / 2f;
-        float centerx = (ctrlx1 + ctrlx2) / 2f;
-        float centery = (ctrly1 + ctrly2) / 2f;
-        ctrlx1 = (x1 + centerx) / 2f;
-        ctrly1 = (y1 + centery) / 2f;
-        ctrlx2 = (x2 + centerx) / 2f;
-        ctrly2 = (y2 + centery) / 2f;
-        centerx = (ctrlx1 + ctrlx2) / 2f;
-        centery = (ctrly1 + ctrly2) / 2f;
+        x1 = (x1 + ctrlx1) / 2.0f;
+        y1 = (y1 + ctrly1) / 2.0f;
+        x2 = (x2 + ctrlx2) / 2.0f;
+        y2 = (y2 + ctrly2) / 2.0f;
+        float centerx = (ctrlx1 + ctrlx2) / 2.0f;
+        float centery = (ctrly1 + ctrly2) / 2.0f;
+        ctrlx1 = (x1 + centerx) / 2.0f;
+        ctrly1 = (y1 + centery) / 2.0f;
+        ctrlx2 = (x2 + centerx) / 2.0f;
+        ctrly2 = (y2 + centery) / 2.0f;
+        centerx = (ctrlx1 + ctrlx2) / 2.0f;
+        centery = (ctrly1 + ctrly2) / 2.0f;
         if (left != null) {
             left[leftoff + 2] = x1;
             left[leftoff + 3] = y1;
@@ -367,12 +367,12 @@
             right[rightoff + 4] = x2;
             right[rightoff + 5] = y2;
         }
-        x1 = (x1 + ctrlx) / 2f;
-        y1 = (y1 + ctrly) / 2f;
-        x2 = (x2 + ctrlx) / 2f;
-        y2 = (y2 + ctrly) / 2f;
-        ctrlx = (x1 + x2) / 2f;
-        ctrly = (y1 + y2) / 2f;
+        x1 = (x1 + ctrlx) / 2.0f;
+        y1 = (y1 + ctrly) / 2.0f;
+        x2 = (x2 + ctrlx) / 2.0f;
+        y2 = (y2 + ctrly) / 2.0f;
+        ctrlx = (x1 + x2) / 2.0f;
+        ctrly = (y1 + y2) / 2.0f;
         if (left != null) {
             left[leftoff + 2] = x1;
             left[leftoff + 3] = y1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/IRendererContext.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.java2d.marlin;
+
+interface IRendererContext extends MarlinConst {
+
+    public RendererStats stats();
+
+    public OffHeapArray newOffHeapArray(final long initialSize);
+
+    public IntArrayCache.Reference newCleanIntArrayRef(final int initialSize);
+
+}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/IntArrayCache.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/IntArrayCache.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package sun.java2d.marlin;
 
 import static sun.java2d.marlin.ArrayCacheConst.ARRAY_SIZES;
@@ -37,13 +38,14 @@
 import sun.java2d.marlin.ArrayCacheConst.CacheStats;
 
 /*
- * Note that the [BYTE/INT/FLOAT]ArrayCache files are nearly identical except
+ * Note that the [BYTE/INT/FLOAT/DOUBLE]ArrayCache files are nearly identical except
  * for a few type and name differences. Typically, the [BYTE]ArrayCache.java file
- * is edited manually and then [INT]ArrayCache.java and [FLOAT]ArrayCache.java
+ * is edited manually and then [INT/FLOAT/DOUBLE]ArrayCache.java
  * files are generated with the following command lines:
  */
 // % sed -e 's/(b\yte)[ ]*//g' -e 's/b\yte/int/g' -e 's/B\yte/Int/g' < B\yteArrayCache.java > IntArrayCache.java
-// % sed -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
+// % sed -e 's/(b\yte)[ ]*0/0.0f/g' -e 's/(b\yte)[ ]*/(float) /g' -e 's/b\yte/float/g' -e 's/B\yte/Float/g' < B\yteArrayCache.java > FloatArrayCache.java
+// % sed -e 's/(b\yte)[ ]*0/0.0d/g' -e 's/(b\yte)[ ]*/(double) /g' -e 's/b\yte/double/g' -e 's/B\yte/Double/g' < B\yteArrayCache.java > DoubleArrayCache.java
 
 final class IntArrayCache implements MarlinConst {
 
@@ -231,8 +233,8 @@
         if (clean) {
             return new int[length];
         }
-       // use JDK9 Unsafe.allocateUninitializedArray(class, length):
-       return (int[]) OffHeapArray.UNSAFE.allocateUninitializedArray(int.class, length);
+        // use JDK9 Unsafe.allocateUninitializedArray(class, length):
+        return (int[]) OffHeapArray.UNSAFE.allocateUninitializedArray(int.class, length);
     }
 
     static void fill(final int[] array, final int fromIndex,
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinCache.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinCache.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
 
     // 2048 (pixelSize) alpha values (width) x 32 rows (tile) = 64K bytes
     // x1 instead of 4 bytes (RLE) ie 1/4 capacity or average good RLE compression
-    static final long INITIAL_CHUNK_ARRAY = TILE_SIZE * INITIAL_PIXEL_DIM; // 64K
+    static final long INITIAL_CHUNK_ARRAY = TILE_H * INITIAL_PIXEL_DIM; // 64K
 
     // The alpha map used by this object (taken out of our map cache) to convert
     // pixel coverage counts gotten from MarlinCache (which are in the range
@@ -72,17 +72,17 @@
 
     // 1D dirty arrays
     // row index in rowAAChunk[]
-    final long[] rowAAChunkIndex = new long[TILE_SIZE];
+    final long[] rowAAChunkIndex = new long[TILE_H];
     // first pixel (inclusive) for each row
-    final int[] rowAAx0 = new int[TILE_SIZE];
+    final int[] rowAAx0 = new int[TILE_H];
     // last pixel (exclusive) for each row
-    final int[] rowAAx1 = new int[TILE_SIZE];
+    final int[] rowAAx1 = new int[TILE_H];
     // encoding mode (0=raw, 1=RLE encoding) for each row
-    final int[] rowAAEnc = new int[TILE_SIZE];
+    final int[] rowAAEnc = new int[TILE_H];
     // coded length (RLE encoding) for each row
-    final long[] rowAALen = new long[TILE_SIZE];
+    final long[] rowAALen = new long[TILE_H];
     // last position in RLE decoding for each row (getAlpha):
-    final long[] rowAAPos = new long[TILE_SIZE];
+    final long[] rowAAPos = new long[TILE_H];
 
     // dirty off-heap array containing pixel coverages for (32) rows (packed)
     // if encoding=raw, it contains alpha coverage values (val) as integer
@@ -97,8 +97,8 @@
     // x=j*TILE_SIZE+bboxX0.
     int[] touchedTile;
 
-    // per-thread renderer context
-    final RendererContext rdrCtx;
+    // per-thread renderer stats
+    final RendererStats rdrStats;
 
     // touchedTile ref (clean)
     private final IntArrayCache.Reference touchedTile_ref;
@@ -107,8 +107,8 @@
 
     boolean useRLE = false;
 
-    MarlinCache(final RendererContext rdrCtx) {
-        this.rdrCtx = rdrCtx;
+    MarlinCache(final IRendererContext rdrCtx) {
+        this.rdrStats = rdrCtx.stats();
 
         rowAAChunk = rdrCtx.newOffHeapArray(INITIAL_CHUNK_ARRAY); // 64K
 
@@ -120,7 +120,7 @@
         tileMax = Integer.MIN_VALUE;
     }
 
-    void init(int minx, int miny, int maxx, int maxy, int edgeSumDeltaY)
+    void init(int minx, int miny, int maxx, int maxy)
     {
         // assert maxy >= miny && maxx >= minx;
         bboxX0 = minx;
@@ -142,47 +142,16 @@
             if (width <= RLE_MIN_WIDTH || width >= RLE_MAX_WIDTH) {
                 useRLE = false;
             } else {
-                // perimeter approach: how fit the total length into given height:
-
-                // if stroking: meanCrossings /= 2 => divide edgeSumDeltaY by 2
-                final int heightSubPixel
-                    = (((maxy - miny) << SUBPIXEL_LG_POSITIONS_Y) << rdrCtx.stroking);
-
-                // check meanDist > block size:
-                // check width / (meanCrossings - 1) >= RLE_THRESHOLD
-
-                // fast case: (meanCrossingPerPixel <= 2) means 1 span only
-                useRLE = (edgeSumDeltaY <= (heightSubPixel << 1))
-                    // note: already checked (meanCrossingPerPixel <= 2)
-                    // rewritten to avoid division:
-                    || (width * heightSubPixel) >
-                            ((edgeSumDeltaY - heightSubPixel) << BLOCK_SIZE_LG);
-
-                if (DO_TRACE && !useRLE) {
-                    final float meanCrossings
-                        = ((float) edgeSumDeltaY) / heightSubPixel;
-                    final float meanDist = width / (meanCrossings - 1);
-
-                    System.out.println("High complexity: "
-                        + " for bbox[width = " + width
-                        + " height = " + (maxy - miny)
-                        + "] edgeSumDeltaY = " + edgeSumDeltaY
-                        + " heightSubPixel = " + heightSubPixel
-                        + " meanCrossings = "+ meanCrossings
-                        + " meanDist = " + meanDist
-                        + " width =  " + (width * heightSubPixel)
-                        + " <= criteria:  " + ((edgeSumDeltaY - heightSubPixel) << BLOCK_SIZE_LG)
-                    );
-                }
+                useRLE = true;
             }
         }
 
         // the ceiling of (maxy - miny + 1) / TILE_SIZE;
-        final int nxTiles = (width + TILE_SIZE) >> TILE_SIZE_LG;
+        final int nxTiles = (width + TILE_W) >> TILE_W_LG;
 
         if (nxTiles > INITIAL_ARRAY) {
             if (DO_STATS) {
-                rdrCtx.stats.stat_array_marlincache_touchedTile.add(nxTiles);
+                rdrStats.stat_array_marlincache_touchedTile.add(nxTiles);
             }
             touchedTile = touchedTile_ref.getArray(nxTiles);
         }
@@ -197,7 +166,7 @@
         resetTileLine(0);
 
         if (DO_STATS) {
-            rdrCtx.stats.totalOffHeap += rowAAChunk.length;
+            rdrStats.totalOffHeap += rowAAChunk.length;
         }
 
         // Return arrays:
@@ -220,14 +189,14 @@
 
         // reset current pos
         if (DO_STATS) {
-            rdrCtx.stats.stat_cache_rowAAChunk.add(rowAAChunkPos);
+            rdrStats.stat_cache_rowAAChunk.add(rowAAChunkPos);
         }
         rowAAChunkPos = 0L;
 
         // Reset touchedTile:
         if (tileMin != Integer.MAX_VALUE) {
             if (DO_STATS) {
-                rdrCtx.stats.stat_cache_tiles.add(tileMax - tileMin);
+                rdrStats.stat_cache_tiles.add(tileMax - tileMin);
             }
             // clean only dirty touchedTile:
             if (tileMax == 1) {
@@ -269,10 +238,6 @@
     void copyAARowNoRLE(final int[] alphaRow, final int y,
                    final int px0, final int px1)
     {
-        if (DO_MONITORS) {
-            rdrCtx.stats.mon_rdr_copyAARow.start();
-        }
-
         // skip useless pixels above boundary
         final int px_bbox1 = FloatMath.min(px1, bboxX1);
 
@@ -308,12 +273,12 @@
             expandRowAAChunk(needSize);
         }
         if (DO_STATS) {
-            rdrCtx.stats.stat_cache_rowAA.add(px_bbox1 - px0);
+            rdrStats.stat_cache_rowAA.add(px_bbox1 - px0);
         }
 
         // rowAA contains only alpha values for range[x0; x1[
         final int[] _touchedTile = touchedTile;
-        final int _TILE_SIZE_LG = TILE_SIZE_LG;
+        final int _TILE_SIZE_LG = TILE_W_LG;
 
         final int from = px0      - bboxX0; // first pixel inclusive
         final int to   = px_bbox1 - bboxX0; //  last pixel exclusive
@@ -342,9 +307,9 @@
 
             // store alpha sum (as byte):
             if (val == 0) {
-                _unsafe.putByte(addr_off, (byte)0); // [0..255]
+                _unsafe.putByte(addr_off, (byte)0); // [0-255]
             } else {
-                _unsafe.putByte(addr_off, _unsafe.getByte(addr_alpha + val)); // [0..255]
+                _unsafe.putByte(addr_off, _unsafe.getByte(addr_alpha + val)); // [0-255]
 
                 // update touchedTile
                 _touchedTile[x >> _TILE_SIZE_LG] += val;
@@ -368,25 +333,17 @@
         }
 
         // Clear alpha row for reuse:
-        IntArrayCache.fill(alphaRow, from, px1 - bboxX0, 0);
-
-        if (DO_MONITORS) {
-            rdrCtx.stats.mon_rdr_copyAARow.stop();
-        }
+        IntArrayCache.fill(alphaRow, from, px1 + 1 - bboxX0, 0);
     }
 
     void copyAARowRLE_WithBlockFlags(final int[] blkFlags, final int[] alphaRow,
                       final int y, final int px0, final int px1)
     {
-        if (DO_MONITORS) {
-            rdrCtx.stats.mon_rdr_copyAARow.start();
-        }
-
         // Copy rowAA data into the piscesCache if one is present
         final int _bboxX0 = bboxX0;
 
         // process tile line [0 - 32]
-        final int row  = y - bboxY0;
+        final int row  =   y -  bboxY0;
         final int from = px0 - _bboxX0; // first pixel inclusive
 
         // skip useless pixels above boundary
@@ -418,12 +375,14 @@
         long addr_off = _rowAAChunk.address + initialPos;
 
         final int[] _touchedTile = touchedTile;
-        final int _TILE_SIZE_LG = TILE_SIZE_LG;
+        final int _TILE_SIZE_LG = TILE_W_LG;
         final int _BLK_SIZE_LG  = BLOCK_SIZE_LG;
 
         // traverse flagged blocks:
         final int blkW = (from >> _BLK_SIZE_LG);
         final int blkE = (to   >> _BLK_SIZE_LG) + 1;
+        // ensure last block flag = 0 to process final block:
+        blkFlags[blkE] = 0;
 
         // Perform run-length encoding and store results in the piscesCache
         int val = 0;
@@ -481,7 +440,7 @@
                             } else {
                                 _unsafe.putInt(addr_off,
                                     ((_bboxX0 + cx) << 8)
-                                    | (((int) _unsafe.getByte(addr_alpha + val)) & 0xFF) // [0..255]
+                                    | (((int) _unsafe.getByte(addr_alpha + val)) & 0xFF) // [0-255]
                                 );
 
                                 if (runLen == 1) {
@@ -493,7 +452,7 @@
                             addr_off += SIZE_INT;
 
                             if (DO_STATS) {
-                                rdrCtx.stats.hist_tile_generator_encoding_runLen
+                                rdrStats.hist_tile_generator_encoding_runLen
                                     .add(runLen);
                             }
                             cx0 = cx;
@@ -544,7 +503,7 @@
         } else {
             _unsafe.putInt(addr_off,
                 ((_bboxX0 + to) << 8)
-                | (((int) _unsafe.getByte(addr_alpha + val)) & 0xFF) // [0..255]
+                | (((int) _unsafe.getByte(addr_alpha + val)) & 0xFF) // [0-255]
             );
 
             if (runLen == 1) {
@@ -556,7 +515,7 @@
         addr_off += SIZE_INT;
 
         if (DO_STATS) {
-            rdrCtx.stats.hist_tile_generator_encoding_runLen.add(runLen);
+            rdrStats.hist_tile_generator_encoding_runLen.add(runLen);
         }
 
         long len = (addr_off - _rowAAChunk.address);
@@ -568,8 +527,8 @@
         rowAAChunkPos = len;
 
         if (DO_STATS) {
-            rdrCtx.stats.stat_cache_rowAA.add(rowAALen[row]);
-            rdrCtx.stats.hist_tile_generator_encoding_ratio.add(
+            rdrStats.stat_cache_rowAA.add(rowAALen[row]);
+            rdrStats.hist_tile_generator_encoding_ratio.add(
                 (100 * skip) / (blkE - blkW)
             );
         }
@@ -586,17 +545,10 @@
         }
 
         // Clear alpha row for reuse:
-        if (px1 > bboxX1) {
-            alphaRow[to    ] = 0;
-            alphaRow[to + 1] = 0;
-        }
+        alphaRow[to] = 0;
         if (DO_CHECKS) {
             IntArrayCache.check(blkFlags, blkW, blkE, 0);
-            IntArrayCache.check(alphaRow, from, px1 - bboxX0, 0);
-        }
-
-        if (DO_MONITORS) {
-            rdrCtx.stats.mon_rdr_copyAARow.stop();
+            IntArrayCache.check(alphaRow, from, px1 + 1 - bboxX0, 0);
         }
     }
 
@@ -613,7 +565,7 @@
 
     private void expandRowAAChunk(final long needSize) {
         if (DO_STATS) {
-            rdrCtx.stats.stat_array_marlincache_rowAAChunk.add(needSize);
+            rdrStats.stat_array_marlincache_rowAAChunk.add(needSize);
         }
 
         // note: throw IOOB if neededSize > 2Gb:
@@ -629,7 +581,7 @@
     {
         // the x and y of the current row, minus bboxX0, bboxY0
         // process tile line [0 - 32]
-        final int _TILE_SIZE_LG = TILE_SIZE_LG;
+        final int _TILE_SIZE_LG = TILE_W_LG;
 
         // update touchedTile
         int tx = (x0 >> _TILE_SIZE_LG);
@@ -666,7 +618,7 @@
     }
 
     int alphaSumInTile(final int x) {
-        return touchedTile[(x - bboxX0) >> TILE_SIZE_LG];
+        return touchedTile[(x - bboxX0) >> TILE_W_LG];
     }
 
     @Override
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinConst.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -95,10 +95,10 @@
     // 4096 edges for initial capacity
     static final int INITIAL_EDGES_COUNT = MarlinProperties.getInitialEdges();
 
-    // initial edges = 3/4 * edges count (4096)
+    // initial edges = edges count (4096)
     // 6 ints per edges = 24 bytes
-    // edges capacity = 24 x initial edges = 18 * edges count (4096) = 72K
-    static final int INITIAL_EDGES_CAPACITY = INITIAL_EDGES_COUNT * 18;
+    // edges capacity = 24 x initial edges = 24 * edges count (4096) = 96K
+    static final int INITIAL_EDGES_CAPACITY = INITIAL_EDGES_COUNT * 24;
 
     // zero value as byte
     static final byte BYTE_0 = (byte) 0;
@@ -114,14 +114,17 @@
     public static final int SUBPIXEL_POSITIONS_Y = 1 << (SUBPIXEL_LG_POSITIONS_Y);
 
     public static final float NORM_SUBPIXELS
-        = (float)Math.sqrt(( SUBPIXEL_POSITIONS_X * SUBPIXEL_POSITIONS_X
-                           + SUBPIXEL_POSITIONS_Y * SUBPIXEL_POSITIONS_Y)/2.0);
+        = (float) Math.sqrt(( SUBPIXEL_POSITIONS_X * SUBPIXEL_POSITIONS_X
+                            + SUBPIXEL_POSITIONS_Y * SUBPIXEL_POSITIONS_Y) / 2.0d);
 
     public static final int MAX_AA_ALPHA
         = SUBPIXEL_POSITIONS_X * SUBPIXEL_POSITIONS_Y;
 
-    public static final int TILE_SIZE_LG = MarlinProperties.getTileSize_Log2();
-    public static final int TILE_SIZE = 1 << TILE_SIZE_LG; // 32 by default
+    public static final int TILE_H_LG = MarlinProperties.getTileSize_Log2();
+    public static final int TILE_H = 1 << TILE_H_LG; // 32 by default
+
+    public static final int TILE_W_LG = MarlinProperties.getTileWidth_Log2();
+    public static final int TILE_W = 1 << TILE_W_LG; // 32 by default
 
     public static final int BLOCK_SIZE_LG = MarlinProperties.getBlockSize_Log2();
     public static final int BLOCK_SIZE    = 1 << BLOCK_SIZE_LG;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinProperties.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinProperties.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -68,21 +68,21 @@
     /**
      * Return the log(2) corresponding to subpixel on x-axis (
      *
-     * @return 1 (2 subpixels) < initial pixel size < 4 (256 subpixels)
+     * @return 0 (1 subpixels) < initial pixel size < 8 (256 subpixels)
      * (3 by default ie 8 subpixels)
      */
     public static int getSubPixel_Log2_X() {
-        return getInteger("sun.java2d.renderer.subPixel_log2_X", 3, 1, 8);
+        return getInteger("sun.java2d.renderer.subPixel_log2_X", 3, 0, 8);
     }
 
     /**
      * Return the log(2) corresponding to subpixel on y-axis (
      *
-     * @return 1 (2 subpixels) < initial pixel size < 8 (256 subpixels)
+     * @return 0 (1 subpixels) < initial pixel size < 8 (256 subpixels)
      * (3 by default ie 8 subpixels)
      */
     public static int getSubPixel_Log2_Y() {
-        return getInteger("sun.java2d.renderer.subPixel_log2_Y", 3, 1, 8);
+        return getInteger("sun.java2d.renderer.subPixel_log2_Y", 3, 0, 8);
     }
 
     /**
@@ -92,7 +92,18 @@
      * (5 by default ie 32x32 pixels)
      */
     public static int getTileSize_Log2() {
-        return getInteger("sun.java2d.renderer.tileSize_log2", 5, 3, 8);
+        return getInteger("sun.java2d.renderer.tileSize_log2", 5, 3, 10);
+    }
+
+    /**
+     * Return the log(2) corresponding to the tile width in pixels
+     *
+     * @return 3 (8 pixels) < tile with < 8 (256 pixels)
+     * (by default is given by the square tile size)
+     */
+    public static int getTileWidth_Log2() {
+        final int tileSize = getTileSize_Log2();
+        return getInteger("sun.java2d.renderer.tileWidth_log2", tileSize, 3, 10);
     }
 
     /**
@@ -166,6 +177,20 @@
         return getBoolean("sun.java2d.renderer.logUnsafeMalloc", "false");
     }
 
+    // quality settings
+
+    public static float getCubicDecD2() {
+        return getFloat("sun.java2d.renderer.cubic_dec_d2", 1.0f, 0.01f, 4.0f);
+    }
+
+    public static float getCubicIncD1() {
+        return getFloat("sun.java2d.renderer.cubic_inc_d1", 0.4f, 0.01f, 2.0f);
+    }
+
+    public static float getQuadDecD2() {
+        return getFloat("sun.java2d.renderer.quad_dec_d2", 0.5f, 0.01f, 4.0f);
+    }
+
     // system property utilities
     static boolean getBoolean(final String key, final String def) {
         return Boolean.valueOf(AccessController.doPrivileged(
@@ -197,7 +222,36 @@
     }
 
     static int align(final int val, final int norm) {
-        final int ceil = FloatMath.ceil_int( ((float)val) / norm);
+        final int ceil = FloatMath.ceil_int( ((float) val) / norm);
         return ceil * norm;
     }
+
+    public static double getDouble(final String key, final double def,
+                                   final double min, final double max)
+    {
+        double value = def;
+        final String property = AccessController.doPrivileged(
+                                    new GetPropertyAction(key));
+
+        if (property != null) {
+            try {
+                value = Double.parseDouble(property);
+            } catch (NumberFormatException nfe) {
+                logInfo("Invalid value for " + key + " = " + property + " !");
+            }
+        }
+        // check for invalid values
+        if (value < min || value > max) {
+            logInfo("Invalid value for " + key + " = " + value
+                    + "; expect value in range[" + min + ", " + max + "] !");
+            value = def;
+        }
+        return value;
+    }
+
+    public static float getFloat(final String key, final float def,
+                                 final float min, final float max)
+    {
+        return (float)getDouble(key, def, min, max);
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.java2d.marlin;
+
+public interface MarlinRenderer extends MarlinConst {
+
+}
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinRenderingEngine.java	Sat Sep 09 14:36:45 2017 +0200
@@ -44,8 +44,8 @@
 /**
  * Marlin RendererEngine implementation (derived from Pisces)
  */
-public class MarlinRenderingEngine extends RenderingEngine
-                                   implements MarlinConst
+public final class MarlinRenderingEngine extends RenderingEngine
+                                         implements MarlinConst
 {
     private static enum NormMode {
         ON_WITH_AA {
@@ -80,7 +80,7 @@
                                                          PathIterator src);
     }
 
-    private static final float MIN_PEN_SIZE = 1f / NORM_SUBPIXELS;
+    private static final float MIN_PEN_SIZE = 1.0f / NORM_SUBPIXELS;
 
     static final float UPPER_BND = Float.MAX_VALUE / 2.0f;
     static final float LOWER_BND = -UPPER_BND;
@@ -259,7 +259,7 @@
              */
 
             double EA = A*A + B*B;          // x^2 coefficient
-            double EB = 2.0*(A*C + B*D);    // xy coefficient
+            double EB = 2.0d * (A*C + B*D); // xy coefficient
             double EC = C*C + D*D;          // y^2 coefficient
 
             /*
@@ -287,7 +287,7 @@
 
             double hypot = Math.sqrt(EB*EB + (EA-EC)*(EA-EC));
             // sqrt omitted, compare to squared limits below.
-            double widthsquared = ((EA + EC + hypot)/2.0);
+            double widthsquared = ((EA + EC + hypot) / 2.0d);
 
             widthScale = (float)Math.sqrt(widthsquared);
         }
@@ -332,7 +332,7 @@
             final double d = at.getScaleY();
             final double det = a * d - c * b;
 
-            if (Math.abs(det) <= (2f * Float.MIN_VALUE)) {
+            if (Math.abs(det) <= (2.0f * Float.MIN_VALUE)) {
                 // this rendering engine takes one dimensional curves and turns
                 // them into 2D shapes by giving them width.
                 // However, if everything is to be passed through a singular
@@ -344,7 +344,7 @@
                 // of writing of this comment (September 16, 2010)). Actually,
                 // I am not sure if the moveTo is necessary to avoid the SIGSEGV
                 // but the pathDone is definitely needed.
-                pc2d.moveTo(0f, 0f);
+                pc2d.moveTo(0.0f, 0.0f);
                 pc2d.pathDone();
                 return;
             }
@@ -361,17 +361,7 @@
                 if (dashes != null) {
                     recycleDashes = true;
                     dashLen = dashes.length;
-                    final float[] newDashes;
-                    if (dashLen <= INITIAL_ARRAY) {
-                        newDashes = rdrCtx.dasher.dashes_ref.initial;
-                    } else {
-                        if (DO_STATS) {
-                            rdrCtx.stats.stat_array_dasher_dasher.add(dashLen);
-                        }
-                        newDashes = rdrCtx.dasher.dashes_ref.getArray(dashLen);
-                    }
-                    System.arraycopy(dashes, 0, newDashes, 0, dashLen);
-                    dashes = newDashes;
+                    dashes = rdrCtx.dasher.copyDashArray(dashes);
                     for (int i = 0; i < dashLen; i++) {
                         dashes[i] *= scale;
                     }
@@ -445,7 +435,7 @@
     }
 
     private static boolean nearZero(final double num) {
-        return Math.abs(num) < 2.0 * Math.ulp(num);
+        return Math.abs(num) < 2.0d * Math.ulp(num);
     }
 
     abstract static class NormalizingPathIterator implements PathIterator {
@@ -524,8 +514,8 @@
                 case PathIterator.SEG_LINETO:
                     break;
                 case PathIterator.SEG_QUADTO:
-                    coords[0] += (curx_adjust + x_adjust) / 2f;
-                    coords[1] += (cury_adjust + y_adjust) / 2f;
+                    coords[0] += (curx_adjust + x_adjust) / 2.0f;
+                    coords[1] += (cury_adjust + y_adjust) / 2.0f;
                     break;
                 case PathIterator.SEG_CUBICTO:
                     coords[0] += curx_adjust;
@@ -824,10 +814,8 @@
             }
         } finally {
             if (r != null) {
-                // dispose renderer:
+                // dispose renderer and recycle the RendererContext instance:
                 r.dispose();
-                // recycle the RendererContext instance
-                MarlinRenderingEngine.returnRendererContext(rdrCtx);
             }
         }
 
@@ -845,25 +833,25 @@
     {
         // REMIND: Deal with large coordinates!
         double ldx1, ldy1, ldx2, ldy2;
-        boolean innerpgram = (lw1 > 0.0 && lw2 > 0.0);
+        boolean innerpgram = (lw1 > 0.0d && lw2 > 0.0d);
 
         if (innerpgram) {
             ldx1 = dx1 * lw1;
             ldy1 = dy1 * lw1;
             ldx2 = dx2 * lw2;
             ldy2 = dy2 * lw2;
-            x -= (ldx1 + ldx2) / 2.0;
-            y -= (ldy1 + ldy2) / 2.0;
+            x -= (ldx1 + ldx2) / 2.0d;
+            y -= (ldy1 + ldy2) / 2.0d;
             dx1 += ldx1;
             dy1 += ldy1;
             dx2 += ldx2;
             dy2 += ldy2;
-            if (lw1 > 1.0 && lw2 > 1.0) {
+            if (lw1 > 1.0d && lw2 > 1.0d) {
                 // Inner parallelogram was entirely consumed by stroke...
                 innerpgram = false;
             }
         } else {
-            ldx1 = ldy1 = ldx2 = ldy2 = 0.0;
+            ldx1 = ldy1 = ldx2 = ldy2 = 0.0d;
         }
 
         MarlinTileGenerator ptg = null;
@@ -884,10 +872,10 @@
             if (innerpgram) {
                 x += ldx1 + ldx2;
                 y += ldy1 + ldy2;
-                dx1 -= 2.0 * ldx1;
-                dy1 -= 2.0 * ldy1;
-                dx2 -= 2.0 * ldx2;
-                dy2 -= 2.0 * ldy2;
+                dx1 -= 2.0d * ldx1;
+                dy1 -= 2.0d * ldy1;
+                dx2 -= 2.0d * ldx2;
+                dy2 -= 2.0d * ldy2;
                 r.moveTo((float) x, (float) y);
                 r.lineTo((float) (x+dx1), (float) (y+dy1));
                 r.lineTo((float) (x+dx1+dx2), (float) (y+dy1+dy2));
@@ -905,10 +893,8 @@
             }
         } finally {
             if (r != null) {
-                // dispose renderer:
+                // dispose renderer and recycle the RendererContext instance:
                 r.dispose();
-                // recycle the RendererContext instance
-                MarlinRenderingEngine.returnRendererContext(rdrCtx);
             }
         }
 
@@ -1035,12 +1021,11 @@
                 + MarlinConst.SUBPIXEL_LG_POSITIONS_X);
         logInfo("sun.java2d.renderer.subPixel_log2_Y  = "
                 + MarlinConst.SUBPIXEL_LG_POSITIONS_Y);
+
         logInfo("sun.java2d.renderer.tileSize_log2    = "
-                + MarlinConst.TILE_SIZE_LG);
-
-        logInfo("sun.java2d.renderer.blockSize_log2   = "
-                + MarlinConst.BLOCK_SIZE_LG);
-
+                + MarlinConst.TILE_H_LG);
+        logInfo("sun.java2d.renderer.tileWidth_log2   = "
+                + MarlinConst.TILE_W_LG);
         logInfo("sun.java2d.renderer.blockSize_log2   = "
                 + MarlinConst.BLOCK_SIZE_LG);
 
@@ -1078,8 +1063,14 @@
                 + MarlinConst.LOG_UNSAFE_MALLOC);
 
         // quality settings
+        logInfo("sun.java2d.renderer.cubic_dec_d2     = "
+                + MarlinProperties.getCubicDecD2());
+        logInfo("sun.java2d.renderer.cubic_inc_d1     = "
+                + MarlinProperties.getCubicIncD1());
+        logInfo("sun.java2d.renderer.quad_dec_d2      = "
+                + MarlinProperties.getQuadDecD2());
+
         logInfo("Renderer settings:");
-        logInfo("CUB_COUNT_LG = " + Renderer.CUB_COUNT_LG);
         logInfo("CUB_DEC_BND  = " + Renderer.CUB_DEC_BND);
         logInfo("CUB_INC_BND  = " + Renderer.CUB_INC_BND);
         logInfo("QUAD_DEC_BND = " + Renderer.QUAD_DEC_BND);
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinTileGenerator.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/MarlinTileGenerator.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,25 +25,51 @@
 
 package sun.java2d.marlin;
 
+import java.util.Arrays;
 import sun.java2d.pipe.AATileGenerator;
 import jdk.internal.misc.Unsafe;
 
 final class MarlinTileGenerator implements AATileGenerator, MarlinConst {
 
-    private static final int MAX_TILE_ALPHA_SUM = TILE_SIZE * TILE_SIZE
-                                                      * MAX_AA_ALPHA;
+    private static final int MAX_TILE_ALPHA_SUM = TILE_W * TILE_H * MAX_AA_ALPHA;
+
+    private static final int TH_AA_ALPHA_FILL_EMPTY = ((MAX_AA_ALPHA + 1) / 3); // 33%
+    private static final int TH_AA_ALPHA_FILL_FULL  = ((MAX_AA_ALPHA + 1) * 2 / 3); // 66%
+
+    private static final int FILL_TILE_W = TILE_W >> 1; // half tile width
 
-    private final Renderer rdr;
+    static {
+        if (MAX_TILE_ALPHA_SUM <= 0) {
+            throw new IllegalStateException("Invalid MAX_TILE_ALPHA_SUM: " + MAX_TILE_ALPHA_SUM);
+        }
+        if (DO_TRACE) {
+            System.out.println("MAX_AA_ALPHA           : " + MAX_AA_ALPHA);
+            System.out.println("TH_AA_ALPHA_FILL_EMPTY : " + TH_AA_ALPHA_FILL_EMPTY);
+            System.out.println("TH_AA_ALPHA_FILL_FULL  : " + TH_AA_ALPHA_FILL_FULL);
+            System.out.println("FILL_TILE_W            : " + FILL_TILE_W);
+        }
+    }
+
+    private final Renderer rdrF;
+    private final DRenderer rdrD;
     private final MarlinCache cache;
     private int x, y;
 
-    // per-thread renderer context
-    final RendererContext rdrCtx;
+    // per-thread renderer stats
+    final RendererStats rdrStats;
 
-    MarlinTileGenerator(Renderer r) {
-        this.rdr = r;
-        this.cache = r.cache;
-        this.rdrCtx = r.rdrCtx;
+    MarlinTileGenerator(final RendererStats stats, final MarlinRenderer r,
+                        final MarlinCache cache)
+    {
+        this.rdrStats = stats;
+        if (r instanceof Renderer) {
+            this.rdrF = (Renderer)r;
+            this.rdrD = null;
+        } else {
+            this.rdrF = null;
+            this.rdrD = (DRenderer)r;
+        }
+        this.cache = cache;
     }
 
     MarlinTileGenerator init() {
@@ -61,14 +87,17 @@
     public void dispose() {
         if (DO_MONITORS) {
             // called from AAShapePipe.renderTiles() (render tiles end):
-            rdrCtx.stats.mon_pipe_renderTiles.stop();
+            rdrStats.mon_pipe_renderTiles.stop();
         }
         // dispose cache:
         cache.dispose();
-        // dispose renderer:
-        rdr.dispose();
-        // recycle the RendererContext instance
-        MarlinRenderingEngine.returnRendererContext(rdrCtx);
+        // dispose renderer and recycle the RendererContext instance:
+        // bimorphic call optimization:
+        if (rdrF != null) {
+            rdrF.dispose();
+        } else if (rdrD != null) {
+            rdrD.dispose();
+        }
     }
 
     void getBbox(int[] bbox) {
@@ -86,9 +115,9 @@
     public int getTileWidth() {
         if (DO_MONITORS) {
             // called from AAShapePipe.renderTiles() (render tiles start):
-            rdrCtx.stats.mon_pipe_renderTiles.start();
+            rdrStats.mon_pipe_renderTiles.start();
         }
-        return TILE_SIZE;
+        return TILE_W;
     }
 
     /**
@@ -97,7 +126,7 @@
      */
     @Override
     public int getTileHeight() {
-        return TILE_SIZE;
+        return TILE_H;
     }
 
     /**
@@ -131,7 +160,7 @@
         final int alpha = (al == 0x00 ? 0x00
                               : (al == MAX_TILE_ALPHA_SUM ? 0xff : 0x80));
         if (DO_STATS) {
-            rdrCtx.stats.hist_tile_generator_alpha.add(alpha);
+            rdrStats.hist_tile_generator_alpha.add(alpha);
         }
         return alpha;
     }
@@ -143,14 +172,19 @@
      */
     @Override
     public void nextTile() {
-        if ((x += TILE_SIZE) >= cache.bboxX1) {
+        if ((x += TILE_W) >= cache.bboxX1) {
             x = cache.bboxX0;
-            y += TILE_SIZE;
+            y += TILE_H;
 
             if (y < cache.bboxY1) {
                 // compute for the tile line
                 // [ y; max(y + TILE_SIZE, bboxY1) ]
-                this.rdr.endRendering(y);
+                // bimorphic call optimization:
+                if (rdrF != null) {
+                    rdrF.endRendering(y);
+                } else if (rdrD != null) {
+                    rdrD.endRendering(y);
+                }
             }
         }
     }
@@ -180,7 +214,7 @@
                                final int rowstride)
     {
         if (DO_MONITORS) {
-            rdrCtx.stats.mon_ptg_getAlpha.start();
+            rdrStats.mon_ptg_getAlpha.start();
         }
 
         // local vars for performance:
@@ -190,11 +224,11 @@
         final int[] rowAAx1 = _cache.rowAAx1;
 
         final int x0 = this.x;
-        final int x1 = FloatMath.min(x0 + TILE_SIZE, _cache.bboxX1);
+        final int x1 = FloatMath.min(x0 + TILE_W, _cache.bboxX1);
 
         // note: process tile line [0 - 32[
         final int y0 = 0;
-        final int y1 = FloatMath.min(this.y + TILE_SIZE, _cache.bboxY1) - this.y;
+        final int y1 = FloatMath.min(this.y + TILE_H, _cache.bboxY1) - this.y;
 
         if (DO_LOG_BOUNDS) {
             MarlinUtils.logInfo("getAlpha = [" + x0 + " ... " + x1
@@ -237,14 +271,14 @@
                         }
                     }
 
-                    // now: cx >= x0 but cx < aax0 (x1 < aax0)
+                    // now: cx >= x0 and cx >= aax0
 
                     // Copy AA data (sum alpha data):
                     addr = addr_rowAA + rowAAChunkIndex[cy] + (cx - aax0);
 
                     for (end = (aax1 <= x1) ? aax1 : x1; cx < end; cx++) {
                         // cx inside tile[x0; x1[ :
-                        tile[idx++] = _unsafe.getByte(addr); // [0..255]
+                        tile[idx++] = _unsafe.getByte(addr); // [0-255]
                         addr += SIZE;
                     }
                 }
@@ -269,7 +303,7 @@
         nextTile();
 
         if (DO_MONITORS) {
-            rdrCtx.stats.mon_ptg_getAlpha.stop();
+            rdrStats.mon_ptg_getAlpha.stop();
         }
     }
 
@@ -282,7 +316,7 @@
                              final int rowstride)
     {
         if (DO_MONITORS) {
-            rdrCtx.stats.mon_ptg_getAlpha.start();
+            rdrStats.mon_ptg_getAlpha.start();
         }
 
         // Decode run-length encoded alpha mask data
@@ -300,24 +334,48 @@
         final long[] rowAAPos = _cache.rowAAPos;
 
         final int x0 = this.x;
-        final int x1 = FloatMath.min(x0 + TILE_SIZE, _cache.bboxX1);
+        final int x1 = FloatMath.min(x0 + TILE_W, _cache.bboxX1);
+        final int w  = x1 - x0;
 
         // note: process tile line [0 - 32[
         final int y0 = 0;
-        final int y1 = FloatMath.min(this.y + TILE_SIZE, _cache.bboxY1) - this.y;
+        final int y1 = FloatMath.min(this.y + TILE_H, _cache.bboxY1) - this.y;
 
         if (DO_LOG_BOUNDS) {
             MarlinUtils.logInfo("getAlpha = [" + x0 + " ... " + x1
                                 + "[ [" + y0 + " ... " + y1 + "[");
         }
 
+        // avoid too small area: fill is not faster !
+        final int clearTile;
+        final byte refVal;
+        final int area;
+
+        if ((w >= FILL_TILE_W) && (area = w * y1) > 64) { // 64 / 4 ie 16 words min (faster)
+            final int alphaSum = cache.alphaSumInTile(x0);
+
+            if (alphaSum < area * TH_AA_ALPHA_FILL_EMPTY) {
+                clearTile = 1;
+                refVal = 0;
+            } else if (alphaSum > area * TH_AA_ALPHA_FILL_FULL) {
+                clearTile = 2;
+                refVal = (byte)0xff;
+            } else {
+                clearTile = 0;
+                refVal = 0;
+            }
+        } else {
+            clearTile = 0;
+            refVal = 0;
+        }
+
         final Unsafe _unsafe = OffHeapArray.UNSAFE;
         final long SIZE_BYTE = 1L;
         final long SIZE_INT = 4L;
         final long addr_rowAA = _cache.rowAAChunk.address;
         long addr, addr_row, last_addr, addr_end;
 
-        final int skipRowPixels = (rowstride - (x1 - x0));
+        final int skipRowPixels = (rowstride - w);
 
         int cx, cy, cx1;
         int rx0, rx1, runLen, end;
@@ -325,137 +383,414 @@
         byte val;
         int idx = offset;
 
-        for (cy = y0; cy < y1; cy++) {
-            // empty line (default)
-            cx = x0;
+        switch (clearTile) {
+        case 1: // 0x00
+            // Clear full tile rows:
+            Arrays.fill(tile, offset, offset + (y1 * rowstride), refVal);
+
+            for (cy = y0; cy < y1; cy++) {
+                // empty line (default)
+                cx = x0;
+
+                if (rowAAEnc[cy] == 0) {
+                    // Raw encoding:
+
+                    final int aax1 = rowAAx1[cy]; // exclusive
+
+                    // quick check if there is AA data
+                    // corresponding to this tile [x0; x1[
+                    if (aax1 > x0) {
+                        final int aax0 = rowAAx0[cy]; // inclusive
+
+                        if (aax0 < x1) {
+                            // note: cx is the cursor pointer in the tile array
+                            // (left to right)
+                            cx = aax0;
 
-            if (rowAAEnc[cy] == 0) {
-                // Raw encoding:
+                            // ensure cx >= x0
+                            if (cx <= x0) {
+                                cx = x0;
+                            } else {
+                                // skip line start until first AA pixel rowAA exclusive:
+                                idx += (cx - x0); // > 0
+                            }
+
+                            // now: cx >= x0 and cx >= aax0
+
+                            // Copy AA data (sum alpha data):
+                            addr = addr_rowAA + rowAAChunkIndex[cy] + (cx - aax0);
 
-                final int aax1 = rowAAx1[cy]; // exclusive
+                            for (end = (aax1 <= x1) ? aax1 : x1; cx < end; cx++) {
+                                tile[idx++] = _unsafe.getByte(addr); // [0-255]
+                                addr += SIZE_BYTE;
+                            }
+                        }
+                    }
+                } else {
+                    // RLE encoding:
+
+                    // quick check if there is AA data
+                    // corresponding to this tile [x0; x1[
+                    if (rowAAx1[cy] > x0) { // last pixel exclusive
 
-                // quick check if there is AA data
-                // corresponding to this tile [x0; x1[
-                if (aax1 > x0) {
-                    final int aax0 = rowAAx0[cy]; // inclusive
+                        cx = rowAAx0[cy]; // inclusive
+                        if (cx > x1) {
+                            cx = x1;
+                        }
+
+                        // skip line start until first AA pixel rowAA exclusive:
+                        if (cx > x0) {
+                            idx += (cx - x0); // > 0
+                        }
+
+                        // get row address:
+                        addr_row = addr_rowAA + rowAAChunkIndex[cy];
+                        // get row end address:
+                        addr_end = addr_row + rowAALen[cy]; // coded length
+
+                        // reuse previous iteration position:
+                        addr = addr_row + rowAAPos[cy];
+
+                        last_addr = 0L;
+
+                        while ((cx < x1) && (addr < addr_end)) {
+                            // keep current position:
+                            last_addr = addr;
+
+                            // packed value:
+                            packed = _unsafe.getInt(addr);
 
-                    if (aax0 < x1) {
-                        // note: cx is the cursor pointer in the tile array
-                        // (left to right)
-                        cx = aax0;
+                            // last exclusive pixel x-coordinate:
+                            cx1 = (packed >> 8);
+                            // as bytes:
+                            addr += SIZE_INT;
 
-                        // ensure cx >= x0
-                        if (cx <= x0) {
-                            cx = x0;
-                        } else {
-                            // fill line start until first AA pixel rowAA exclusive:
-                            for (end = x0; end < cx; end++) {
-                                tile[idx++] = 0;
+                            rx0 = cx;
+                            if (rx0 < x0) {
+                                rx0 = x0;
+                            }
+                            rx1 = cx = cx1;
+                            if (rx1 > x1) {
+                                rx1 = x1;
+                                cx  = x1; // fix last x
+                            }
+                            // adjust runLen:
+                            runLen = rx1 - rx0;
+
+                            // ensure rx1 > rx0:
+                            if (runLen > 0) {
+                                packed &= 0xFF; // [0-255]
+
+                                if (packed == 0)
+                                {
+                                    idx += runLen;
+                                    continue;
+                                }
+                                val = (byte) packed; // [0-255]
+                                do {
+                                    tile[idx++] = val;
+                                } while (--runLen > 0);
                             }
                         }
 
-                        // now: cx >= x0 but cx < aax0 (x1 < aax0)
-
-                        // Copy AA data (sum alpha data):
-                        addr = addr_rowAA + rowAAChunkIndex[cy] + (cx - aax0);
-
-                        for (end = (aax1 <= x1) ? aax1 : x1; cx < end; cx++) {
-                            tile[idx++] = _unsafe.getByte(addr); // [0..255]
-                            addr += SIZE_BYTE;
+                        // Update last position in RLE entries:
+                        if (last_addr != 0L) {
+                            // Fix x0:
+                            rowAAx0[cy]  = cx; // inclusive
+                            // Fix position:
+                            rowAAPos[cy] = (last_addr - addr_row);
                         }
                     }
                 }
-            } else {
-                // RLE encoding:
+
+                // skip line end
+                if (cx < x1) {
+                    idx += (x1 - cx); // > 0
+                }
+
+                if (DO_TRACE) {
+                    for (int i = idx - (x1 - x0); i < idx; i++) {
+                        System.out.print(hex(tile[i], 2));
+                    }
+                    System.out.println();
+                }
 
-                // quick check if there is AA data
-                // corresponding to this tile [x0; x1[
-                if (rowAAx1[cy] > x0) { // last pixel exclusive
+                idx += skipRowPixels;
+            }
+        break;
 
-                    cx = rowAAx0[cy]; // inclusive
-                    if (cx > x1) {
-                        cx = x1;
-                    }
+        case 0:
+        default:
+            for (cy = y0; cy < y1; cy++) {
+                // empty line (default)
+                cx = x0;
+
+                if (rowAAEnc[cy] == 0) {
+                    // Raw encoding:
+
+                    final int aax1 = rowAAx1[cy]; // exclusive
 
-                    // fill line start until first AA pixel rowAA exclusive:
-                    for (int i = x0; i < cx; i++) {
-                        tile[idx++] = 0;
-                    }
+                    // quick check if there is AA data
+                    // corresponding to this tile [x0; x1[
+                    if (aax1 > x0) {
+                        final int aax0 = rowAAx0[cy]; // inclusive
+
+                        if (aax0 < x1) {
+                            // note: cx is the cursor pointer in the tile array
+                            // (left to right)
+                            cx = aax0;
 
-                    // get row address:
-                    addr_row = addr_rowAA + rowAAChunkIndex[cy];
-                    // get row end address:
-                    addr_end = addr_row + rowAALen[cy]; // coded length
+                            // ensure cx >= x0
+                            if (cx <= x0) {
+                                cx = x0;
+                            } else {
+                                for (end = x0; end < cx; end++) {
+                                    tile[idx++] = 0;
+                                }
+                            }
+
+                            // now: cx >= x0 and cx >= aax0
 
-                    // reuse previous iteration position:
-                    addr = addr_row + rowAAPos[cy];
+                            // Copy AA data (sum alpha data):
+                            addr = addr_rowAA + rowAAChunkIndex[cy] + (cx - aax0);
 
-                    last_addr = 0L;
+                            for (end = (aax1 <= x1) ? aax1 : x1; cx < end; cx++) {
+                                tile[idx++] = _unsafe.getByte(addr); // [0-255]
+                                addr += SIZE_BYTE;
+                            }
+                        }
+                    }
+                } else {
+                    // RLE encoding:
 
-                    while ((cx < x1) && (addr < addr_end)) {
-                        // keep current position:
-                        last_addr = addr;
-
-                        // packed value:
-                        packed = _unsafe.getInt(addr);
+                    // quick check if there is AA data
+                    // corresponding to this tile [x0; x1[
+                    if (rowAAx1[cy] > x0) { // last pixel exclusive
 
-                        // last exclusive pixel x-coordinate:
-                        cx1 = (packed >> 8);
-                        // as bytes:
-                        addr += SIZE_INT;
+                        cx = rowAAx0[cy]; // inclusive
+                        if (cx > x1) {
+                            cx = x1;
+                        }
 
-                        rx0 = cx;
-                        if (rx0 < x0) {
-                            rx0 = x0;
+                        // fill line start until first AA pixel rowAA exclusive:
+                        for (end = x0; end < cx; end++) {
+                            tile[idx++] = 0;
                         }
-                        rx1 = cx = cx1;
-                        if (rx1 > x1) {
-                            rx1 = x1;
-                            cx  = x1; // fix last x
-                        }
-                        // adjust runLen:
-                        runLen = rx1 - rx0;
+
+                        // get row address:
+                        addr_row = addr_rowAA + rowAAChunkIndex[cy];
+                        // get row end address:
+                        addr_end = addr_row + rowAALen[cy]; // coded length
+
+                        // reuse previous iteration position:
+                        addr = addr_row + rowAAPos[cy];
+
+                        last_addr = 0L;
+
+                        while ((cx < x1) && (addr < addr_end)) {
+                            // keep current position:
+                            last_addr = addr;
+
+                            // packed value:
+                            packed = _unsafe.getInt(addr);
+
+                            // last exclusive pixel x-coordinate:
+                            cx1 = (packed >> 8);
+                            // as bytes:
+                            addr += SIZE_INT;
 
-                        // ensure rx1 > rx0:
-                        if (runLen > 0) {
-                            val = (byte)(packed & 0xFF); // [0..255]
+                            rx0 = cx;
+                            if (rx0 < x0) {
+                                rx0 = x0;
+                            }
+                            rx1 = cx = cx1;
+                            if (rx1 > x1) {
+                                rx1 = x1;
+                                cx  = x1; // fix last x
+                            }
+                            // adjust runLen:
+                            runLen = rx1 - rx0;
 
-                            do {
-                                tile[idx++] = val;
-                            } while (--runLen > 0);
+                            // ensure rx1 > rx0:
+                            if (runLen > 0) {
+                                packed &= 0xFF; // [0-255]
+
+                                val = (byte) packed; // [0-255]
+                                do {
+                                    tile[idx++] = val;
+                                } while (--runLen > 0);
+                            }
+                        }
+
+                        // Update last position in RLE entries:
+                        if (last_addr != 0L) {
+                            // Fix x0:
+                            rowAAx0[cy]  = cx; // inclusive
+                            // Fix position:
+                            rowAAPos[cy] = (last_addr - addr_row);
                         }
                     }
+                }
 
-                    // Update last position in RLE entries:
-                    if (last_addr != 0L) {
-                        // Fix x0:
-                        rowAAx0[cy]  = cx; // inclusive
-                        // Fix position:
-                        rowAAPos[cy] = (last_addr - addr_row);
+                // fill line end
+                while (cx < x1) {
+                    tile[idx++] = 0;
+                    cx++;
+                }
+
+                if (DO_TRACE) {
+                    for (int i = idx - (x1 - x0); i < idx; i++) {
+                        System.out.print(hex(tile[i], 2));
+                    }
+                    System.out.println();
+                }
+
+                idx += skipRowPixels;
+            }
+        break;
+
+        case 2: // 0xFF
+            // Fill full tile rows:
+            Arrays.fill(tile, offset, offset + (y1 * rowstride), refVal);
+
+            for (cy = y0; cy < y1; cy++) {
+                // empty line (default)
+                cx = x0;
+
+                if (rowAAEnc[cy] == 0) {
+                    // Raw encoding:
+
+                    final int aax1 = rowAAx1[cy]; // exclusive
+
+                    // quick check if there is AA data
+                    // corresponding to this tile [x0; x1[
+                    if (aax1 > x0) {
+                        final int aax0 = rowAAx0[cy]; // inclusive
+
+                        if (aax0 < x1) {
+                            // note: cx is the cursor pointer in the tile array
+                            // (left to right)
+                            cx = aax0;
+
+                            // ensure cx >= x0
+                            if (cx <= x0) {
+                                cx = x0;
+                            } else {
+                                // fill line start until first AA pixel rowAA exclusive:
+                                for (end = x0; end < cx; end++) {
+                                    tile[idx++] = 0;
+                                }
+                            }
+
+                            // now: cx >= x0 and cx >= aax0
+
+                            // Copy AA data (sum alpha data):
+                            addr = addr_rowAA + rowAAChunkIndex[cy] + (cx - aax0);
+
+                            for (end = (aax1 <= x1) ? aax1 : x1; cx < end; cx++) {
+                                tile[idx++] = _unsafe.getByte(addr); // [0-255]
+                                addr += SIZE_BYTE;
+                            }
+                        }
+                    }
+                } else {
+                    // RLE encoding:
+
+                    // quick check if there is AA data
+                    // corresponding to this tile [x0; x1[
+                    if (rowAAx1[cy] > x0) { // last pixel exclusive
+
+                        cx = rowAAx0[cy]; // inclusive
+                        if (cx > x1) {
+                            cx = x1;
+                        }
+
+                        // fill line start until first AA pixel rowAA exclusive:
+                        for (end = x0; end < cx; end++) {
+                            tile[idx++] = 0;
+                        }
+
+                        // get row address:
+                        addr_row = addr_rowAA + rowAAChunkIndex[cy];
+                        // get row end address:
+                        addr_end = addr_row + rowAALen[cy]; // coded length
+
+                        // reuse previous iteration position:
+                        addr = addr_row + rowAAPos[cy];
+
+                        last_addr = 0L;
+
+                        while ((cx < x1) && (addr < addr_end)) {
+                            // keep current position:
+                            last_addr = addr;
+
+                            // packed value:
+                            packed = _unsafe.getInt(addr);
+
+                            // last exclusive pixel x-coordinate:
+                            cx1 = (packed >> 8);
+                            // as bytes:
+                            addr += SIZE_INT;
+
+                            rx0 = cx;
+                            if (rx0 < x0) {
+                                rx0 = x0;
+                            }
+                            rx1 = cx = cx1;
+                            if (rx1 > x1) {
+                                rx1 = x1;
+                                cx  = x1; // fix last x
+                            }
+                            // adjust runLen:
+                            runLen = rx1 - rx0;
+
+                            // ensure rx1 > rx0:
+                            if (runLen > 0) {
+                                packed &= 0xFF; // [0-255]
+
+                                if (packed == 0xFF)
+                                {
+                                    idx += runLen;
+                                    continue;
+                                }
+                                val = (byte) packed; // [0-255]
+                                do {
+                                    tile[idx++] = val;
+                                } while (--runLen > 0);
+                            }
+                        }
+
+                        // Update last position in RLE entries:
+                        if (last_addr != 0L) {
+                            // Fix x0:
+                            rowAAx0[cy]  = cx; // inclusive
+                            // Fix position:
+                            rowAAPos[cy] = (last_addr - addr_row);
+                        }
                     }
                 }
-            }
 
-            // fill line end
-            while (cx < x1) {
-                tile[idx++] = 0;
-                cx++;
-            }
+                // fill line end
+                while (cx < x1) {
+                    tile[idx++] = 0;
+                    cx++;
+                }
 
-            if (DO_TRACE) {
-                for (int i = idx - (x1 - x0); i < idx; i++) {
-                    System.out.print(hex(tile[i], 2));
+                if (DO_TRACE) {
+                    for (int i = idx - (x1 - x0); i < idx; i++) {
+                        System.out.print(hex(tile[i], 2));
+                    }
+                    System.out.println();
                 }
-                System.out.println();
+
+                idx += skipRowPixels;
             }
-
-            idx += skipRowPixels;
         }
 
         nextTile();
 
         if (DO_MONITORS) {
-            rdrCtx.stats.mon_ptg_getAlpha.stop();
+            rdrStats.mon_ptg_getAlpha.stop();
         }
     }
 
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/OffHeapArray.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/OffHeapArray.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,6 +89,7 @@
                                 + this.length
                                 + " at addr = " + this.address);
         }
+        this.address = 0L;
     }
 
     void fill(final byte val) {
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Renderer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,41 +25,38 @@
 
 package sun.java2d.marlin;
 
-import java.util.Arrays;
 import sun.awt.geom.PathConsumer2D;
 import static sun.java2d.marlin.OffHeapArray.SIZE_INT;
 import jdk.internal.misc.Unsafe;
 
-final class Renderer implements PathConsumer2D, MarlinConst {
+final class Renderer implements PathConsumer2D, MarlinRenderer {
 
     static final boolean DISABLE_RENDER = false;
 
     static final boolean ENABLE_BLOCK_FLAGS = MarlinProperties.isUseTileFlags();
     static final boolean ENABLE_BLOCK_FLAGS_HEURISTICS = MarlinProperties.isUseTileFlagsWithHeuristics();
 
-    private static final int ALL_BUT_LSB = 0xfffffffe;
-    private static final int ERR_STEP_MAX = 0x7fffffff; // = 2^31 - 1
+    private static final int ALL_BUT_LSB = 0xFFFFFFFE;
+    private static final int ERR_STEP_MAX = 0x7FFFFFFF; // = 2^31 - 1
 
-    private static final double POWER_2_TO_32 = 0x1.0p32;
+    private static final double POWER_2_TO_32 = 0x1.0p32d;
 
     // use float to make tosubpix methods faster (no int to float conversion)
-    public static final float F_SUBPIXEL_POSITIONS_X
-        = (float) SUBPIXEL_POSITIONS_X;
-    public static final float F_SUBPIXEL_POSITIONS_Y
-        = (float) SUBPIXEL_POSITIONS_Y;
-    public static final int SUBPIXEL_MASK_X = SUBPIXEL_POSITIONS_X - 1;
-    public static final int SUBPIXEL_MASK_Y = SUBPIXEL_POSITIONS_Y - 1;
+    static final float SUBPIXEL_SCALE_X = (float) SUBPIXEL_POSITIONS_X;
+    static final float SUBPIXEL_SCALE_Y = (float) SUBPIXEL_POSITIONS_Y;
+    static final int SUBPIXEL_MASK_X = SUBPIXEL_POSITIONS_X - 1;
+    static final int SUBPIXEL_MASK_Y = SUBPIXEL_POSITIONS_Y - 1;
 
     // number of subpixels corresponding to a tile line
     private static final int SUBPIXEL_TILE
-        = TILE_SIZE << SUBPIXEL_LG_POSITIONS_Y;
+        = TILE_H << SUBPIXEL_LG_POSITIONS_Y;
 
     // 2048 (pixelSize) pixels (height) x 8 subpixels = 64K
     static final int INITIAL_BUCKET_ARRAY
         = INITIAL_PIXEL_DIM * SUBPIXEL_POSITIONS_Y;
 
-    // crossing capacity = edges count / 8 ~ 512
-    static final int INITIAL_CROSSING_COUNT = INITIAL_EDGES_COUNT >> 3;
+    // crossing capacity = edges count / 4 ~ 1024
+    static final int INITIAL_CROSSING_COUNT = INITIAL_EDGES_COUNT >> 2;
 
     public static final int WIND_EVEN_ODD = 0;
     public static final int WIND_NON_ZERO = 1;
@@ -80,20 +77,20 @@
     // curve break into lines
     // cubic error in subpixels to decrement step
     private static final float CUB_DEC_ERR_SUBPIX
-        = 2.5f * (NORM_SUBPIXELS / 8f); // 2.5 subpixel for typical 8x8 subpixels
+        = MarlinProperties.getCubicDecD2() * (NORM_SUBPIXELS / 8.0f); // 1 pixel
     // cubic error in subpixels to increment step
     private static final float CUB_INC_ERR_SUBPIX
-        = 1f * (NORM_SUBPIXELS / 8f); // 1 subpixel for typical 8x8 subpixels
+        = MarlinProperties.getCubicIncD1() * (NORM_SUBPIXELS / 8.0f); // 0.4 pixel
+
+    // TestNonAARasterization (JDK-8170879): cubics
+    // bad paths (59294/100000 == 59,29%, 94335 bad pixels (avg = 1,59), 3966 warnings (avg = 0,07)
 
-    // cubic bind length to decrement step = 8 * error in subpixels
-    // pisces: 20 / 8
-    // openjfx pisces: 8 / 3.2
-    // multiply by 8 = error scale factor:
+    // cubic bind length to decrement step
     public static final float CUB_DEC_BND
-        = 8f * CUB_DEC_ERR_SUBPIX; // 20f means 2.5 subpixel error
-    // cubic bind length to increment step = 8 * error in subpixels
+        = 8.0f * CUB_DEC_ERR_SUBPIX;
+    // cubic bind length to increment step
     public static final float CUB_INC_BND
-        = 8f * CUB_INC_ERR_SUBPIX; // 8f means 1 subpixel error
+        = 8.0f * CUB_INC_ERR_SUBPIX;
 
     // cubic countlg
     public static final int CUB_COUNT_LG = 2;
@@ -104,21 +101,23 @@
     // cubic count^3 = 8^countlg
     private static final int CUB_COUNT_3 = 1 << (3 * CUB_COUNT_LG);
     // cubic dt = 1 / count
-    private static final float CUB_INV_COUNT = 1f / CUB_COUNT;
+    private static final float CUB_INV_COUNT = 1.0f / CUB_COUNT;
     // cubic dt^2 = 1 / count^2 = 1 / 4^countlg
-    private static final float CUB_INV_COUNT_2 = 1f / CUB_COUNT_2;
+    private static final float CUB_INV_COUNT_2 = 1.0f / CUB_COUNT_2;
     // cubic dt^3 = 1 / count^3 = 1 / 8^countlg
-    private static final float CUB_INV_COUNT_3 = 1f / CUB_COUNT_3;
+    private static final float CUB_INV_COUNT_3 = 1.0f / CUB_COUNT_3;
 
     // quad break into lines
     // quadratic error in subpixels
     private static final float QUAD_DEC_ERR_SUBPIX
-        = 1f * (NORM_SUBPIXELS / 8f); // 1 subpixel for typical 8x8 subpixels
+        = MarlinProperties.getQuadDecD2() * (NORM_SUBPIXELS / 8.0f); // 0.5 pixel
 
-    // quadratic bind length to decrement step = 8 * error in subpixels
-    // pisces and openjfx pisces: 32
+    // TestNonAARasterization (JDK-8170879): quads
+    // bad paths (62916/100000 == 62,92%, 103818 bad pixels (avg = 1,65), 6514 warnings (avg = 0,10)
+
+    // quadratic bind length to decrement step
     public static final float QUAD_DEC_BND
-        = 8f * QUAD_DEC_ERR_SUBPIX; // 8f means 1 subpixel error
+        = 8.0f * QUAD_DEC_ERR_SUBPIX;
 
 //////////////////////////////////////////////////////////////////////////////
 //  SCAN LINE
@@ -157,7 +156,7 @@
     private float edgeMinX = Float.POSITIVE_INFINITY;
     private float edgeMaxX = Float.NEGATIVE_INFINITY;
 
-    // edges [floats|ints] stored in off-heap memory
+    // edges [ints] stored in off-heap memory
     private final OffHeapArray edges;
 
     private int[] edgeBuckets;
@@ -165,8 +164,6 @@
     // used range for edgeBuckets / edgeBucketCounts
     private int buckets_minY;
     private int buckets_maxY;
-    // sum of each edge delta Y (subpixels)
-    private int edgeSumDeltaY;
 
     // edgeBuckets ref (clean)
     private final IntArrayCache.Reference edgeBuckets_ref;
@@ -183,13 +180,13 @@
         int count = 1; // dt = 1 / count
 
         // maximum(ddX|Y) = norm(dbx, dby) * dt^2 (= 1)
-        float maxDD = FloatMath.max(Math.abs(c.dbx), Math.abs(c.dby));
+        float maxDD = Math.abs(c.dbx) + Math.abs(c.dby);
 
         final float _DEC_BND = QUAD_DEC_BND;
 
         while (maxDD >= _DEC_BND) {
             // divide step by half:
-            maxDD /= 4f; // error divided by 2^2 = 4
+            maxDD /= 4.0f; // error divided by 2^2 = 4
 
             count <<= 1;
             if (DO_STATS) {
@@ -199,7 +196,7 @@
 
         int nL = 0; // line count
         if (count > 1) {
-            final float icount = 1f / count; // dt
+            final float icount = 1.0f / count; // dt
             final float icount2 = icount * icount; // dt^2
 
             final float ddx = c.dbx * icount2;
@@ -246,8 +243,8 @@
         // the dx and dy refer to forward differencing variables, not the last
         // coefficients of the "points" polynomial
         float dddx, dddy, ddx, ddy, dx, dy;
-        dddx = 2f * c.dax * icount3;
-        dddy = 2f * c.day * icount3;
+        dddx = 2.0f * c.dax * icount3;
+        dddy = 2.0f * c.day * icount3;
         ddx = dddx + c.dbx * icount2;
         ddy = dddy + c.dby * icount2;
         dx = c.ax * icount3 + c.bx * icount2 + c.cx * icount;
@@ -262,13 +259,13 @@
 
         while (count > 0) {
             // divide step by half:
-            while (Math.abs(ddx) >= _DEC_BND || Math.abs(ddy) >= _DEC_BND) {
-                dddx /= 8f;
-                dddy /= 8f;
-                ddx = ddx/4f - dddx;
-                ddy = ddy/4f - dddy;
-                dx = (dx - ddx) / 2f;
-                dy = (dy - ddy) / 2f;
+            while (Math.abs(ddx) + Math.abs(ddy) >= _DEC_BND) {
+                dddx /= 8.0f;
+                dddy /= 8.0f;
+                ddx = ddx / 4.0f - dddx;
+                ddy = ddy / 4.0f - dddy;
+                dx = (dx - ddx) / 2.0f;
+                dy = (dy - ddy) / 2.0f;
 
                 count <<= 1;
                 if (DO_STATS) {
@@ -277,19 +274,16 @@
             }
 
             // double step:
-            // TODO: why use first derivative dX|Y instead of second ddX|Y ?
-            // both scale changes should use speed or acceleration to have the same metric.
-
             // can only do this on even "count" values, because we must divide count by 2
             while (count % 2 == 0
-                   && Math.abs(dx) <= _INC_BND && Math.abs(dy) <= _INC_BND)
+                   && Math.abs(dx) + Math.abs(dy) <= _INC_BND)
             {
-                dx = 2f * dx + ddx;
-                dy = 2f * dy + ddy;
-                ddx = 4f * (ddx + dddx);
-                ddy = 4f * (ddy + dddy);
-                dddx *= 8f;
-                dddy *= 8f;
+                dx = 2.0f * dx + ddx;
+                dy = 2.0f * dy + ddy;
+                ddx = 4.0f * (ddx + dddx);
+                ddy = 4.0f * (ddy + dddy);
+                dddx *= 8.0f;
+                dddy *= 8.0f;
 
                 count >>= 1;
                 if (DO_STATS) {
@@ -337,7 +331,7 @@
             x1 = tmp;
         }
 
-        // convert subpixel coordinates (float) into pixel positions (int)
+        // convert subpixel coordinates [float] into pixel positions [int]
 
         // The index of the pixel that holds the next HPC is at ceil(trueY - 0.5)
         // Since y1 and y2 are biased by -0.5 in tosubpixy(), this is simply
@@ -361,7 +355,7 @@
             return;
         }
 
-        // edge min/max X/Y are in subpixel space (inclusive) within bounds:
+        // edge min/max X/Y are in subpixel space (half-open interval):
         // note: Use integer crossings to ensure consistent range within
         // edgeBuckets / edgeBucketCounts arrays in case of NaN values (int = 0)
         if (firstCrossing < edgeMinY) {
@@ -376,7 +370,7 @@
         final double y1d   = y1;
         final double slope = (x1d - x2) / (y1d - y2);
 
-        if (slope >= 0.0) { // <==> x1 < x2
+        if (slope >= 0.0d) { // <==> x1 < x2
             if (x1 < edgeMinX) {
                 edgeMinX = x1;
             }
@@ -439,13 +433,13 @@
         // long x1_fixed = x1_intercept * 2^32;  (fixed point 32.32 format)
         // curx = next VPC = fixed_floor(x1_fixed - 2^31 + 2^32 - 1)
         //                 = fixed_floor(x1_fixed + 2^31 - 1)
-        //                 = fixed_floor(x1_fixed + 0x7fffffff)
-        // and error       = fixed_fract(x1_fixed + 0x7fffffff)
+        //                 = fixed_floor(x1_fixed + 0x7FFFFFFF)
+        // and error       = fixed_fract(x1_fixed + 0x7FFFFFFF)
         final double x1_intercept = x1d + (firstCrossing - y1d) * slope;
 
         // inlined scalb(x1_intercept, 32):
         final long x1_fixed_biased = ((long) (POWER_2_TO_32 * x1_intercept))
-                                     + 0x7fffffffL;
+                                     + 0x7FFFFFFFL;
         // curx:
         // last bit corresponds to the orientation
         _unsafe.putInt(addr, (((int) (x1_fixed_biased >> 31L)) & ALL_BUT_LSB) | or);
@@ -474,7 +468,7 @@
         // pointer from bucket
         _unsafe.putInt(addr, _edgeBuckets[bucketIdx]);
         addr += SIZE_INT;
-        // y max (inclusive)
+        // y max (exclusive)
         _unsafe.putInt(addr,  lastCrossing);
 
         // Update buckets:
@@ -484,9 +478,6 @@
         // last bit means edge end
         _edgeBucketCounts[lastCrossing - _boundsMinY] |= 0x1;
 
-        // update sum of delta Y (subpixels):
-        edgeSumDeltaY += (lastCrossing - firstCrossing);
-
         // update free pointer (ie length in bytes)
         _edges.used += _SIZEOF_EDGE_BYTES;
 
@@ -568,8 +559,8 @@
 
     Renderer init(final int pix_boundsX, final int pix_boundsY,
                   final int pix_boundsWidth, final int pix_boundsHeight,
-                  final int windingRule) {
-
+                  final int windingRule)
+    {
         this.windingRule = windingRule;
 
         // bounds as half-open intervals: minX <= x < maxX and minY <= y < maxY
@@ -611,8 +602,6 @@
         activeEdgeMaxUsed = 0;
         edges.used = 0;
 
-        edgeSumDeltaY = 0;
-
         return this; // fluent API
     }
 
@@ -669,15 +658,17 @@
         if (DO_MONITORS) {
             rdrCtx.stats.mon_rdr_endRendering.stop();
         }
+        // recycle the RendererContext instance
+        MarlinRenderingEngine.returnRendererContext(rdrCtx);
     }
 
     private static float tosubpixx(final float pix_x) {
-        return F_SUBPIXEL_POSITIONS_X * pix_x;
+        return SUBPIXEL_SCALE_X * pix_x;
     }
 
     private static float tosubpixy(final float pix_y) {
         // shift y by -0.5 for fast ceil(y - 0.5):
-        return F_SUBPIXEL_POSITIONS_Y * pix_y - 0.5f;
+        return SUBPIXEL_SCALE_Y * pix_y - 0.5f;
     }
 
     @Override
@@ -702,8 +693,8 @@
 
     @Override
     public void curveTo(float x1, float y1,
-            float x2, float y2,
-            float x3, float y3)
+                        float x2, float y2,
+                        float x3, float y3)
     {
         final float xe = tosubpixx(x3);
         final float ye = tosubpixy(y3);
@@ -969,8 +960,8 @@
                         // get the pointer to the edge
                         ecur = _edgePtrs[i];
 
-                        /* convert subpixel coordinates (float) into pixel
-                            positions (int) for coming scanline */
+                        /* convert subpixel coordinates into pixel
+                            positions for coming scanline */
                         /* note: it is faster to always update edges even
                            if it is removed from AEL for coming or last scanline */
 
@@ -1069,8 +1060,8 @@
                         // get the pointer to the edge
                         ecur = _edgePtrs[i];
 
-                        /* convert subpixel coordinates (float) into pixel
-                            positions (int) for coming scanline */
+                        /* convert subpixel coordinates into pixel
+                            positions for coming scanline */
                         /* note: it is faster to always update edges even
                            if it is removed from AEL for coming or last scanline */
 
@@ -1176,7 +1167,14 @@
                             // TODO: perform line clipping on left-right sides
                             // to avoid such bound checks:
                             x0 = (prev > bboxx0) ? prev : bboxx0;
-                            x1 = (curx < bboxx1) ? curx : bboxx1;
+
+                            if (curx < bboxx1) {
+                                x1 = curx;
+                            } else {
+                                x1 = bboxx1;
+                                // skip right side (fast exit loop):
+                                i = numCrossings;
+                            }
 
                             if (x0 < x1) {
                                 x0 -= bboxx0; // turn x0, x1 from coords to indices
@@ -1193,7 +1191,8 @@
 
                                     if (useBlkFlags) {
                                         // flag used blocks:
-                                        _blkFlags[pix_x >> _BLK_SIZE_LG] = 1;
+                                        // note: block processing handles extra pixel:
+                                        _blkFlags[pix_x    >> _BLK_SIZE_LG] = 1;
                                     }
                                 } else {
                                     tmp = (x0 & _SUBPIXEL_MASK_X);
@@ -1212,6 +1211,7 @@
 
                                     if (useBlkFlags) {
                                         // flag used blocks:
+                                        // note: block processing handles extra pixel:
                                         _blkFlags[pix_x    >> _BLK_SIZE_LG] = 1;
                                         _blkFlags[pix_xmax >> _BLK_SIZE_LG] = 1;
                                     }
@@ -1237,7 +1237,14 @@
                             // TODO: perform line clipping on left-right sides
                             // to avoid such bound checks:
                             x0 = (prev > bboxx0) ? prev : bboxx0;
-                            x1 = (curx < bboxx1) ? curx : bboxx1;
+
+                            if (curx < bboxx1) {
+                                x1 = curx;
+                            } else {
+                                x1 = bboxx1;
+                                // skip right side (fast exit loop):
+                                i = numCrossings;
+                            }
 
                             if (x0 < x1) {
                                 x0 -= bboxx0; // turn x0, x1 from coords to indices
@@ -1254,7 +1261,8 @@
 
                                     if (useBlkFlags) {
                                         // flag used blocks:
-                                        _blkFlags[pix_x >> _BLK_SIZE_LG] = 1;
+                                        // note: block processing handles extra pixel:
+                                        _blkFlags[pix_x    >> _BLK_SIZE_LG] = 1;
                                     }
                                 } else {
                                     tmp = (x0 & _SUBPIXEL_MASK_X);
@@ -1273,6 +1281,7 @@
 
                                     if (useBlkFlags) {
                                         // flag used blocks:
+                                        // note: block processing handles extra pixel:
                                         _blkFlags[pix_x    >> _BLK_SIZE_LG] = 1;
                                         _blkFlags[pix_xmax >> _BLK_SIZE_LG] = 1;
                                     }
@@ -1306,9 +1315,12 @@
 
                 if (maxX >= minX) {
                     // note: alpha array will be zeroed by copyAARow()
-                    // +2 because alpha [pix_minX; pix_maxX+1]
+                    // +1 because alpha [pix_minX; pix_maxX[
                     // fix range [x0; x1[
-                    copyAARow(_alpha, lastY, minX, maxX + 2, useBlkFlags);
+                    // note: if x1=bboxx1, then alpha is written up to bboxx1+1
+                    // inclusive: alpha[bboxx1] ignored, alpha[bboxx1+1] == 0
+                    // (normally so never cleared below)
+                    copyAARow(_alpha, lastY, minX, maxX + 1, useBlkFlags);
 
                     // speculative for next pixel row (scanline coherence):
                     if (_enableBlkFlagsHeuristics) {
@@ -1350,9 +1362,12 @@
 
         if (maxX >= minX) {
             // note: alpha array will be zeroed by copyAARow()
-            // +2 because alpha [pix_minX; pix_maxX+1]
+            // +1 because alpha [pix_minX; pix_maxX[
             // fix range [x0; x1[
-            copyAARow(_alpha, y, minX, maxX + 2, useBlkFlags);
+            // note: if x1=bboxx1, then alpha is written up to bboxx1+1
+            // inclusive: alpha[bboxx1] ignored then cleared and
+            // alpha[bboxx1+1] == 0 (normally so never cleared after)
+            copyAARow(_alpha, y, minX, maxX + 1, useBlkFlags);
         } else if (y != lastY) {
             _cache.clearAARow(y);
         }
@@ -1375,36 +1390,26 @@
             return false; // undefined edges bounds
         }
 
-        final int _boundsMinY = boundsMinY;
-        final int _boundsMaxY = boundsMaxY;
-
-        // bounds as inclusive intervals
+        // bounds as half-open intervals
         final int spminX = FloatMath.max(FloatMath.ceil_int(edgeMinX - 0.5f), boundsMinX);
-        final int spmaxX = FloatMath.min(FloatMath.ceil_int(edgeMaxX - 0.5f), boundsMaxX - 1);
+        final int spmaxX = FloatMath.min(FloatMath.ceil_int(edgeMaxX - 0.5f), boundsMaxX);
 
         // edge Min/Max Y are already rounded to subpixels within bounds:
         final int spminY = edgeMinY;
-        final int spmaxY;
-        int maxY = edgeMaxY;
+        final int spmaxY = edgeMaxY;
 
-        if (maxY <= _boundsMaxY - 1) {
-            spmaxY = maxY;
-        } else {
-            spmaxY = _boundsMaxY - 1;
-            maxY   = _boundsMaxY;
-        }
-        buckets_minY = spminY - _boundsMinY;
-        buckets_maxY = maxY   - _boundsMinY;
+        buckets_minY = spminY - boundsMinY;
+        buckets_maxY = spmaxY - boundsMinY;
 
         if (DO_LOG_BOUNDS) {
             MarlinUtils.logInfo("edgesXY = [" + edgeMinX + " ... " + edgeMaxX
-                                + "][" + edgeMinY + " ... " + edgeMaxY + "]");
+                                + "[ [" + edgeMinY + " ... " + edgeMaxY + "[");
             MarlinUtils.logInfo("spXY    = [" + spminX + " ... " + spmaxX
-                                + "][" + spminY + " ... " + spmaxY + "]");
+                                + "[ [" + spminY + " ... " + spmaxY + "[");
         }
 
         // test clipping for shapes out of bounds
-        if ((spminX > spmaxX) || (spminY > spmaxY)) {
+        if ((spminX >= spmaxX) || (spminY >= spmaxY)) {
             return false;
         }
 
@@ -1419,7 +1424,7 @@
         final int pmaxY = (spmaxY + SUBPIXEL_MASK_Y) >> SUBPIXEL_LG_POSITIONS_Y;
 
         // store BBox to answer ptg.getBBox():
-        this.cache.init(pminX, pminY, pmaxX, pmaxY, edgeSumDeltaY);
+        this.cache.init(pminX, pminY, pmaxX, pmaxY);
 
         // Heuristics for using block flags:
         if (ENABLE_BLOCK_FLAGS) {
@@ -1429,9 +1434,9 @@
             if (enableBlkFlags) {
                 // ensure blockFlags array is large enough:
                 // note: +2 to ensure enough space left at end
-                final int nxTiles = ((pmaxX - pminX) >> TILE_SIZE_LG) + 2;
-                if (nxTiles > INITIAL_ARRAY) {
-                    blkFlags = blkFlags_ref.getArray(nxTiles);
+                final int blkLen = ((pmaxX - pminX) >> BLOCK_SIZE_LG) + 2;
+                if (blkLen > INITIAL_ARRAY) {
+                    blkFlags = blkFlags_ref.getArray(blkLen);
                 }
             }
         }
@@ -1446,7 +1451,7 @@
         // inclusive:
         bbox_spminY = spminY;
         // exclusive:
-        bbox_spmaxY = FloatMath.min(spmaxY + 1, pmaxY << SUBPIXEL_LG_POSITIONS_Y);
+        bbox_spmaxY = spmaxY;
 
         if (DO_LOG_BOUNDS) {
             MarlinUtils.logInfo("pXY       = [" + pminX + " ... " + pmaxX
@@ -1504,6 +1509,9 @@
                    final int pix_y, final int pix_from, final int pix_to,
                    final boolean useBlockFlags)
     {
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_copyAARow.start();
+        }
         if (useBlockFlags) {
             if (DO_STATS) {
                 rdrCtx.stats.hist_tile_generator_encoding.add(1);
@@ -1515,5 +1523,8 @@
             }
             cache.copyAARowNoRLE(alphaRow, pix_y, pix_from, pix_to);
         }
+        if (DO_MONITORS) {
+            rdrCtx.stats.mon_rdr_copyAARow.stop();
+        }
     }
 }
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/RendererContext.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -35,7 +35,7 @@
 /**
  * This class is a renderer context dedicated to a single thread
  */
-final class RendererContext extends ReentrantContext implements MarlinConst {
+final class RendererContext extends ReentrantContext implements IRendererContext {
 
     // RendererContext creation counter
     private static final AtomicInteger CTX_COUNT = new AtomicInteger(1);
@@ -121,7 +121,7 @@
         // Renderer:
         cache = new MarlinCache(this);
         renderer = new Renderer(this); // needs MarlinCache from rdrCtx.cache
-        ptg = new MarlinTileGenerator(renderer);
+        ptg = new MarlinTileGenerator(stats, renderer, cache);
 
         stroker = new Stroker(this);
         dasher = new Dasher(this);
@@ -174,14 +174,21 @@
         return p2d;
     }
 
-    OffHeapArray newOffHeapArray(final long initialSize) {
+    @Override
+    public RendererStats stats() {
+        return stats;
+    }
+
+    @Override
+    public OffHeapArray newOffHeapArray(final long initialSize) {
         if (DO_STATS) {
             stats.totalOffHeapInitial += initialSize;
         }
         return new OffHeapArray(cleanerObj, initialSize);
     }
 
-    IntArrayCache.Reference newCleanIntArrayRef(final int initialSize) {
+    @Override
+    public IntArrayCache.Reference newCleanIntArrayRef(final int initialSize) {
         return cleanIntCache.createRef(initialSize);
     }
 
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Stroker.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,12 +26,8 @@
 package sun.java2d.marlin;
 
 import java.util.Arrays;
-import static java.lang.Math.ulp;
-import static java.lang.Math.sqrt;
 
 import sun.awt.geom.PathConsumer2D;
-import sun.java2d.marlin.Curve.BreakPtrIterator;
-
 
 // TODO: some of the arithmetic here is too verbose and prone to hard to
 // debug typos. We should consider making a small Point/Vector class that
@@ -75,7 +71,7 @@
     // pisces used to use fixed point arithmetic with 16 decimal digits. I
     // didn't want to change the values of the constant below when I converted
     // it to floating point, so that's why the divisions by 2^16 are there.
-    private static final float ROUND_JOIN_THRESHOLD = 1000/65536f;
+    private static final float ROUND_JOIN_THRESHOLD = 1000.0f/65536.0f;
 
     private static final float C = 0.5522847498307933f;
 
@@ -112,9 +108,8 @@
     private final PolyStack reverse;
 
     // This is where the curve to be processed is put. We give it
-    // enough room to store 2 curves: one for the current subdivision, the
-    // other for the rest of the curve.
-    private final float[] middle = new float[2 * 8];
+    // enough room to store all curves.
+    private final float[] middle = new float[MAX_N_CURVES * 6 + 2];
     private final float[] lp = new float[8];
     private final float[] rp = new float[8];
     private final float[] subdivTs = new float[MAX_N_CURVES - 1];
@@ -158,8 +153,8 @@
     {
         this.out = pc2d;
 
-        this.lineWidth2 = lineWidth / 2f;
-        this.invHalfLineWidth2Sq = 1f / (2f * lineWidth2 * lineWidth2);
+        this.lineWidth2 = lineWidth / 2.0f;
+        this.invHalfLineWidth2Sq = 1.0f / (2.0f * lineWidth2 * lineWidth2);
         this.capStyle = capStyle;
         this.joinStyle = joinStyle;
 
@@ -182,14 +177,14 @@
 
         if (DO_CLEAN_DIRTY) {
             // Force zero-fill dirty arrays:
-            Arrays.fill(offset0, 0f);
-            Arrays.fill(offset1, 0f);
-            Arrays.fill(offset2, 0f);
-            Arrays.fill(miter, 0f);
-            Arrays.fill(middle, 0f);
-            Arrays.fill(lp, 0f);
-            Arrays.fill(rp, 0f);
-            Arrays.fill(subdivTs, 0f);
+            Arrays.fill(offset0, 0.0f);
+            Arrays.fill(offset1, 0.0f);
+            Arrays.fill(offset2, 0.0f);
+            Arrays.fill(miter, 0.0f);
+            Arrays.fill(middle, 0.0f);
+            Arrays.fill(lp, 0.0f);
+            Arrays.fill(rp, 0.0f);
+            Arrays.fill(subdivTs, 0.0f);
         }
     }
 
@@ -197,11 +192,11 @@
                                       final float w, final float[] m)
     {
         float len = lx*lx + ly*ly;
-        if (len == 0f) {
-            m[0] = 0f;
-            m[1] = 0f;
+        if (len == 0.0f) {
+            m[0] = 0.0f;
+            m[1] = 0.0f;
         } else {
-            len = (float) sqrt(len);
+            len = (float) Math.sqrt(len);
             m[0] =  (ly * w) / len;
             m[1] = -(lx * w) / len;
         }
@@ -226,7 +221,7 @@
                                boolean rev,
                                float threshold)
     {
-        if ((omx == 0f && omy == 0f) || (mx == 0f && my == 0f)) {
+        if ((omx == 0.0f && omy == 0.0f) || (mx == 0.0f && my == 0.0f)) {
             return;
         }
 
@@ -258,7 +253,7 @@
         // If it is >=0, we know that abs(ext) is <= 90 degrees, so we only
         // need 1 curve to approximate the circle section that joins omx,omy
         // and mx,my.
-        final int numCurves = (cosext >= 0f) ? 1 : 2;
+        final int numCurves = (cosext >= 0.0f) ? 1 : 2;
 
         switch (numCurves) {
         case 1:
@@ -280,7 +275,7 @@
             // this normal's length is at least 0.5 and at most sqrt(2)/2 (because
             // we know the angle of the arc is > 90 degrees).
             float nx = my - omy, ny = omx - mx;
-            float nlen = (float) sqrt(nx*nx + ny*ny);
+            float nlen = (float) Math.sqrt(nx*nx + ny*ny);
             float scale = lineWidth2/nlen;
             float mmx = nx * scale, mmy = ny * scale;
 
@@ -318,8 +313,8 @@
         // define the bezier curve we're computing.
         // It is computed using the constraints that P1-P0 and P3-P2 are parallel
         // to the arc tangents at the endpoints, and that |P1-P0|=|P3-P2|.
-        float cv = (float) ((4.0 / 3.0) * sqrt(0.5 - cosext2) /
-                            (1.0 + sqrt(cosext2 + 0.5)));
+        float cv = (float) ((4.0d / 3.0d) * Math.sqrt(0.5d - cosext2) /
+                            (1.0d + Math.sqrt(cosext2 + 0.5d)));
         // if clockwise, we need to negate cv.
         if (rev) { // rev is equivalent to isCW(omx, omy, mx, my)
             cv = -cv;
@@ -348,20 +343,28 @@
                     cx - mx,       cy - my);
     }
 
-    // Put the intersection point of the lines (x0, y0) -> (x1, y1)
-    // and (x0p, y0p) -> (x1p, y1p) in m[off] and m[off+1].
-    // If the lines are parallel, it will put a non finite number in m.
-    private static void computeIntersection(final float x0, final float y0,
-                                            final float x1, final float y1,
-                                            final float x0p, final float y0p,
-                                            final float x1p, final float y1p,
-                                            final float[] m, int off)
+    // Return the intersection point of the lines (x0, y0) -> (x1, y1)
+    // and (x0p, y0p) -> (x1p, y1p) in m[off] and m[off+1]
+    private static void computeMiter(final float x0, final float y0,
+                                     final float x1, final float y1,
+                                     final float x0p, final float y0p,
+                                     final float x1p, final float y1p,
+                                     final float[] m, int off)
     {
         float x10 = x1 - x0;
         float y10 = y1 - y0;
         float x10p = x1p - x0p;
         float y10p = y1p - y0p;
 
+        // if this is 0, the lines are parallel. If they go in the
+        // same direction, there is no intersection so m[off] and
+        // m[off+1] will contain infinity, so no miter will be drawn.
+        // If they go in the same direction that means that the start of the
+        // current segment and the end of the previous segment have the same
+        // tangent, in which case this method won't even be involved in
+        // miter drawing because it won't be called by drawMiter (because
+        // (mx == omx && my == omy) will be true, and drawMiter will return
+        // immediately).
         float den = x10*y10p - x10p*y10;
         float t = x10p*(y0-y0p) - y10p*(x0-x0p);
         t /= den;
@@ -369,6 +372,40 @@
         m[off]   = y0 + t*y10;
     }
 
+    // Return the intersection point of the lines (x0, y0) -> (x1, y1)
+    // and (x0p, y0p) -> (x1p, y1p) in m[off] and m[off+1]
+    private static void safeComputeMiter(final float x0, final float y0,
+                                         final float x1, final float y1,
+                                         final float x0p, final float y0p,
+                                         final float x1p, final float y1p,
+                                         final float[] m, int off)
+    {
+        float x10 = x1 - x0;
+        float y10 = y1 - y0;
+        float x10p = x1p - x0p;
+        float y10p = y1p - y0p;
+
+        // if this is 0, the lines are parallel. If they go in the
+        // same direction, there is no intersection so m[off] and
+        // m[off+1] will contain infinity, so no miter will be drawn.
+        // If they go in the same direction that means that the start of the
+        // current segment and the end of the previous segment have the same
+        // tangent, in which case this method won't even be involved in
+        // miter drawing because it won't be called by drawMiter (because
+        // (mx == omx && my == omy) will be true, and drawMiter will return
+        // immediately).
+        float den = x10*y10p - x10p*y10;
+        if (den == 0.0f) {
+            m[off++] = (x0 + x0p) / 2.0f;
+            m[off]   = (y0 + y0p) / 2.0f;
+            return;
+        }
+        float t = x10p*(y0-y0p) - y10p*(x0-x0p);
+        t /= den;
+        m[off++] = x0 + t*x10;
+        m[off] = y0 + t*y10;
+    }
+
     private void drawMiter(final float pdx, final float pdy,
                            final float x0, final float y0,
                            final float dx, final float dy,
@@ -376,8 +413,8 @@
                            boolean rev)
     {
         if ((mx == omx && my == omy) ||
-            (pdx == 0f && pdy == 0f) ||
-            (dx == 0f && dy == 0f))
+            (pdx == 0.0f && pdy == 0.0f) ||
+            (dx == 0.0f && dy == 0.0f))
         {
             return;
         }
@@ -389,9 +426,9 @@
             my  = -my;
         }
 
-        computeIntersection((x0 - pdx) + omx, (y0 - pdy) + omy, x0 + omx, y0 + omy,
-                            (dx + x0) + mx, (dy + y0) + my, x0 + mx, y0 + my,
-                            miter, 0);
+        computeMiter((x0 - pdx) + omx, (y0 - pdy) + omy, x0 + omx, y0 + omy,
+                     (dx + x0) + mx, (dy + y0) + my, x0 + mx, y0 + my,
+                     miter, 0);
 
         final float miterX = miter[0];
         final float miterY = miter[1];
@@ -414,8 +451,8 @@
         }
         this.sx0 = this.cx0 = x0;
         this.sy0 = this.cy0 = y0;
-        this.cdx = this.sdx = 1f;
-        this.cdy = this.sdy = 0f;
+        this.cdx = this.sdx = 1.0f;
+        this.cdy = this.sdy = 0.0f;
         this.prev = MOVE_TO;
     }
 
@@ -423,8 +460,8 @@
     public void lineTo(float x1, float y1) {
         float dx = x1 - cx0;
         float dy = y1 - cy0;
-        if (dx == 0f && dy == 0f) {
-            dx = 1f;
+        if (dx == 0.0f && dy == 0.0f) {
+            dx = 1.0f;
         }
         computeOffset(dx, dy, lineWidth2, offset0);
         final float mx = offset0[0];
@@ -454,10 +491,10 @@
                 return;
             }
             emitMoveTo(cx0, cy0 - lineWidth2);
-            this.cmx = this.smx = 0f;
+            this.cmx = this.smx = 0.0f;
             this.cmy = this.smy = -lineWidth2;
-            this.cdx = this.sdx = 1f;
-            this.cdy = this.sdy = 0f;
+            this.cdx = this.sdx = 1.0f;
+            this.cdy = this.sdy = 0.0f;
             finish();
             return;
         }
@@ -640,7 +677,7 @@
     {
         // if p1=p2 or p3=p4 it means that the derivative at the endpoint
         // vanishes, which creates problems with computeOffset. Usually
-        // this happens when this stroker object is trying to winden
+        // this happens when this stroker object is trying to widen
         // a curve with a cusp. What happens is that curveTo splits
         // the input curve at the cusp, and passes it to this function.
         // because of inaccuracies in the splitting, we consider points
@@ -657,8 +694,8 @@
 
         // if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4,
         // in which case ignore if p1 == p2
-        final boolean p1eqp2 = within(x1,y1,x2,y2, 6f * ulp(y2));
-        final boolean p3eqp4 = within(x3,y3,x4,y4, 6f * ulp(y4));
+        final boolean p1eqp2 = within(x1, y1, x2, y2, 6.0f * Math.ulp(y2));
+        final boolean p3eqp4 = within(x3, y3, x4, y4, 6.0f * Math.ulp(y4));
         if (p1eqp2 && p3eqp4) {
             getLineOffsets(x1, y1, x4, y4, leftOff, rightOff);
             return 4;
@@ -674,7 +711,7 @@
         float dotsq = (dx1 * dx4 + dy1 * dy4);
         dotsq *= dotsq;
         float l1sq = dx1 * dx1 + dy1 * dy1, l4sq = dx4 * dx4 + dy4 * dy4;
-        if (Helpers.within(dotsq, l1sq * l4sq, 4f * ulp(dotsq))) {
+        if (Helpers.within(dotsq, l1sq * l4sq, 4.0f * Math.ulp(dotsq))) {
             getLineOffsets(x1, y1, x4, y4, leftOff, rightOff);
             return 4;
         }
@@ -726,8 +763,8 @@
 //      getting the inverse of the matrix above. Then we use [c1,c2] to compute
 //      p2p and p3p.
 
-        float x = (x1 + 3f * (x2 + x3) + x4) / 8f;
-        float y = (y1 + 3f * (y2 + y3) + y4) / 8f;
+        float x = (x1 + 3.0f * (x2 + x3) + x4) / 8.0f;
+        float y = (y1 + 3.0f * (y2 + y3) + y4) / 8.0f;
         // (dxm,dym) is some tangent of B at t=0.5. This means it's equal to
         // c*B'(0.5) for some constant c.
         float dxm = x3 + x4 - x1 - x2, dym = y3 + y4 - y1 - y2;
@@ -745,10 +782,10 @@
         float x4p = x4 + offset2[0]; // end
         float y4p = y4 + offset2[1]; // point
 
-        float invdet43 = 4f / (3f * (dx1 * dy4 - dy1 * dx4));
+        float invdet43 = 4.0f / (3.0f * (dx1 * dy4 - dy1 * dx4));
 
-        float two_pi_m_p1_m_p4x = 2f * xi - x1p - x4p;
-        float two_pi_m_p1_m_p4y = 2f * yi - y1p - y4p;
+        float two_pi_m_p1_m_p4x = 2.0f * xi - x1p - x4p;
+        float two_pi_m_p1_m_p4y = 2.0f * yi - y1p - y4p;
         float c1 = invdet43 * (dy4 * two_pi_m_p1_m_p4x - dx4 * two_pi_m_p1_m_p4y);
         float c2 = invdet43 * (dx1 * two_pi_m_p1_m_p4y - dy1 * two_pi_m_p1_m_p4x);
 
@@ -764,11 +801,11 @@
         leftOff[6] = x4p; leftOff[7] = y4p;
 
         x1p = x1 - offset0[0]; y1p = y1 - offset0[1];
-        xi = xi - 2f * offset1[0]; yi = yi - 2f * offset1[1];
+        xi = xi - 2.0f * offset1[0]; yi = yi - 2.0f * offset1[1];
         x4p = x4 - offset2[0]; y4p = y4 - offset2[1];
 
-        two_pi_m_p1_m_p4x = 2f * xi - x1p - x4p;
-        two_pi_m_p1_m_p4y = 2f * yi - y1p - y4p;
+        two_pi_m_p1_m_p4x = 2.0f * xi - x1p - x4p;
+        two_pi_m_p1_m_p4y = 2.0f * yi - y1p - y4p;
         c1 = invdet43 * (dy4 * two_pi_m_p1_m_p4x - dx4 * two_pi_m_p1_m_p4y);
         c2 = invdet43 * (dx1 * two_pi_m_p1_m_p4y - dy1 * two_pi_m_p1_m_p4x);
 
@@ -784,6 +821,8 @@
         return 8;
     }
 
+    // compute offset curves using bezier spline through t=0.5 (i.e.
+    // ComputedCurve(0.5) == IdealParallelCurve(0.5))
     // return the kind of curve in the right and left arrays.
     private int computeOffsetQuad(float[] pts, final int off,
                                   float[] leftOff, float[] rightOff)
@@ -797,170 +836,54 @@
         final float dx1 = x2 - x1;
         final float dy1 = y2 - y1;
 
-        // this computes the offsets at t = 0, 1
+        // if p1=p2 or p3=p4 it means that the derivative at the endpoint
+        // vanishes, which creates problems with computeOffset. Usually
+        // this happens when this stroker object is trying to widen
+        // a curve with a cusp. What happens is that curveTo splits
+        // the input curve at the cusp, and passes it to this function.
+        // because of inaccuracies in the splitting, we consider points
+        // equal if they're very close to each other.
+
+        // if p1 == p2 && p3 == p4: draw line from p1->p4, unless p1 == p4,
+        // in which case ignore.
+        final boolean p1eqp2 = within(x1, y1, x2, y2, 6.0f * Math.ulp(y2));
+        final boolean p2eqp3 = within(x2, y2, x3, y3, 6.0f * Math.ulp(y3));
+        if (p1eqp2 || p2eqp3) {
+            getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
+            return 4;
+        }
+
+        // if p2-p1 and p4-p3 are parallel, that must mean this curve is a line
+        float dotsq = (dx1 * dx3 + dy1 * dy3);
+        dotsq *= dotsq;
+        float l1sq = dx1 * dx1 + dy1 * dy1, l3sq = dx3 * dx3 + dy3 * dy3;
+        if (Helpers.within(dotsq, l1sq * l3sq, 4.0f * Math.ulp(dotsq))) {
+            getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
+            return 4;
+        }
+
+        // this computes the offsets at t=0, 0.5, 1, using the property that
+        // for any bezier curve the vectors p2-p1 and p4-p3 are parallel to
+        // the (dx/dt, dy/dt) vectors at the endpoints.
         computeOffset(dx1, dy1, lineWidth2, offset0);
         computeOffset(dx3, dy3, lineWidth2, offset1);
 
-        leftOff[0]  = x1 + offset0[0]; leftOff[1]  = y1 + offset0[1];
-        leftOff[4]  = x3 + offset1[0]; leftOff[5]  = y3 + offset1[1];
-        rightOff[0] = x1 - offset0[0]; rightOff[1] = y1 - offset0[1];
-        rightOff[4] = x3 - offset1[0]; rightOff[5] = y3 - offset1[1];
-
-        float x1p = leftOff[0]; // start
-        float y1p = leftOff[1]; // point
-        float x3p = leftOff[4]; // end
-        float y3p = leftOff[5]; // point
-
-        // Corner cases:
-        // 1. If the two control vectors are parallel, we'll end up with NaN's
-        //    in leftOff (and rightOff in the body of the if below), so we'll
-        //    do getLineOffsets, which is right.
-        // 2. If the first or second two points are equal, then (dx1,dy1)==(0,0)
-        //    or (dx3,dy3)==(0,0), so (x1p, y1p)==(x1p+dx1, y1p+dy1)
-        //    or (x3p, y3p)==(x3p-dx3, y3p-dy3), which means that
-        //    computeIntersection will put NaN's in leftOff and right off, and
-        //    we will do getLineOffsets, which is right.
-        computeIntersection(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, leftOff, 2);
-        float cx = leftOff[2];
-        float cy = leftOff[3];
+        float x1p = x1 + offset0[0]; // start
+        float y1p = y1 + offset0[1]; // point
+        float x3p = x3 + offset1[0]; // end
+        float y3p = y3 + offset1[1]; // point
+        safeComputeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, leftOff, 2);
+        leftOff[0] = x1p; leftOff[1] = y1p;
+        leftOff[4] = x3p; leftOff[5] = y3p;
 
-        if (!(isFinite(cx) && isFinite(cy))) {
-            // maybe the right path is not degenerate.
-            x1p = rightOff[0];
-            y1p = rightOff[1];
-            x3p = rightOff[4];
-            y3p = rightOff[5];
-            computeIntersection(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, rightOff, 2);
-            cx = rightOff[2];
-            cy = rightOff[3];
-            if (!(isFinite(cx) && isFinite(cy))) {
-                // both are degenerate. This curve is a line.
-                getLineOffsets(x1, y1, x3, y3, leftOff, rightOff);
-                return 4;
-            }
-            // {left,right}Off[0,1,4,5] are already set to the correct values.
-            leftOff[2] = 2f * x2 - cx;
-            leftOff[3] = 2f * y2 - cy;
-            return 6;
-        }
-
-        // rightOff[2,3] = (x2,y2) - ((left_x2, left_y2) - (x2, y2))
-        // == 2*(x2, y2) - (left_x2, left_y2)
-        rightOff[2] = 2f * x2 - cx;
-        rightOff[3] = 2f * y2 - cy;
+        x1p = x1 - offset0[0]; y1p = y1 - offset0[1];
+        x3p = x3 - offset1[0]; y3p = y3 - offset1[1];
+        safeComputeMiter(x1p, y1p, x1p+dx1, y1p+dy1, x3p, y3p, x3p-dx3, y3p-dy3, rightOff, 2);
+        rightOff[0] = x1p; rightOff[1] = y1p;
+        rightOff[4] = x3p; rightOff[5] = y3p;
         return 6;
     }
 
-    private static boolean isFinite(float x) {
-        return (Float.NEGATIVE_INFINITY < x && x < Float.POSITIVE_INFINITY);
-    }
-
-    // If this class is compiled with ecj, then Hotspot crashes when OSR
-    // compiling this function. See bugs 7004570 and 6675699
-    // TODO: until those are fixed, we should work around that by
-    // manually inlining this into curveTo and quadTo.
-/******************************* WORKAROUND **********************************
-    private void somethingTo(final int type) {
-        // need these so we can update the state at the end of this method
-        final float xf = middle[type-2], yf = middle[type-1];
-        float dxs = middle[2] - middle[0];
-        float dys = middle[3] - middle[1];
-        float dxf = middle[type - 2] - middle[type - 4];
-        float dyf = middle[type - 1] - middle[type - 3];
-        switch(type) {
-        case 6:
-            if ((dxs == 0f && dys == 0f) ||
-                (dxf == 0f && dyf == 0f)) {
-               dxs = dxf = middle[4] - middle[0];
-               dys = dyf = middle[5] - middle[1];
-            }
-            break;
-        case 8:
-            boolean p1eqp2 = (dxs == 0f && dys == 0f);
-            boolean p3eqp4 = (dxf == 0f && dyf == 0f);
-            if (p1eqp2) {
-                dxs = middle[4] - middle[0];
-                dys = middle[5] - middle[1];
-                if (dxs == 0f && dys == 0f) {
-                    dxs = middle[6] - middle[0];
-                    dys = middle[7] - middle[1];
-                }
-            }
-            if (p3eqp4) {
-                dxf = middle[6] - middle[2];
-                dyf = middle[7] - middle[3];
-                if (dxf == 0f && dyf == 0f) {
-                    dxf = middle[6] - middle[0];
-                    dyf = middle[7] - middle[1];
-                }
-            }
-        }
-        if (dxs == 0f && dys == 0f) {
-            // this happens iff the "curve" is just a point
-            lineTo(middle[0], middle[1]);
-            return;
-        }
-        // if these vectors are too small, normalize them, to avoid future
-        // precision problems.
-        if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
-            float len = (float) sqrt(dxs*dxs + dys*dys);
-            dxs /= len;
-            dys /= len;
-        }
-        if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
-            float len = (float) sqrt(dxf*dxf + dyf*dyf);
-            dxf /= len;
-            dyf /= len;
-        }
-
-        computeOffset(dxs, dys, lineWidth2, offset0);
-        final float mx = offset0[0];
-        final float my = offset0[1];
-        drawJoin(cdx, cdy, cx0, cy0, dxs, dys, cmx, cmy, mx, my);
-
-        int nSplits = findSubdivPoints(curve, middle, subdivTs, type, lineWidth2);
-
-        int kind = 0;
-        BreakPtrIterator it = curve.breakPtsAtTs(middle, type, subdivTs, nSplits);
-        while(it.hasNext()) {
-            int curCurveOff = it.next();
-
-            switch (type) {
-            case 8:
-                kind = computeOffsetCubic(middle, curCurveOff, lp, rp);
-                break;
-            case 6:
-                kind = computeOffsetQuad(middle, curCurveOff, lp, rp);
-                break;
-            }
-            emitLineTo(lp[0], lp[1]);
-            switch(kind) {
-            case 8:
-                emitCurveTo(lp[2], lp[3], lp[4], lp[5], lp[6], lp[7]);
-                emitCurveToRev(rp[0], rp[1], rp[2], rp[3], rp[4], rp[5]);
-                break;
-            case 6:
-                emitQuadTo(lp[2], lp[3], lp[4], lp[5]);
-                emitQuadToRev(rp[0], rp[1], rp[2], rp[3]);
-                break;
-            case 4:
-                emitLineTo(lp[2], lp[3]);
-                emitLineTo(rp[0], rp[1], true);
-                break;
-            }
-            emitLineTo(rp[kind - 2], rp[kind - 1], true);
-        }
-
-        this.cmx = (lp[kind - 2] - rp[kind - 2]) / 2;
-        this.cmy = (lp[kind - 1] - rp[kind - 1]) / 2;
-        this.cdx = dxf;
-        this.cdy = dyf;
-        this.cx0 = xf;
-        this.cy0 = yf;
-        this.prev = DRAWING_OP_TO;
-    }
-****************************** END WORKAROUND *******************************/
-
     // finds values of t where the curve in pts should be subdivided in order
     // to get good offset curves a distance of w away from the middle curve.
     // Stores the points in ts, and returns how many of them there were.
@@ -971,11 +894,11 @@
         final float y12 = pts[3] - pts[1];
         // if the curve is already parallel to either axis we gain nothing
         // from rotating it.
-        if (y12 != 0f && x12 != 0f) {
+        if (y12 != 0.0f && x12 != 0.0f) {
             // we rotate it so that the first vector in the control polygon is
             // parallel to the x-axis. This will ensure that rotated quarter
             // circles won't be subdivided.
-            final float hypot = (float) sqrt(x12 * x12 + y12 * y12);
+            final float hypot = (float) Math.sqrt(x12 * x12 + y12 * y12);
             final float cos = x12 / hypot;
             final float sin = y12 / hypot;
             final float x1 = cos * pts[0] + sin * pts[1];
@@ -1031,9 +954,6 @@
         mid[4] = x2;  mid[5] = y2;
         mid[6] = x3;  mid[7] = y3;
 
-        // inlined version of somethingTo(8);
-        // See the TODO on somethingTo
-
         // need these so we can update the state at the end of this method
         final float xf = mid[6], yf = mid[7];
         float dxs = mid[2] - mid[0];
@@ -1041,12 +961,12 @@
         float dxf = mid[6] - mid[4];
         float dyf = mid[7] - mid[5];
 
-        boolean p1eqp2 = (dxs == 0f && dys == 0f);
-        boolean p3eqp4 = (dxf == 0f && dyf == 0f);
+        boolean p1eqp2 = (dxs == 0.0f && dys == 0.0f);
+        boolean p3eqp4 = (dxf == 0.0f && dyf == 0.0f);
         if (p1eqp2) {
             dxs = mid[4] - mid[0];
             dys = mid[5] - mid[1];
-            if (dxs == 0f && dys == 0f) {
+            if (dxs == 0.0f && dys == 0.0f) {
                 dxs = mid[6] - mid[0];
                 dys = mid[7] - mid[1];
             }
@@ -1054,12 +974,12 @@
         if (p3eqp4) {
             dxf = mid[6] - mid[2];
             dyf = mid[7] - mid[3];
-            if (dxf == 0f && dyf == 0f) {
+            if (dxf == 0.0f && dyf == 0.0f) {
                 dxf = mid[6] - mid[0];
                 dyf = mid[7] - mid[1];
             }
         }
-        if (dxs == 0f && dys == 0f) {
+        if (dxs == 0.0f && dys == 0.0f) {
             // this happens if the "curve" is just a point
             lineTo(mid[0], mid[1]);
             return;
@@ -1068,12 +988,12 @@
         // if these vectors are too small, normalize them, to avoid future
         // precision problems.
         if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
-            float len = (float) sqrt(dxs*dxs + dys*dys);
+            float len = (float) Math.sqrt(dxs*dxs + dys*dys);
             dxs /= len;
             dys /= len;
         }
         if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
-            float len = (float) sqrt(dxf*dxf + dyf*dyf);
+            float len = (float) Math.sqrt(dxf*dxf + dyf*dyf);
             dxf /= len;
             dyf /= len;
         }
@@ -1081,17 +1001,23 @@
         computeOffset(dxs, dys, lineWidth2, offset0);
         drawJoin(cdx, cdy, cx0, cy0, dxs, dys, cmx, cmy, offset0[0], offset0[1]);
 
-        int nSplits = findSubdivPoints(curve, mid, subdivTs, 8, lineWidth2);
+        final int nSplits = findSubdivPoints(curve, mid, subdivTs, 8, lineWidth2);
+
+        float prevT = 0.0f;
+        for (int i = 0, off = 0; i < nSplits; i++, off += 6) {
+            final float t = subdivTs[i];
+            Helpers.subdivideCubicAt((t - prevT) / (1.0f - prevT),
+                                     mid, off, mid, off, mid, off + 6);
+            prevT = t;
+        }
 
         final float[] l = lp;
         final float[] r = rp;
 
         int kind = 0;
-        BreakPtrIterator it = curve.breakPtsAtTs(mid, 8, subdivTs, nSplits);
-        while(it.hasNext()) {
-            int curCurveOff = it.next();
+        for (int i = 0, off = 0; i <= nSplits; i++, off += 6) {
+            kind = computeOffsetCubic(mid, off, l, r);
 
-            kind = computeOffsetCubic(mid, curCurveOff, l, r);
             emitLineTo(l[0], l[1]);
 
             switch(kind) {
@@ -1108,8 +1034,8 @@
             emitLineToRev(r[kind - 2], r[kind - 1]);
         }
 
-        this.cmx = (l[kind - 2] - r[kind - 2]) / 2f;
-        this.cmy = (l[kind - 1] - r[kind - 1]) / 2f;
+        this.cmx = (l[kind - 2] - r[kind - 2]) / 2.0f;
+        this.cmy = (l[kind - 1] - r[kind - 1]) / 2.0f;
         this.cdx = dxf;
         this.cdy = dyf;
         this.cx0 = xf;
@@ -1124,20 +1050,17 @@
         mid[2] = x1;  mid[3] = y1;
         mid[4] = x2;  mid[5] = y2;
 
-        // inlined version of somethingTo(8);
-        // See the TODO on somethingTo
-
         // need these so we can update the state at the end of this method
         final float xf = mid[4], yf = mid[5];
         float dxs = mid[2] - mid[0];
         float dys = mid[3] - mid[1];
         float dxf = mid[4] - mid[2];
         float dyf = mid[5] - mid[3];
-        if ((dxs == 0f && dys == 0f) || (dxf == 0f && dyf == 0f)) {
+        if ((dxs == 0.0f && dys == 0.0f) || (dxf == 0.0f && dyf == 0.0f)) {
             dxs = dxf = mid[4] - mid[0];
             dys = dyf = mid[5] - mid[1];
         }
-        if (dxs == 0f && dys == 0f) {
+        if (dxs == 0.0f && dys == 0.0f) {
             // this happens if the "curve" is just a point
             lineTo(mid[0], mid[1]);
             return;
@@ -1145,12 +1068,12 @@
         // if these vectors are too small, normalize them, to avoid future
         // precision problems.
         if (Math.abs(dxs) < 0.1f && Math.abs(dys) < 0.1f) {
-            float len = (float) sqrt(dxs*dxs + dys*dys);
+            float len = (float) Math.sqrt(dxs*dxs + dys*dys);
             dxs /= len;
             dys /= len;
         }
         if (Math.abs(dxf) < 0.1f && Math.abs(dyf) < 0.1f) {
-            float len = (float) sqrt(dxf*dxf + dyf*dyf);
+            float len = (float) Math.sqrt(dxf*dxf + dyf*dyf);
             dxf /= len;
             dyf /= len;
         }
@@ -1160,15 +1083,21 @@
 
         int nSplits = findSubdivPoints(curve, mid, subdivTs, 6, lineWidth2);
 
+        float prevt = 0.0f;
+        for (int i = 0, off = 0; i < nSplits; i++, off += 4) {
+            final float t = subdivTs[i];
+            Helpers.subdivideQuadAt((t - prevt) / (1.0f - prevt),
+                                    mid, off, mid, off, mid, off + 4);
+            prevt = t;
+        }
+
         final float[] l = lp;
         final float[] r = rp;
 
         int kind = 0;
-        BreakPtrIterator it = curve.breakPtsAtTs(mid, 6, subdivTs, nSplits);
-        while(it.hasNext()) {
-            int curCurveOff = it.next();
+        for (int i = 0, off = 0; i <= nSplits; i++, off += 4) {
+            kind = computeOffsetQuad(mid, off, l, r);
 
-            kind = computeOffsetQuad(mid, curCurveOff, l, r);
             emitLineTo(l[0], l[1]);
 
             switch(kind) {
@@ -1185,8 +1114,8 @@
             emitLineToRev(r[kind - 2], r[kind - 1]);
         }
 
-        this.cmx = (l[kind - 2] - r[kind - 2]) / 2f;
-        this.cmy = (l[kind - 1] - r[kind - 1]) / 2f;
+        this.cmx = (l[kind - 2] - r[kind - 2]) / 2.0f;
+        this.cmy = (l[kind - 1] - r[kind - 1]) / 2.0f;
         this.cdx = dxf;
         this.cdy = dyf;
         this.cx0 = xf;
@@ -1205,11 +1134,11 @@
         private static final byte TYPE_QUADTO  = (byte) 1;
         private static final byte TYPE_CUBICTO = (byte) 2;
 
-        // curves capacity = edges count (4096) = half edges x 2 (coords)
-        private static final int INITIAL_CURVES_COUNT = INITIAL_EDGES_COUNT;
+        // curves capacity = edges count (8192) = edges x 2 (coords)
+        private static final int INITIAL_CURVES_COUNT = INITIAL_EDGES_COUNT << 1;
 
-        // types capacity = half edges count (2048)
-        private static final int INITIAL_TYPES_COUNT = INITIAL_EDGES_COUNT >> 1;
+        // types capacity = edges count (4096)
+        private static final int INITIAL_TYPES_COUNT = INITIAL_EDGES_COUNT;
 
         float[] curves;
         int end;
@@ -1235,10 +1164,10 @@
         PolyStack(final RendererContext rdrCtx) {
             this.rdrCtx = rdrCtx;
 
-            curves_ref = rdrCtx.newDirtyFloatArrayRef(INITIAL_CURVES_COUNT); // 16K
+            curves_ref = rdrCtx.newDirtyFloatArrayRef(INITIAL_CURVES_COUNT); // 32K
             curves     = curves_ref.initial;
 
-            curveTypes_ref = rdrCtx.newDirtyByteArrayRef(INITIAL_TYPES_COUNT); // 2K
+            curveTypes_ref = rdrCtx.newDirtyByteArrayRef(INITIAL_TYPES_COUNT); // 4K
             curveTypes     = curveTypes_ref.initial;
             numCurves = 0;
             end = 0;
@@ -1369,7 +1298,7 @@
         public String toString() {
             String ret = "";
             int nc = numCurves;
-            int e  = end;
+            int last = end;
             int len;
             while (nc != 0) {
                 switch(curveTypes[--nc]) {
@@ -1388,8 +1317,8 @@
                 default:
                     len = 0;
                 }
-                e -= len;
-                ret += Arrays.toString(Arrays.copyOfRange(curves, e, e+len))
+                last -= len;
+                ret += Arrays.toString(Arrays.copyOfRange(curves, last, last+len))
                                        + "\n";
             }
             return ret;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/TransformingPathConsumer2D.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/TransformingPathConsumer2D.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -58,8 +58,8 @@
         float myx = (float) at.getShearY();
         float myy = (float) at.getScaleY();
 
-        if (mxy == 0f && myx == 0f) {
-            if (mxx == 1f && myy == 1f) {
+        if (mxy == 0.0f && myx == 0.0f) {
+            if (mxx == 1.0f && myy == 1.0f) {
                 return out;
             } else {
                 return dt_DeltaScaleFilter.init(out, mxx, myy);
@@ -84,8 +84,8 @@
         float myx = (float) at.getShearY();
         float myy = (float) at.getScaleY();
 
-        if (mxy == 0f && myx == 0f) {
-            if (mxx == 1f && myy == 1f) {
+        if (mxy == 0.0f && myx == 0.0f) {
+            if (mxx == 1.0f && myy == 1.0f) {
                 return out;
             } else {
                 return iv_DeltaScaleFilter.init(out, 1.0f/mxx, 1.0f/myy);
--- a/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/marlin/Version.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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,7 +27,7 @@
 
 public final class Version {
 
-    private static final String VERSION = "marlin-0.7.4-Unsafe-OpenJDK";
+    private static final String VERSION = "marlin-0.7.5-Unsafe-OpenJDK";
 
     public static String getVersion() {
         return VERSION;
--- a/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/java2d/pipe/RenderingEngine.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -132,7 +132,7 @@
             }
         }
         if (reImpl == null) {
-            final String marlinREClass = "sun.java2d.marlin.MarlinRenderingEngine";
+            final String marlinREClass = "sun.java2d.marlin.DMarlinRenderingEngine";
             try {
                 Class<?> cls = Class.forName(marlinREClass);
                 reImpl = (RenderingEngine) cls.getConstructor().newInstance();
--- a/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/swing/JLightweightFrame.java	Sat Sep 09 14:36:45 2017 +0200
@@ -509,7 +509,16 @@
      * and could not be overridden.
      */
     private void updateClientCursor() {
-        Point p = MouseInfo.getPointerInfo().getLocation();
+        PointerInfo pointerInfo = MouseInfo.getPointerInfo();
+        if (pointerInfo == null) {
+            /*
+             * This can happen when multiple graphics device cannot decide
+             * which graphics device contains the current mouse position
+             * or on systems without a mouse
+             */
+             return;
+        }
+        Point p = pointerInfo.getLocation();
         SwingUtilities.convertPointFromScreen(p, this);
         Component target = SwingUtilities.getDeepestComponentAt(this, p.x, p.y);
         if (target != null) {
--- a/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java	Sat Sep 09 14:36:45 2017 +0200
@@ -260,9 +260,6 @@
     // Home Button
     File homeDir = fsv.getHomeDirectory();
     String toolTipText = homeFolderToolTipText;
-    if (fsv.isRoot(homeDir)) {
-        toolTipText = getFileView(fc).getName(homeDir); // Probably "Desktop".
-    }
 
     JButton b = new JButton(homeFolderIcon);
     b.setToolTipText(toolTipText);
--- a/jdk/src/java.desktop/share/native/common/font/fontscalerdefs.h	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/native/common/font/fontscalerdefs.h	Sat Sep 09 14:36:45 2017 +0200
@@ -119,6 +119,7 @@
 #define GSUB_TAG 0x47535542 /* 'GSUB' */
 #define GPOS_TAG 0x47504F53 /* 'GPOS' */
 #define GDEF_TAG 0x47444546 /* 'GDEF' */
+#define HEAD_TAG 0x68656164 /* 'head' */
 #define MORT_TAG 0x6D6F7274 /* 'mort' */
 #define MORX_TAG 0x6D6F7278 /* 'morx' */
 #define KERN_TAG 0x6B65726E /* 'kern' */
@@ -126,9 +127,10 @@
 typedef struct TTLayoutTableCacheEntry {
   const void* ptr;
   int   len;
+  int   tag;
 } TTLayoutTableCacheEntry;
 
-#define LAYOUTCACHE_ENTRIES 6
+#define LAYOUTCACHE_ENTRIES 7
 
 typedef struct TTLayoutTableCache {
   TTLayoutTableCacheEntry entries[LAYOUTCACHE_ENTRIES];
--- a/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c	Sat Sep 09 14:36:45 2017 +0200
@@ -203,6 +203,7 @@
                        jfloat ptSize,
                        jlong pScaler,
                        jlong pNativeFont,
+                       jlong layoutTables,
                        jfloatArray matrix,
                        jboolean aat) {
 
@@ -215,6 +216,7 @@
     fi->font2D = font2D;
     fi->fontStrike = fontStrike;
     fi->nativeFont = pNativeFont;
+    fi->layoutTables = (TTLayoutTableCache*)layoutTables;
     fi->aat = aat;
     (*env)->GetFloatArrayRegion(env, matrix, 0, 4, fi->matrix);
     fi->ptSize = ptSize;
@@ -241,6 +243,7 @@
      jfloatArray matrix,
      jlong pScaler,
      jlong pNativeFont,
+     jlong layoutTables,
      jboolean aat,
      jcharArray text,
      jobject gvdata,
@@ -269,7 +272,7 @@
 
      JDKFontInfo *jdkFontInfo =
          createJDKFontInfo(env, font2D, fontStrike, ptSize,
-                           pScaler, pNativeFont, matrix, aat);
+                           pScaler, pNativeFont, layoutTables, matrix, aat);
      if (!jdkFontInfo) {
         return JNI_FALSE;
      }
--- a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc	Sat Sep 09 14:36:45 2017 +0200
@@ -273,34 +273,63 @@
 static void _do_nothing(void) {
 }
 
+static void _free_nothing(void*) {
+}
+
 static hb_blob_t *
 reference_table(hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data) {
 
   JDKFontInfo *jdkFontInfo = (JDKFontInfo*)user_data;
   JNIEnv* env = jdkFontInfo->env;
   jobject font2D = jdkFontInfo->font2D;
-  jsize length;
-  jbyte* buffer;
+  jsize length = 0;
+  void* buffer = NULL;
+  int cacheIdx = 0;
 
   // HB_TAG_NONE is 0 and is used to get the whole font file.
-  // It is not expected not be needed for JDK.
-  if (tag == 0) {
+  // It is not expected to be needed for JDK.
+  if (tag == 0 || jdkFontInfo->layoutTables == NULL) {
       return NULL;
   }
-  jbyteArray tableBytes = (jbyteArray)
-     env->CallObjectMethod(font2D, sunFontIDs.getTableBytesMID, tag);
-  if (tableBytes == NULL) {
-      return NULL;
+
+  for (cacheIdx=0; cacheIdx<LAYOUTCACHE_ENTRIES; cacheIdx++) {
+    if (tag == jdkFontInfo->layoutTables->entries[cacheIdx].tag) break;
+  }
+
+  if (cacheIdx < LAYOUTCACHE_ENTRIES) { // if found
+      if (jdkFontInfo->layoutTables->entries[cacheIdx].len != -1) {
+          length = jdkFontInfo->layoutTables->entries[cacheIdx].len;
+          buffer = (void*)jdkFontInfo->layoutTables->entries[cacheIdx].ptr;
+      }
   }
-  length = env->GetArrayLength(tableBytes);
-  buffer = (jbyte *)calloc(length, sizeof(jbyte));
-  env->GetByteArrayRegion(tableBytes, 0, length, buffer);
+
+  if (buffer == NULL) {
+      jbyteArray tableBytes = (jbyteArray)
+         env->CallObjectMethod(font2D, sunFontIDs.getTableBytesMID, tag);
+      if (tableBytes == NULL) {
+          return NULL;
+      }
+      length = env->GetArrayLength(tableBytes);
+      buffer = calloc(length, sizeof(jbyte));
+      env->GetByteArrayRegion(tableBytes, 0, length, (jbyte*)buffer);
+
+     if (cacheIdx >= LAYOUTCACHE_ENTRIES) { // not a cacheable table
+          return hb_blob_create((const char *)buffer, length,
+                                 HB_MEMORY_MODE_WRITABLE,
+                                 buffer, free);
+      } else {
+        jdkFontInfo->layoutTables->entries[cacheIdx].len = length;
+        jdkFontInfo->layoutTables->entries[cacheIdx].ptr = buffer;
+      }
+  }
 
   return hb_blob_create((const char *)buffer, length,
-                         HB_MEMORY_MODE_WRITABLE,
-                         buffer, free);
+                         HB_MEMORY_MODE_READONLY,
+                         NULL, _free_nothing);
 }
 
+
+
 hb_face_t*
 hb_jdk_face_create(JDKFontInfo *jdkFontInfo,
                    hb_destroy_func_t destroy) {
--- a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk.h	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk.h	Sat Sep 09 14:36:45 2017 +0200
@@ -29,6 +29,7 @@
 #include "hb.h"
 #include <jni.h>
 #include <sunfontids.h>
+#include <fontscalerdefs.h>
 
 # ifdef __cplusplus
 extern "C" {
@@ -39,6 +40,7 @@
     jobject font2D;
     jobject fontStrike;
     long nativeFont;
+    TTLayoutTableCache *layoutTables;
     float matrix[4];
     float ptSize;
     float xPtSize;
--- a/jdk/src/java.desktop/share/native/libfontmanager/sunFont.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/share/native/libfontmanager/sunFont.c	Sat Sep 09 14:36:45 2017 +0200
@@ -350,6 +350,13 @@
     for(i=0;i<LAYOUTCACHE_ENTRIES;i++) {
       ltc->entries[i].len = -1;
     }
+    ltc->entries[0].tag = GDEF_TAG;
+    ltc->entries[1].tag = GPOS_TAG;
+    ltc->entries[2].tag = GSUB_TAG;
+    ltc->entries[3].tag = HEAD_TAG;
+    ltc->entries[4].tag = KERN_TAG;
+    ltc->entries[5].tag = MORT_TAG;
+    ltc->entries[6].tag = MORX_TAG;
   }
   return ltc;
 }
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java	Sat Sep 09 14:36:45 2017 +0200
@@ -2174,8 +2174,7 @@
     /**
      * Returns one of XConstants: NotUseful, WhenMapped or Always.
      * If backing store is not available on at least one screen, or
-     * java2d uses DGA(which conflicts with backing store) on at least one screen,
-     * or the string system property "sun.awt.backingStore" is neither "Always"
+     * the string system property "sun.awt.backingStore" is neither "Always"
      * nor "WhenMapped", then the method returns XConstants.NotUseful.
      * Otherwise, if the system property "sun.awt.backingStore" is "WhenMapped",
      * then the method returns XConstants.WhenMapped.
@@ -2218,16 +2217,6 @@
                                      "WhenMapped" : "Always") );
         }
 
-        if (sun.java2d.x11.X11SurfaceData.isDgaAvailable()) {
-            backingStoreType = XConstants.NotUseful;
-
-            if (backingStoreLog.isLoggable(PlatformLogger.Level.CONFIG)) {
-                backingStoreLog.config("DGA is available, backingStore=NotUseful");
-            }
-
-            return;
-        }
-
         awtLock();
         try {
             int screenCount = XlibWrapper.ScreenCount(getDisplay());
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindowPeer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -2306,7 +2306,11 @@
                             if (grabLog.isLoggable(PlatformLogger.Level.FINE)) {
                                 grabLog.fine("Generating UngrabEvent on {0} because not inside of shell", this);
                             }
-                            postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                            // Do not post Ungrab Event for mouse scroll
+                            if ((xbe.get_button() != XConstants.buttons[3])
+                                && (xbe.get_button() != XConstants.buttons[4])) {
+                                postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                            }
                             return;
                         }
                     }
@@ -2327,14 +2331,26 @@
                             if (grabLog.isLoggable(PlatformLogger.Level.FINE)) {
                                 grabLog.fine("Generating UngrabEvent on {0} because hierarchy ended", this);
                             }
-                            postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                            // For mouse wheel event, do not send UngrabEvent
+                            if (xbe.get_type() != XConstants.ButtonPress) {
+                                postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                            } else if ((xbe.get_button() != XConstants.buttons[3])
+                                   && (xbe.get_button() != XConstants.buttons[4])) {
+                                postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                            }
                         }
                     } else {
                         // toplevel is null - outside of hierarchy
                         if (grabLog.isLoggable(PlatformLogger.Level.FINE)) {
                             grabLog.fine("Generating UngrabEvent on {0} because toplevel is null", this);
                         }
-                        postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                        // For mouse wheel event, do not send UngrabEvent
+                        if (xbe.get_type() != XConstants.ButtonPress) {
+                            postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                        } else if ((xbe.get_button() != XConstants.buttons[3])
+                               && (xbe.get_button() != XConstants.buttons[4])) {
+                            postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                        }
                         return;
                     }
                 } else {
@@ -2342,7 +2358,13 @@
                     if (grabLog.isLoggable(PlatformLogger.Level.FINE)) {
                         grabLog.fine("Generating UngrabEvent on because target is null {0}", this);
                     }
-                    postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                    // For mouse wheel event, do not send UngrabEvent
+                    if (xbe.get_type() != XConstants.ButtonPress) {
+                        postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                    } else if ((xbe.get_button() != XConstants.buttons[3])
+                            && (xbe.get_button() != XConstants.buttons[4])) {
+                        postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
+                    }
                     return;
                 }
             }
--- a/jdk/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/unix/classes/sun/java2d/x11/X11SurfaceData.java	Sat Sep 09 14:36:45 2017 +0200
@@ -72,7 +72,7 @@
 
     protected int depth;
 
-    private static native void initIDs(Class<?> xorComp, boolean tryDGA);
+    private static native void initIDs(Class<?> xorComp);
     protected native void initSurface(int depth, int width, int height,
                                       long drawable);
 
@@ -208,17 +208,12 @@
     protected X11Renderer x11pipe;
     protected PixelToShapeConverter x11txpipe;
     protected static TextPipe x11textpipe;
-    protected static boolean dgaAvailable;
 
     static {
        if (!isX11SurfaceDataInitialized() &&
            !GraphicsEnvironment.isHeadless()) {
-            // If a screen magnifier is present, don't attempt to use DGA
-            String magPresent = java.security.AccessController.doPrivileged
-                (new sun.security.action.GetPropertyAction("javax.accessibility.screen_magnifier_present"));
-            boolean tryDGA = magPresent == null || !"true".equals(magPresent);
 
-            initIDs(XORComposite.class, tryDGA);
+            initIDs(XORComposite.class);
 
             String xtextpipe = java.security.AccessController.doPrivileged
                 (new sun.security.action.GetPropertyAction("sun.java2d.xtextpipe"));
@@ -239,8 +234,6 @@
                 x11textpipe = solidTextRenderer;
             }
 
-            dgaAvailable = isDgaAvailable();
-
             if (isAccelerationEnabled()) {
                 X11PMBlitLoops.register();
                 X11PMBlitBgLoops.register();
@@ -249,11 +242,6 @@
     }
 
     /**
-     * Returns true if we can use DGA on any of the screens
-     */
-    public static native boolean isDgaAvailable();
-
-    /**
      * Returns true if shared memory pixmaps are available
      */
     private static native boolean isShmPMAvailable();
@@ -277,10 +265,9 @@
                      }
 
                     // EXA based drivers tend to place pixmaps in VRAM, slowing down readbacks.
-                    // Don't use pixmaps if dga is available,
-                    // or we are local and shared memory Pixmaps are not available.
-                    accelerationEnabled =
-                        !(isDgaAvailable() || (isDisplayLocal && !isShmPMAvailable()));
+                    // Don't use pixmaps if we are local and shared memory Pixmaps
+                    // are not available.
+                    accelerationEnabled = !(isDisplayLocal && !isShmPMAvailable());
                 }
             }
         }
--- a/jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.c	Sat Sep 09 14:36:45 2017 +0200
@@ -39,10 +39,6 @@
 #include <dlfcn.h>
 
 #ifndef HEADLESS
-static JDgaLibInfo DgaLibInfoStub;
-static JDgaLibInfo theJDgaInfo;
-static JDgaLibInfo *pJDgaInfo = &DgaLibInfoStub;
-
 
 /**
  * This file contains support code for loops using the SurfaceData
@@ -82,8 +78,6 @@
 extern jfieldID validID;
 
 static int nativeByteOrder;
-static jboolean dgaAvailable = JNI_FALSE;
-static jboolean useDGAWithPixmaps = JNI_FALSE;
 static jclass xorCompClass;
 
 jint useMitShmExt = CANT_USE_MITSHM;
@@ -107,8 +101,6 @@
     endian.i = 0xff000000;
     nativeByteOrder = (endian.c[0]) ? MSBFirst : LSBFirst;
 
-    dgaAvailable = JNI_FALSE;
-
     cachedXImage = NULL;
 
     if (sizeof(X11RIPrivate) > SD_RASINFO_PRIVATE_SIZE) {
@@ -158,38 +150,12 @@
  */
 JNIEXPORT void JNICALL
 Java_sun_java2d_x11_X11SurfaceData_initIDs(JNIEnv *env, jclass xsd,
-                                           jclass XORComp, jboolean tryDGA)
+                                           jclass XORComp)
 {
 #ifndef HEADLESS
   if(XShared_initIDs(env, JNI_TRUE))
   {
-    void *lib = 0;
-
     xorCompClass = (*env)->NewGlobalRef(env, XORComp);
-
-    if (tryDGA && (getenv("NO_J2D_DGA") == NULL)) {
-    /* we use RTLD_NOW because of bug 4032715 */
-        lib = dlopen(JNI_LIB_NAME("sunwjdga"), RTLD_NOW);
-    }
-
-    if (lib != NULL) {
-        JDgaStatus ret = JDGA_FAILED;
-        void *sym = dlsym(lib, "JDgaLibInit");
-        if (sym != NULL) {
-            theJDgaInfo.display = awt_display;
-            AWT_LOCK();
-            ret = (*(JDgaLibInitFunc *)sym)(env, &theJDgaInfo);
-            AWT_UNLOCK();
-        }
-        if (ret == JDGA_SUCCESS) {
-            pJDgaInfo = &theJDgaInfo;
-            dgaAvailable = JNI_TRUE;
-            useDGAWithPixmaps = (getenv("USE_DGA_PIXMAPS") != NULL);
-        } else {
-            dlclose(lib);
-            lib = NULL;
-        }
-    }
   }
 #endif /* !HEADLESS */
 }
@@ -234,21 +200,6 @@
 
 /*
  * Class:     sun_java2d_x11_X11SurfaceData
- * Method:    isDgaAvailable
- * Signature: ()Z
- */
-JNIEXPORT jboolean JNICALL
-Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable(JNIEnv *env, jobject this)
-{
-#if defined(HEADLESS) || defined(__linux__)
-    return JNI_FALSE;
-#else
-    return dgaAvailable;
-#endif /* HEADLESS */
-}
-
-/*
- * Class:     sun_java2d_x11_X11SurfaceData
  * Method:    initOps
  * Signature: (Ljava/lang/Object;I)V
  */
@@ -279,7 +230,6 @@
         xsdo->drawable = 0;
     }
     xsdo->depth = depth;
-    xsdo->dgaAvailable = dgaAvailable;
     xsdo->isPixmap = JNI_FALSE;
     xsdo->bitmask = 0;
     xsdo->bgPixel = 0;
@@ -447,10 +397,6 @@
             return JNI_FALSE;
         }
         xsdo->isPixmap = JNI_TRUE;
-        /* REMIND: workaround for bug 4420220 on pgx32 boards:
-           don't use DGA with pixmaps unless USE_DGA_PIXMAPS is set.
-         */
-        xsdo->dgaAvailable = useDGAWithPixmaps;
 
         xsdo->pmWidth = width;
         xsdo->pmHeight = height;
@@ -847,29 +793,6 @@
         }
         return SD_FAILURE;
     }
-    if (xsdo->dgaAvailable && (lockflags & (SD_LOCK_RD_WR))) {
-        int dgaret;
-
-        dgaret = (*pJDgaInfo->pGetLock)(env, awt_display, &xsdo->dgaDev,
-                                        xsdo->drawable, &xsdo->surfInfo,
-                                        pRasInfo->bounds.x1,
-                                        pRasInfo->bounds.y1,
-                                        pRasInfo->bounds.x2,
-                                        pRasInfo->bounds.y2);
-        if (dgaret == JDGA_SUCCESS) {
-            int wx = xsdo->surfInfo.window.lox;
-            int wy = xsdo->surfInfo.window.loy;
-            pRasInfo->bounds.x1 = xsdo->surfInfo.visible.lox - wx;
-            pRasInfo->bounds.y1 = xsdo->surfInfo.visible.loy - wy;
-            pRasInfo->bounds.x2 = xsdo->surfInfo.visible.hix - wx;
-            pRasInfo->bounds.y2 = xsdo->surfInfo.visible.hiy - wy;
-            xpriv->lockType = X11SD_LOCK_BY_DGA;
-            xpriv->lockFlags = lockflags;
-            return SD_SUCCESS;
-        } else if (dgaret == JDGA_UNAVAILABLE) {
-            xsdo->dgaAvailable = JNI_FALSE;
-        }
-    }
     if (lockflags & SD_LOCK_RD_WR) {
         if (lockflags & SD_LOCK_FASTEST) {
             ret = SD_SLOWLOCK;
@@ -915,43 +838,9 @@
     jint depth = xsdo->depth;
     int mult = xsdo->configData->pixelStride;
 
-    if (xsdo->dgaAvailable &&
-        xpriv->lockType == X11SD_LOCK_BY_XIMAGE &&
-        (lockFlags & SD_LOCK_FASTEST))
-    {
-        /* Try one more time to use DGA (now with smaller bounds)... */
-        int dgaret;
 
-        dgaret = (*pJDgaInfo->pGetLock)(env, awt_display, &xsdo->dgaDev,
-                                        xsdo->drawable, &xsdo->surfInfo,
-                                        pRasInfo->bounds.x1,
-                                        pRasInfo->bounds.y1,
-                                        pRasInfo->bounds.x2,
-                                        pRasInfo->bounds.y2);
-        if (dgaret == JDGA_SUCCESS) {
-            int wx = xsdo->surfInfo.window.lox;
-            int wy = xsdo->surfInfo.window.loy;
-            pRasInfo->bounds.x1 = xsdo->surfInfo.visible.lox - wx;
-            pRasInfo->bounds.y1 = xsdo->surfInfo.visible.loy - wy;
-            pRasInfo->bounds.x2 = xsdo->surfInfo.visible.hix - wx;
-            pRasInfo->bounds.y2 = xsdo->surfInfo.visible.hiy - wy;
-            xpriv->lockType = X11SD_LOCK_BY_DGA;
-        } else if (dgaret == JDGA_UNAVAILABLE) {
-            xsdo->dgaAvailable = JNI_FALSE;
-        }
-    }
-
-    if (xpriv->lockType == X11SD_LOCK_BY_DGA) {
-        int scan = xsdo->surfInfo.surfaceScan;
-        int wx = xsdo->surfInfo.window.lox;
-        int wy = xsdo->surfInfo.window.loy;
-        pRasInfo->rasBase =
-            (void *)(((uintptr_t) xsdo->surfInfo.basePtr) + (scan*wy + wx) * mult);
-        pRasInfo->pixelStride = mult;
-        pRasInfo->pixelBitOffset = 0;
-        pRasInfo->scanStride = scan * mult;
 #ifdef MITSHM
-    } else if (xpriv->lockType == X11SD_LOCK_BY_SHMEM) {
+    if (xpriv->lockType == X11SD_LOCK_BY_SHMEM) {
         if (xsdo->shmPMData.xRequestSent == JNI_TRUE) {
             /* need to sync before using shared mem pixmap
              if any x calls were issued for this pixmap */
@@ -964,8 +853,9 @@
         pRasInfo->pixelStride = mult;
         pRasInfo->pixelBitOffset = 0;
         pRasInfo->scanStride = xsdo->shmPMData.bytesPerLine;
+    } else
 #endif /* MITSHM */
-    } else if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE) {
+    if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE) {
         int x, y, w, h;
         x = pRasInfo->bounds.x1;
         y = pRasInfo->bounds.y1;
@@ -1026,9 +916,7 @@
     X11SDOps *xsdo = (X11SDOps *) ops;
     X11RIPrivate *xpriv = (X11RIPrivate *) &(pRasInfo->priv);
 
-    if (xpriv->lockType == X11SD_LOCK_BY_DGA) {
-        (*pJDgaInfo->pReleaseLock)(env, xsdo->dgaDev, xsdo->drawable);
-    } else if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE &&
+    if (xpriv->lockType == X11SD_LOCK_BY_XIMAGE &&
                xpriv->img != NULL)
     {
         if (xpriv->lockFlags & SD_LOCK_WRITE) {
@@ -1069,7 +957,6 @@
                       xpriv->img, 0, 0, x, y, w, h);
 #endif /* MITSHM */
 
-            (*pJDgaInfo->pXRequestSent)(env, xsdo->dgaDev, drawable);
         }
         X11SD_DisposeOrCacheXImage(xpriv->img);
         xpriv->img = (XImage *)NULL;
@@ -1392,47 +1279,6 @@
     }
 }
 
-static JDgaStatus
-    GetLockStub(JNIEnv *env, Display *display, void **dgaDev,
-                Drawable d, JDgaSurfaceInfo *pSurface,
-                jint lox, jint loy, jint hix, jint hiy)
-{
-    return JDGA_UNAVAILABLE;
-}
-
-static JDgaStatus
-    ReleaseLockStub(JNIEnv *env, void *dgaDev, Drawable d)
-{
-    return JDGA_FAILED;
-}
-
-static void
-    XRequestSentStub(JNIEnv *env, void *dgaDev, Drawable d)
-{
-}
-
-static void
-    LibDisposeStub(JNIEnv *env)
-{
-}
-
-static JDgaLibInfo DgaLibInfoStub = {
-    NULL,
-    GetLockStub,
-    ReleaseLockStub,
-    XRequestSentStub,
-    LibDisposeStub,
-};
-
-void X11SD_LibDispose(JNIEnv *env) {
-    AWT_LOCK();
-    if (pJDgaInfo != NULL) {
-        pJDgaInfo->pLibDispose(env);
-        pJDgaInfo = &DgaLibInfoStub;
-    }
-    AWT_UNLOCK();
-}
-
 void
 X11SD_DirectRenderNotify(JNIEnv *env, X11SDOps *xsdo)
 {
@@ -1441,7 +1287,6 @@
         xsdo->shmPMData.xRequestSent = JNI_TRUE;
     }
 #endif /* MITSHM */
-    (*pJDgaInfo->pXRequestSent)(env, xsdo->dgaDev, xsdo->drawable);
     awt_output_flush();
 }
 
--- a/jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h	Sat Sep 09 14:36:45 2017 +0200
@@ -28,8 +28,6 @@
 #include "awt_p.h"
 #include "awt_GraphicsEnv.h"
 
-#include <jdga.h>
-
 #ifdef HEADLESS
 #include "GLXGraphicsConfig.h"
 #endif
@@ -105,11 +103,8 @@
     GC                  cachedGC;      /* cached for use in X11SD_Unlock() */
     jint                depth;
     jint                pixelmask;
-    JDgaSurfaceInfo     surfInfo;
     AwtGraphicsConfigData *configData;
     ColorData           *cData;
-    jboolean            dgaAvailable;
-    void                *dgaDev;
     Pixmap              bitmask;
     jint                bgPixel;       /* bg pixel for the pixmap */
     jboolean            isBgInitialized; /* whether the bg pixel is valid */
@@ -124,7 +119,6 @@
 #define X11SD_LOCK_UNLOCKED     0       /* surface is not locked */
 #define X11SD_LOCK_BY_NULL      1       /* surface locked for NOP */
 #define X11SD_LOCK_BY_XIMAGE    2       /* surface locked by Get/PutImage */
-#define X11SD_LOCK_BY_DGA       3       /* surface locked by DGA */
 #define X11SD_LOCK_BY_SHMEM     4       /* surface locked by ShMemExt */
 
 #ifdef MITSHM
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -370,7 +370,7 @@
     {java_awt_event_KeyEvent_VK_ROMAN_CHARACTERS, XK_Romaji, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
 
     {java_awt_event_KeyEvent_VK_COMPOSE, XK_Multi_key, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
-    {java_awt_event_KeyEvent_VK_ALT_GRAPH, XK_Mode_switch, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
+    {java_awt_event_KeyEvent_VK_ALT_GRAPH, XK_ISO_Level3_Shift, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
 
     /* Editing block */
     {java_awt_event_KeyEvent_VK_AGAIN, XK_Redo, FALSE, java_awt_event_KeyEvent_KEY_LOCATION_STANDARD},
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -535,7 +535,8 @@
 }
 
 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSelectEvents
-(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong bits_to_change, jlong values_for_bits)
+(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong bits_to_change,
+              jlong values_for_bits)
 {
     AWT_CHECK_HAVE_LOCK();
     XkbSelectEvents((Display *) jlong_to_ptr(display), (unsigned int)device,
@@ -543,7 +544,8 @@
                    (unsigned long)values_for_bits);
 }
 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSelectEventDetails
-(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong event_type, jlong bits_to_change, jlong values_for_bits)
+(JNIEnv *env, jclass clazz, jlong display, jlong device, jlong event_type,
+              jlong bits_to_change, jlong values_for_bits)
 {
     AWT_CHECK_HAVE_LOCK();
     XkbSelectEventDetails((Display *) jlong_to_ptr(display), (unsigned int)device,
@@ -555,21 +557,26 @@
 (JNIEnv *env, jclass clazz, jlong display, jlong opcode_rtrn, jlong event_rtrn,
               jlong error_rtrn, jlong major_in_out, jlong minor_in_out)
 {
+    Bool status;
     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
-    return XkbQueryExtension( (Display *) jlong_to_ptr(display),
-                       (int *) jlong_to_ptr(opcode_rtrn),
-                       (int *) jlong_to_ptr(event_rtrn),
-                       (int *) jlong_to_ptr(error_rtrn),
-                       (int *) jlong_to_ptr(major_in_out),
-                       (int *) jlong_to_ptr(minor_in_out));
+    status = XkbQueryExtension((Display *) jlong_to_ptr(display),
+                               (int *) jlong_to_ptr(opcode_rtrn),
+                               (int *) jlong_to_ptr(event_rtrn),
+                               (int *) jlong_to_ptr(error_rtrn),
+                               (int *) jlong_to_ptr(major_in_out),
+                               (int *) jlong_to_ptr(minor_in_out));
+    return status ? JNI_TRUE : JNI_FALSE;
 }
 JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_XkbLibraryVersion
 (JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
 {
+    Bool status;
     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
     *((int *)jlong_to_ptr(lib_major_in_out)) =  XkbMajorVersion;
     *((int *)jlong_to_ptr(lib_minor_in_out)) =  XkbMinorVersion;
-    return  XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out));
+    status = XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out),
+                               (int *)jlong_to_ptr(lib_minor_in_out));
+    return status ? JNI_TRUE : JNI_FALSE;
 }
 
 JNIEXPORT jlong JNICALL Java_sun_awt_X11_XlibWrapper_XkbGetMap
@@ -603,8 +610,10 @@
                               (unsigned int *)jlong_to_ptr(mods_rtrn),
                                (KeySym *)jlong_to_ptr(keysym_rtrn));
     //printf("native,  input: keycode:0x%0X; mods:0x%0X\n", keycode, mods);
-    //printf("native, output:  keysym:0x%0X; mods:0x%0X\n", *(unsigned int *)jlong_to_ptr(keysym_rtrn), *(unsigned int *)jlong_to_ptr(mods_rtrn));
-    return b;
+    //printf("native, output:  keysym:0x%0X; mods:0x%0X\n",
+    //       *(unsigned int *)jlong_to_ptr(keysym_rtrn),
+    //       *(unsigned int *)jlong_to_ptr(mods_rtrn));
+    return b ? JNI_TRUE : JNI_FALSE;
 }
 JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XkbSetDetectableAutoRepeat
 (JNIEnv *env, jclass clazz, jlong display, jboolean detectable)
@@ -2222,13 +2231,13 @@
 Java_sun_awt_X11_XlibWrapper_XShapeQueryExtension
 (JNIEnv *env, jclass clazz, jlong display, jlong event_base_return, jlong error_base_return)
 {
-    jboolean status;
+    Bool status;
 
     AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
 
     status = XShapeQueryExtension((Display *)jlong_to_ptr(display),
             (int *)jlong_to_ptr(event_base_return), (int *)jlong_to_ptr(error_base_return));
-    return status;
+    return status ? JNI_TRUE : JNI_FALSE;
 }
 
 /*
--- a/jdk/src/java.desktop/unix/native/libsunwjdga/dgalock.c	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,533 +0,0 @@
-/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#if sparc
-
-/* #define DGA_DEBUG */
-
-#ifdef DGA_DEBUG
-#define DEBUG_PRINT(x)  printf x
-#else
-#define DEBUG_PRINT(x)
-#endif
-
-#include <dga/dga.h>
-#include <unistd.h>     /* ioctl */
-#include <stdlib.h>
-#include <sys/mman.h>   /* mmap */
-#include <sys/visual_io.h>
-#include <string.h>
-
-/* X11 */
-#include <X11/Xlib.h>
-
-#include "jni.h"
-#include "jvm_md.h"
-#include "jdga.h"
-#include "jdgadevice.h"
-
-#include <dlfcn.h>
-
-#define min(x, y)       ((x) < (y) ? (x) : (y))
-#define max(x, y)       ((x) > (y) ? (x) : (y))
-
-typedef struct _SolarisDgaLibInfo SolarisDgaLibInfo;
-
-struct _SolarisDgaLibInfo {
-    /* The general (non-device specific) information */
-    unsigned long       count;
-    Drawable            drawable;
-    Drawable            virtual_drawable;
-
-    /* The device specific memory mapping information */
-    SolarisJDgaDevInfo  *devInfo;
-    SolarisJDgaWinInfo  winInfo;
-};
-
-typedef Bool IsXineramaOnFunc(Display *display);
-typedef Drawable GetVirtualDrawableFunc(Display *display, Drawable drawable);
-
-#define MAX_CACHED_INFO 16
-static SolarisDgaLibInfo cachedInfo[MAX_CACHED_INFO];
-static jboolean needsSync = JNI_FALSE;
-
-#define MAX_FB_TYPES 16
-static SolarisJDgaDevInfo devicesInfo[MAX_FB_TYPES];
-
-static IsXineramaOnFunc *IsXineramaOn = NULL;
-static GetVirtualDrawableFunc GetVirtualDrawableStub;
-
-Drawable GetVirtualDrawableStub(Display *display, Drawable drawable) {
-    return drawable;
-}
-static GetVirtualDrawableFunc * GetVirtualDrawable = GetVirtualDrawableStub;
-
-static void Solaris_DGA_XineramaInit(Display *display) {
-    void * handle = NULL;
-    if (IsXineramaOn == NULL) {
-        handle = dlopen(JNI_LIB_NAME("xinerama"), RTLD_NOW);
-        if (handle != NULL) {
-            void *sym = dlsym(handle, "IsXineramaOn");
-            IsXineramaOn = (IsXineramaOnFunc *)sym;
-            if (IsXineramaOn != 0 && (*IsXineramaOn)(display)) {
-                sym = dlsym(handle, "GetVirtualDrawable");
-                if (sym != 0) {
-                    GetVirtualDrawable = (GetVirtualDrawableFunc *)sym;
-                }
-            } else {
-                dlclose(handle);
-            }
-        }
-    }
-}
-
-static SolarisJDgaDevInfo * getDevInfo(Dga_drawable dgadraw) {
-    void *handle = 0;
-    struct vis_identifier visid;
-    int fd;
-    char libName[64];
-    int i;
-    SolarisJDgaDevInfo *curDevInfo = devicesInfo;
-
-    fd = dga_draw_devfd(dgadraw);
-    if (ioctl(fd, VIS_GETIDENTIFIER, &visid) != 1) {
-        /* check in the devices list */
-        for (i = 0; (i < MAX_FB_TYPES) && (curDevInfo->visidName);
-             i++, curDevInfo++) {
-            if (strcmp(visid.name, curDevInfo->visidName) == 0) {
-                /* we already have such a device, return it */
-                return curDevInfo;
-            }
-        }
-        if (i == MAX_FB_TYPES) {
-            /* we're out of slots, return NULL */
-            return NULL;
-        }
-
-        strcpy(libName, "libjdga");
-        strcat(libName, visid.name);
-        strcat(libName,".so");
-        /* we use RTLD_NOW because of bug 4032715 */
-        handle = dlopen(libName, RTLD_NOW);
-        if (handle != 0) {
-            JDgaStatus ret = JDGA_FAILED;
-            void *sym = dlsym(handle, "SolarisJDgaDevOpen");
-            if (sym != 0) {
-                curDevInfo->majorVersion = JDGALIB_MAJOR_VERSION;
-                curDevInfo->minorVersion = JDGALIB_MINOR_VERSION;
-                ret = (*(SolarisJDgaDevOpenFunc *)sym)(curDevInfo);
-            }
-            if (ret == JDGA_SUCCESS) {
-                curDevInfo->visidName = strdup(visid.name);
-                return curDevInfo;
-            }
-            dlclose(handle);
-        }
-    }
-    return NULL;
-}
-static int
-mmap_dgaDev(SolarisDgaLibInfo *libInfo, Dga_drawable dgadraw)
-{
-
-    if (!libInfo->devInfo) {
-        libInfo->devInfo = getDevInfo(dgadraw);
-        if (!libInfo->devInfo) {
-            return JDGA_FAILED;
-        }
-    }
-    return (*libInfo->devInfo->function->winopen)(&(libInfo->winInfo));
-}
-
-static void
-unmap_dgaDev(SolarisDgaLibInfo *pDevInfo)
-{
-    DEBUG_PRINT(("winclose() called\n"));
-   (*pDevInfo->devInfo->function->winclose)(&(pDevInfo->winInfo));
-}
-
-static jboolean
-Solaris_DGA_Available(Display *display)
-{
-    Window root;
-    int screen;
-    Dga_drawable dgaDrawable;
-    SolarisJDgaDevInfo * devinfo;
-
-    /* return true if any screen supports DGA and we
-     have a library for this type of framebuffer */
-    for (screen = 0; screen < XScreenCount(display); screen++) {
-        root = RootWindow(display, screen);
-
-        dgaDrawable = XDgaGrabDrawable(display, root);
-        if (dgaDrawable != 0) {
-            devinfo = getDevInfo(dgaDrawable);
-            XDgaUnGrabDrawable(dgaDrawable);
-            if (devinfo != NULL) {
-                return JNI_TRUE;
-            }
-        }
-    }
-    return JNI_FALSE;
-}
-
-static JDgaLibInitFunc          Solaris_DGA_LibInit;
-static JDgaGetLockFunc          Solaris_DGA_GetLock;
-static JDgaReleaseLockFunc      Solaris_DGA_ReleaseLock;
-static JDgaXRequestSentFunc     Solaris_DGA_XRequestSent;
-static JDgaLibDisposeFunc       Solaris_DGA_LibDispose;
-static int firstInitDone = 0;
-
-#pragma weak JDgaLibInit = Solaris_DGA_LibInit
-
-static JDgaStatus
-Solaris_DGA_LibInit(JNIEnv *env, JDgaLibInfo *ppInfo)
-{
-    /* Note: DGA_INIT can be called multiple times according to docs */
-    DEBUG_PRINT(("DGA_INIT called\n"));
-    DGA_INIT();
-
-    if (!Solaris_DGA_Available(ppInfo->display)) {
-        return JDGA_FAILED;
-    }
-    Solaris_DGA_XineramaInit(ppInfo->display);
-
-    ppInfo->pGetLock = Solaris_DGA_GetLock;
-    ppInfo->pReleaseLock = Solaris_DGA_ReleaseLock;
-    ppInfo->pXRequestSent = Solaris_DGA_XRequestSent;
-    ppInfo->pLibDispose = Solaris_DGA_LibDispose;
-
-    return JDGA_SUCCESS;
-}
-
-static JDgaStatus
-Solaris_DGA_GetLock(JNIEnv *env, Display *display, void **dgaDev,
-                        Drawable drawable, JDgaSurfaceInfo *pSurface,
-                        jint lox, jint loy, jint hix, jint hiy)
-{
-    SolarisDgaLibInfo *pDevInfo;
-    SolarisDgaLibInfo *pCachedInfo = cachedInfo;
-    int vis;
-    int dlox, dloy, dhix, dhiy;
-    int i;
-    int type, site;
-    unsigned long k;
-    Drawable prev_virtual_drawable = 0;
-    Dga_drawable dgaDrawable;
-
-    if (*dgaDev) {
-        if (((SolarisDgaLibInfo *)(*dgaDev))->drawable != drawable) {
-            *dgaDev = 0;
-        }
-    }
-
-    if (*dgaDev == 0) {
-        pCachedInfo = cachedInfo;
-        for (i = 0 ; (i < MAX_CACHED_INFO) && (pCachedInfo->drawable) ;
-             i++, pCachedInfo++) {
-            if (pCachedInfo->drawable == drawable) {
-                *dgaDev = pCachedInfo;
-                break;
-            }
-        }
-        if (*dgaDev == 0) {
-            if (i < MAX_CACHED_INFO) { /* slot can be used for new info */
-                 *dgaDev = pCachedInfo;
-            } else {
-                pCachedInfo = cachedInfo;
-                /* find the least used slot but does not handle an overflow of
-                   the counter */
-                for (i = 0, k = 0xffffffff; i < MAX_CACHED_INFO ;
-                     i++, pCachedInfo++) {
-                    if (k > pCachedInfo->count) {
-                        k = pCachedInfo->count;
-                        *dgaDev = pCachedInfo;
-                    }
-                    pCachedInfo->count = 0; /* reset all counters */
-                }
-                pCachedInfo = *dgaDev;
-                if (pCachedInfo->winInfo.dgaDraw != 0) {
-                    XDgaUnGrabDrawable(pCachedInfo->winInfo.dgaDraw);
-                }
-                pCachedInfo->winInfo.dgaDraw = 0;
-                /* the slot might be used for another device */
-                pCachedInfo->devInfo = 0;
-            }
-        }
-    }
-
-    pDevInfo = *dgaDev;
-    pDevInfo->drawable = drawable;
-
-    prev_virtual_drawable = pDevInfo->virtual_drawable;
-    pDevInfo->virtual_drawable = GetVirtualDrawable(display, drawable);
-    if (pDevInfo->virtual_drawable == NULL) {
-        /* this usually means that the drawable is spanned across
-           screens in xinerama mode - we can't handle this for now */
-        return JDGA_FAILED;
-    } else {
-        /* check if the drawable has been moved to another screen
-           since last time */
-        if (pDevInfo->winInfo.dgaDraw != 0 &&
-            pDevInfo->virtual_drawable != prev_virtual_drawable) {
-            XDgaUnGrabDrawable(pDevInfo->winInfo.dgaDraw);
-            pDevInfo->winInfo.dgaDraw = 0;
-        }
-    }
-
-    pDevInfo->count++;
-
-    if (pDevInfo->winInfo.dgaDraw == 0) {
-        pDevInfo->winInfo.dgaDraw = XDgaGrabDrawable(display, pDevInfo->virtual_drawable);
-        if (pDevInfo->winInfo.dgaDraw == 0) {
-            DEBUG_PRINT(("DgaGrabDrawable failed for 0x%08x\n", drawable));
-            return JDGA_UNAVAILABLE;
-        }
-        type = dga_draw_type(pDevInfo->winInfo.dgaDraw);
-        if (type != DGA_DRAW_PIXMAP &&
-            mmap_dgaDev(pDevInfo, pDevInfo->winInfo.dgaDraw) != JDGA_SUCCESS) {
-            DEBUG_PRINT(("memory map failed for 0x%08x (depth = %d)\n",
-                         drawable, dga_draw_depth(pDevInfo->winInfo.dgaDraw)));
-            XDgaUnGrabDrawable(pDevInfo->winInfo.dgaDraw);
-            pDevInfo->winInfo.dgaDraw = 0;
-            return JDGA_UNAVAILABLE;
-        }
-    } else {
-        type = dga_draw_type(pDevInfo->winInfo.dgaDraw);
-    }
-
-    if (needsSync) {
-        XSync(display, False);
-        needsSync = JNI_FALSE;
-    }
-
-    dgaDrawable = pDevInfo->winInfo.dgaDraw;
-
-    DGA_DRAW_LOCK(dgaDrawable, -1);
-
-    site = dga_draw_site(dgaDrawable);
-    if (type == DGA_DRAW_PIXMAP) {
-        if (site == DGA_SITE_SYSTEM) {
-            pDevInfo->winInfo.mapDepth = dga_draw_depth(dgaDrawable);
-            pDevInfo->winInfo.mapAddr = dga_draw_address(dgaDrawable);
-            dga_draw_bbox(dgaDrawable, &dlox, &dloy, &dhix, &dhiy);
-            pDevInfo->winInfo.mapWidth = dhix;
-            pDevInfo->winInfo.mapHeight = dhiy;
-            if (pDevInfo->winInfo.mapDepth == 8) {
-                pDevInfo->winInfo.mapLineStride = dga_draw_linebytes(dgaDrawable);
-                pDevInfo->winInfo.mapPixelStride = 1;
-            } else {
-                pDevInfo->winInfo.mapLineStride = dga_draw_linebytes(dgaDrawable)/4;
-                pDevInfo->winInfo.mapPixelStride = 4;
-            }
-        } else {
-            XDgaUnGrabDrawable(dgaDrawable);
-            pDevInfo->winInfo.dgaDraw = 0;
-            return JDGA_UNAVAILABLE;
-        }
-    } else {
-        if (site == DGA_SITE_NULL) {
-            DEBUG_PRINT(("zombie drawable = 0x%08x\n", dgaDrawable));
-            DGA_DRAW_UNLOCK(dgaDrawable);
-            unmap_dgaDev(pDevInfo);
-            XDgaUnGrabDrawable(dgaDrawable);
-            pDevInfo->winInfo.dgaDraw = 0;
-            return JDGA_UNAVAILABLE;
-        }
-        dga_draw_bbox(dgaDrawable, &dlox, &dloy, &dhix, &dhiy);
-    }
-
-    /* get the screen address of the drawable */
-    dhix += dlox;
-    dhiy += dloy;
-    DEBUG_PRINT(("window at (%d, %d) => (%d, %d)\n", dlox, dloy, dhix, dhiy));
-    pSurface->window.lox = dlox;
-    pSurface->window.loy = dloy;
-    pSurface->window.hix = dhix;
-    pSurface->window.hiy = dhiy;
-
-            /* translate rendering coordinates relative to device bbox */
-    lox += dlox;
-    loy += dloy;
-    hix += dlox;
-    hiy += dloy;
-    DEBUG_PRINT(("render at (%d, %d) => (%d, %d)\n", lox, loy, hix, hiy));
-
-    vis = dga_draw_visibility(dgaDrawable);
-    switch (vis) {
-    case DGA_VIS_UNOBSCURED:
-        pSurface->visible.lox = max(dlox, lox);
-        pSurface->visible.loy = max(dloy, loy);
-        pSurface->visible.hix = min(dhix, hix);
-        pSurface->visible.hiy = min(dhiy, hiy);
-        DEBUG_PRINT(("unobscured vis at (%d, %d) => (%d, %d)\n",
-                     pSurface->visible.lox,
-                     pSurface->visible.loy,
-                     pSurface->visible.hix,
-                     pSurface->visible.hiy));
-        break;
-    case DGA_VIS_PARTIALLY_OBSCURED: {
-        /*
-         * fix for #4305271
-         * the dga_draw_clipinfo call returns the clipping bounds
-         * in short ints, but use only full size ints for all comparisons.
-         */
-        short *ptr;
-        int x0, y0, x1, y1;
-        int cliplox, cliploy, cliphix, cliphiy;
-
-        /*
-         * iterate to find out whether the clipped blit draws to a
-         * single clipping rectangle
-         */
-        cliplox = cliphix = lox;
-        cliploy = cliphiy = loy;
-        ptr = dga_draw_clipinfo(dgaDrawable);
-        while (*ptr != DGA_Y_EOL) {
-            y0 = *ptr++;
-            y1 = *ptr++;
-            DEBUG_PRINT(("DGA y range loy=%d hiy=%d\n", y0, y1));
-            if (y0 < loy) {
-                y0 = loy;
-            }
-            if (y1 > hiy) {
-                y1 = hiy;
-            }
-            while (*ptr != DGA_X_EOL) {
-                x0 = *ptr++;
-                x1 = *ptr++;
-                DEBUG_PRINT(("  DGA x range lox=%d hix=%d\n", x0, x1));
-                if (x0 < lox) {
-                    x0 = lox;
-                }
-                if (x1 > hix) {
-                    x1 = hix;
-                }
-                if (x0 < x1 && y0 < y1) {
-                    if (cliploy == cliphiy) {
-                                /* First rectangle intersection */
-                        cliplox = x0;
-                        cliploy = y0;
-                        cliphix = x1;
-                        cliphiy = y1;
-                    } else {
-                                /* Can we merge this rect with previous? */
-                        if (cliplox == x0 && cliphix == x1 &&
-                            cliploy <= y1 && cliphiy >= y0)
-                            {
-                                /* X ranges match, Y ranges touch */
-                                /* => absorb the Y ranges together */
-                                cliploy = min(cliploy, y0);
-                                cliphiy = max(cliphiy, y1);
-                            } else if (cliploy == y0 && cliphiy == y1 &&
-                                       cliplox <= x1 && cliphix >= x0)
-                                {
-                                    /* Y ranges match, X ranges touch */
-                                    /* => Absorb the X ranges together */
-                                    cliplox = min(cliplox, x0);
-                                    cliphix = max(cliphix, x1);
-                                } else {
-                                    /* Assertion: any other combination */
-                                    /* means non-rectangular intersect */
-                                    DGA_DRAW_UNLOCK(dgaDrawable);
-                                    return JDGA_FAILED;
-                                }
-                    }
-                }
-            }
-            ptr++; /* advance past DGA_X_EOL */
-        }
-        DEBUG_PRINT(("DGA drawable fits\n"));
-        pSurface->visible.lox = cliplox;
-        pSurface->visible.loy = cliploy;
-        pSurface->visible.hix = cliphix;
-        pSurface->visible.hiy = cliphiy;
-        break;
-    }
-    case DGA_VIS_FULLY_OBSCURED:
-        pSurface->visible.lox =
-            pSurface->visible.hix = lox;
-        pSurface->visible.loy =
-            pSurface->visible.hiy = loy;
-        DEBUG_PRINT(("fully obscured vis\n"));
-        break;
-    default:
-        DEBUG_PRINT(("unknown visibility = %d!\n", vis));
-        DGA_DRAW_UNLOCK(dgaDrawable);
-        return JDGA_FAILED;
-    }
-
-    pSurface->basePtr = pDevInfo->winInfo.mapAddr;
-    pSurface->surfaceScan = pDevInfo->winInfo.mapLineStride;
-    pSurface->surfaceWidth = pDevInfo->winInfo.mapWidth;
-    pSurface->surfaceHeight = pDevInfo->winInfo.mapHeight;
-    pSurface->surfaceDepth = pDevInfo->winInfo.mapDepth;
-
-    return JDGA_SUCCESS;
-}
-
-static JDgaStatus
-Solaris_DGA_ReleaseLock(JNIEnv *env, void *dgaDev, Drawable drawable)
-{
-    SolarisDgaLibInfo *pDevInfo = (SolarisDgaLibInfo *) dgaDev;
-
-    if (pDevInfo != 0 && pDevInfo->drawable == drawable &&
-        pDevInfo->winInfo.dgaDraw != 0) {
-        DGA_DRAW_UNLOCK(pDevInfo->winInfo.dgaDraw);
-    }
-    return JDGA_SUCCESS;
-}
-
-static void
-Solaris_DGA_XRequestSent(JNIEnv *env, void *dgaDev, Drawable drawable)
-{
-    needsSync = JNI_TRUE;
-}
-
-static void
-Solaris_DGA_LibDispose(JNIEnv *env)
-{
-    SolarisDgaLibInfo *pCachedInfo = cachedInfo;
-    SolarisJDgaDevInfo *curDevInfo = devicesInfo;
-    int i;
-
-    for (i = 0 ; (i < MAX_CACHED_INFO) && (pCachedInfo->drawable) ;
-         i++, pCachedInfo++) {
-        if (pCachedInfo->winInfo.dgaDraw != 0) {
-            if (dga_draw_type(pCachedInfo->winInfo.dgaDraw) == DGA_DRAW_WINDOW &&
-                pCachedInfo->winInfo.mapDepth != 0) {
-                unmap_dgaDev(pCachedInfo);
-            }
-            XDgaUnGrabDrawable(pCachedInfo->winInfo.dgaDraw);
-            pCachedInfo->winInfo.dgaDraw = 0;
-        }
-    }
-    for (i = 0; (i < MAX_FB_TYPES) && (curDevInfo->visidName);
-         i++, curDevInfo++) {
-        curDevInfo->function->devclose(curDevInfo);
-        free(curDevInfo->visidName);
-    }
-}
-#endif
--- a/jdk/src/java.desktop/unix/native/libsunwjdga/jdga.h	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,255 +0,0 @@
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-/*
- * The JDGA interface enables "Direct Graphics Access" to the pixels
- * of X11 drawables for the Java runtime graphics implementation.
- *
- * This include file defines the external interface that the
- * Solaris X11 port of the Java(tm) 2D API uses to communicate
- * with a dynamically loadable object library to obtain information
- * for rendering directly to the memory mapped surfaces that store
- * the pixel information for an X11 Window (or technically any X11
- * Drawable).
- *
- * The 2D graphics library will link to an object file, either
- * through direct linking at compile time or through dynamic
- * loading at runtime, and use an entry point defined as
- *
- *      JDgaLibInitFunc JDgaLibInit;
- *
- * to initialize the library and obtain a copy of a JDgaLibInfo
- * structure that will be used to communicate with the library
- * to obtain information about X11 Drawable IDs and the memory
- * used to store their pixels.
- *
- * Some parts of this interface use interfaces and structures
- * defined by the JNI native interface technology.
- */
-
-#ifndef HEADLESS
-/*
- *
- */
-#define JDGALIB_MAJOR_VERSION 1
-#define JDGALIB_MINOR_VERSION 0
-
-/*
- * Definitions for the return status codes for most of the JDGA
- * access functions.
- */
-#ifndef _DEFINE_JDGASTATUS_
-#define _DEFINE_JDGASTATUS_
-typedef enum {
-    JDGA_SUCCESS        = 0,    /* operation succeeded */
-    JDGA_FAILED         = 1,     /* unable to complete operation */
-    JDGA_UNAVAILABLE    = 2     /* DGA not available on attached devices */
-} JDgaStatus;
-#endif
-
-/*
- * This structure defines the location and size of a rectangular
- * region of a drawing surface.
- *
- *      lox, loy - coordinates that point to the pixel just inside
- *                      the top left-hand corner of the region.
- *      hix, hiy - coordinates that point to the pixel just beyond
- *                      the bottom right-hand corner of the region.
- *
- * Thus, the region is a rectangle containing (hiy-loy) rows of
- * (hix-lox) columns of pixels.
- */
-typedef struct {
-    jint        lox;
-    jint        loy;
-    jint        hix;
-    jint        hiy;
-} JDgaBounds;
-
-typedef struct {
-    /*
-     * Information describing the global memory partition containing
-     * the pixel information for the window.
-     */
-    void        *basePtr;       /* Base address of memory partition. */
-    jint        surfaceScan;    /* Number of pixels from one row to the next */
-    jint        surfaceWidth;   /* Total accessible pixels across */
-    jint        surfaceHeight;  /* Total accessible pixels down */
-    jint        surfaceDepth;   /* Mapped depth */
-
-    /*
-     * Location and size information of the entire window (may include
-     * portions outside of the memory partition).
-     *
-     * The coordinates are relative to the "basePtr" origin of the screen.
-     */
-    JDgaBounds  window;
-
-    /*
-     * Location and size information of the visible portion of the
-     * window (includes only portions that are inside the writable
-     * portion of the memory partition and not covered by other windows)
-     *
-     * This rectangle may represent a subset of the rendering
-     * rectangle supplied in the JDgaGetLock function if that
-     * rectangle is partially clipped and the remaining visible
-     * portion is exactly rectangular.
-     *
-     * The coordinates are relative to the "basePtr" origin of the screen.
-     */
-    JDgaBounds  visible;
-
-} JDgaSurfaceInfo;
-
-typedef struct _JDgaLibInfo JDgaLibInfo;
-
-/*
- * This function is called to initialize the JDGA implementation
- * library for access to the given X11 Display.
- * This function stores a pointer to a structure that holds function
- * pointers for the rest of the requests as well as any additinoal
- * data that that library needs to track the indicated display.
- *
- * @return
- *      JDGA_SUCCESS if library was successfully initialized
- *      JDGA_FAILED if library is unable to perform operations
- *              on the given X11 Display.
- */
-typedef JDgaStatus
-JDgaLibInitFunc(JNIEnv *env, JDgaLibInfo *ppInfo);
-
-/*
- * This function is called to lock the given X11 Drawable into
- * a locally addressable memory location and to return specific
- * rendering information about the location and geometry of the
- * display memory that the Drawable occupies.
- *
- * Information provided to this function includes:
- *
- *      lox, loy - the X and Y coordinates of the pixel just inside
- *              the upper left corner of the region to be rendered
- *      hix, hiy - the X and Y coordinates of the pixel just beyond
- *              the lower right corner of the region to be rendered
- *
- * Information obtained via this function includes:
- *
- *      *pSurface - A pointer to a JDgaSurfaceInfo structure which is
- *              filled in with information about the drawing area for
- *              the specified Drawable.
- *
- * The return value indicates whether or not the library was able
- * to successfully lock the drawable into memory and obtain the
- * specific geometry information required to render to the Drawable's
- * pixel memory.  Failure indicates only a temporary inability to
- * lock down the memory for this Drawable and does not imply a general
- * inability to lock this or other Drawable's at a later time.
- *
- * If the indicated rendering region is not visible at all then this
- * function should indicate JDGA_SUCCESS and return an empty
- * "visible" rectangle.
- * If the indicated rendering region has a visible portion that cannot
- * be expressed as a single rectangle in the JDgaSurfaceInfo structure
- * then JDGA_FAILED should be indicated so that the rendering library
- * can back off to another rendering mechanism.
- *
- * @return
- *      JDGA_SUCCESS memory successfully locked and described
- *      JDGA_FAILED temporary failure to lock the specified Drawable
- */
-typedef JDgaStatus
-JDgaGetLockFunc(JNIEnv *env, Display *display, void **dgaDev,
-                    Drawable d, JDgaSurfaceInfo *pSurface,
-                    jint lox, jint loy, jint hix, jint hiy);
-
-/*
- * This function is called to unlock the locally addressable memory
- * associated with the given X11 Drawable until the next rendering
- * operation.  The JDgaSurfaceInfo structure supplied is the same
- * structure that was supplied in the dga_get_lock function and
- * can be used to determine implementation specific data needed to
- * manage the access lock for the indicated drawable.
- *
- * The return value indicates whether or not the library was able
- * to successfully remove its lock.  Typically failure indicates
- * only that the lock had been invalidated through external means
- * before the rendering library completed its work and is for
- * informational purposes only, though it could also mean that
- * the rendering library asked to unlock a Drawable that it had
- * never locked.
- *
- * @return
- *      JDGA_SUCCESS lock successfully released
- *      JDGA_FAILED unable to release lock for some reason,
- *              typically the lock was already invalid
- */
-typedef JDgaStatus
-JDgaReleaseLockFunc(JNIEnv *env, void *dgaDev, Drawable d);
-
-/*
- * This function is called to inform the JDGA library that the
- * AWT rendering library has enqueued an X11 request for the
- * indicated Drawable.  The JDGA library will have to synchronize
- * the X11 output buffer with the server before this drawable
- * is again locked in order to prevent race conditions between
- * the rendering operations in the X11 queue and the rendering
- * operations performed directly between calls to the GetLockFunc
- * and the ReleaseLockFunc.
- */
-typedef void
-JDgaXRequestSentFunc(JNIEnv *env, void *dgaDev, Drawable d);
-
-/*
- * This function is called to shut down a JDGA library implementation
- * and dispose of any resources that it is using for a given display.
- *
- */
-
-typedef void
-JDgaLibDisposeFunc(JNIEnv *env);
-
-struct _JDgaLibInfo {
-    /*
-     * The X11 display structure that this instance of JDgaLibInfo
-     * structure is tracking.
-     */
-    Display                     *display;
-
-    /*
-     * Pointers to the utility functions to query information about
-     * X11 drawables and perform synchronization on them.
-     */
-    JDgaGetLockFunc             *pGetLock;
-    JDgaReleaseLockFunc         *pReleaseLock;
-    JDgaXRequestSentFunc        *pXRequestSent;
-    JDgaLibDisposeFunc          *pLibDispose;
-
-    /*
-     * Since the JDGA library is responsible for allocating this
-     * structure, implementation specific information can be tracked
-     * by the library by declaring its own structure that contains
-     * data following the above members.
-     */
-};
-#endif /* !HEADLESS */
--- a/jdk/src/java.desktop/unix/native/libsunwjdga/jdgadevice.h	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,218 +0,0 @@
-/*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-#ifndef _JDGADEVICE_H_
-#define _JDGADEVICE_H_
-
-/*
- *   Interface for Supporting DGA to Framebuffers under Java
- *   -------------------------------------------------------
- *
- *  This interface will allow third party (and Sun) framebuffers which
- *  support the Direct Graphics Access (DGA) interface to be accessed with
- *  DGA in Java applications.
- *
- *  It coexists with the existing device-independent interfaces provided in
- *  libsunwjdga.so.
- *
- *  Framebuffers desiring access to Java DGA must supply a dynamically
- *  loaded library named "libjdga<fbname>.so", where <fbname> is the name
- *  returned by the VIS_GETIDENTIFIER ioctl as defined in the Solaris
- *  VISUAL environment (visual_io(7i)). For example, the Java DGA library
- *  for Sun's cg6 framebuffer will be named libjdgaSUNWcg6.so.
- *
- *  Because multiple instances of a framebuffer type may exist on a system,
- *  the device-dependent library must avoid the use of static or global
- *  variables for any framebuffer-related variables. In other words it
- *  must be reentrant.
- *
- *  The device-independent function Solaris_JDga_LibInit() is called in the
- *  static initializer for X11Graphics.java. Solaris_JDga_LibInit() will be
- *  modified to seek out a device-dependent DGA library as follows.
- *
- *  - DGA grab the DefaultRootWindow to get a Dga_drawable.
- *
- *  - Use the Dga_drawable ID to get the device file descriptor
- *       fd = dga_win_devfd(dga_draw_id)
- *
- *  - Use the VIS_GETIDENTIFIER ioctl to get the device name string.
- *
- *  - Construct the library path name using the device name string.
- *    The device-dependent library must be located in a location specified
- *    in the LD_LIBRARY_PATH.
- *
- *  - The device-dependent library will be dlopen'ed and then a dlsym will
- *    be performed for the function "SolarisJDgaDevOpen", which must
- *    be implemented by the device-dependent library writer.
- *
- *  - The function SolarisJDgaDevOpen() will then be called with a
- *    pointer to a SolarisJDgaDevInfo structure. This structure will
- *    have its major and minor version numbers filled in with their
- *    current values by the device-independent calling code. The
- *    device-dependent library must examine these version numbers and
- *    act as follows:
- *
- *      - In all cases, the device-dependent code should reset the
- *        supplied major and minor version numbers to those of the
- *        device-dependent library.
- *
- *      - If the supplied major version number is not the same as that
- *        of the device library, the open must fail and return JDGA_FAILED.
- *
- *      - If the supplied minor version number is less than or equal to
- *        the device minor version number, then backward compatibility
- *        is assumed and the open should return JDGA_SUCCESS.
- *
- *      - If the supplied minor version number is greater than the
- *        device minor version number, the open should also return
- *        JDGA_SUCCESS. The returned device minor version number will
- *        indicate to the device-independent code what features are
- *        supported in the device library.
- *
- *  - The function SolarisJDgaDevOpen() must also return a structure
- *    containing function pointers as given in the SolarisJDgaDevFunc
- *    structure below. The winlock and winunlock functions are
- *    required only if there is some device-specific locking to be done
- *    in addition to the DGA lock. If this is not required for the device
- *    these function pointers may be specified as NULL pointers.
- *
- */
-
-#include <dga/dga.h>
-#include <unistd.h>     /* ioctl */
-#include <stdlib.h>
-#include <sys/mman.h>   /* mmap */
-#include <sys/visual_io.h>
-#include <X11/Xlib.h>
-
-/*
- * Status return codes
- */
-#ifndef _DEFINE_JDGASTATUS_
-#define _DEFINE_JDGASTATUS_
-typedef enum {
-    JDGA_SUCCESS        = 0,    /* operation succeeded */
-    JDGA_FAILED         = 1     /* unable to complete operation */
-} JDgaStatus;
-#endif
-
-/*
- * Structure to be filled in by device-dependent library's
- * SolarisJDgaDevOpen() function
- */
-typedef struct {
-  char *                         visidName; /* device name from ioctl */
-  int                         majorVersion;
-  int                         minorVersion;
-  struct _SolarisJDgaDevFuncList* function;    /* Device function pointers */
-} SolarisJDgaDevInfo;
-
-/*
- * Structure returned by device-dependent library for a window
- */
-typedef struct {
-  SolarisJDgaDevInfo* devInfo;        /* Supplied by caller */
-  Dga_drawable        dgaDraw;        /* Supplied by caller */
-  caddr_t             mapAddr;        /* FB mapping for this window */
-  int                 mapDepth;       /* Depth in bits */
-  int                 mapWidth;       /* Width in pixels */
-  int                 mapHeight;      /* Height in lines */
-  int                 mapLineStride;  /* Byte stride line-to-line */
-  int                 mapPixelStride; /* Byte stride pixel-to-pixel */
-  void*               privateData;    /* Handle for device-dependent library */
-} SolarisJDgaWinInfo;
-
-typedef JDgaStatus (*SolarisJDgaDevFunction)(SolarisJDgaDevInfo*);
-typedef JDgaStatus (*SolarisJDgaWinFunction)(SolarisJDgaWinInfo*);
-
-/*
- * Structure for device-dependent functions
- */
-typedef struct _SolarisJDgaDevFuncList {
-  SolarisJDgaDevFunction devclose;
-  SolarisJDgaWinFunction winopen;
-  SolarisJDgaWinFunction winclose;
-  SolarisJDgaWinFunction winlock;
-  SolarisJDgaWinFunction winunlock;
-} SolarisJDgaDevFuncList;
-
-/*
- * Function to be supplied by the device-dependent library implementor.
- * It will accept a SolarisJDgaDevInfo structure with a filled-in
- * major and minor version number and will return updated version
- * numbers and the function pointers described below.
- */
-typedef JDgaStatus SolarisJDgaDevOpenFunc(SolarisJDgaDevInfo* devInfo);
-
-JDgaStatus SolarisJDgaDevOpen(SolarisJDgaDevInfo* devInfo);
-
-/*
- * Functions supplied by the device-dependent library.
- * These function pointers will be returned to the
- * device-independent code in the SolarisJDgaDevFunc structure.
- */
-
-JDgaStatus (*winopen)(SolarisJDgaWinInfo* info);
-
-/*
- *  Fills in window-specific information in the supplied SolarisJDgaWinInfo
- *  structure. Because multiple windows may be open concurrently,
- *  implementations should avoid the use of static structures.
- */
-
-JDgaStatus (*winclose)(SolarisJDgaWinInfo* info);
-
-/*
- *  Frees any resources allocated by the device-dependent library for
- *  this window.  It may also perform an unmap if this is the last
- *  window using this particular memory map. Devices, such as the FFB,
- *  which support multiple depths, can have different device memory
- *  mappings for different depths.
- */
-
-JDgaStatus (*winlock)(SolarisJDgaWinInfo* info);
-
-/*
- *  Performs any device-specific locking needed for the framebuffer.
- *  In most cases it will be unnecessary. In those cases, the
- *  device-dependent library can supply NULL for this function pointer.
- */
-
-JDgaStatus (*winunlock)(SolarisJDgaWinInfo* info);
-
-/*
- *  Performs any device-specific unlocking needed for the framebuffer.
- *  In most cases it will be unnecessary. In those cases, the
- *  device-dependent library can supply NULL for this function pointer.
- */
-
-JDgaStatus (*devclose)(SolarisJDgaDevInfo* info);
-
-/*
- *  This function will be called at the last usage of the framebuffer
- *  device to allow the library to clean up any remaining resources.
- */
-
-#endif  /* _JDGADEVICE_H_ */
--- a/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java	Sat Sep 09 14:36:45 2017 +0200
@@ -240,6 +240,10 @@
     private Image largeIcon = null;
     private Boolean isDir = null;
     private final boolean isLib;
+    private static final String FNAME = COLUMN_NAME;
+    private static final String FSIZE = COLUMN_SIZE;
+    private static final String FTYPE = "FileChooser.fileTypeHeaderText";
+    private static final String FDATE = COLUMN_DATE;
 
     /*
      * The following is to identify the My Documents folder as being special
--- a/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Sat Sep 09 14:36:45 2017 +0200
@@ -443,17 +443,12 @@
     public boolean isFileSystemRoot(File dir) {
         //Note: Removable drives don't "exist" but are listed in "My Computer"
         if (dir != null) {
-            Win32ShellFolder2 drives = getDrives();
+
             if (dir instanceof Win32ShellFolder2) {
                 Win32ShellFolder2 sf = (Win32ShellFolder2)dir;
-                if (sf.isFileSystem()) {
-                    if (sf.parent != null) {
-                        return sf.parent.equals(drives);
-                    }
-                    // else fall through ...
-                } else {
-                    return false;
-                }
+
+                return (sf.isFileSystem() && sf.parent != null &&
+                        sf.parent.equals(Win32ShellFolder2.listRoots()));
             }
             String path = dir.getPath();
 
@@ -461,9 +456,9 @@
                 return false;
             }
 
-            File[] files = drives.listFiles();
+            File[] roots = Win32ShellFolder2.listRoots();
 
-            return files != null && Arrays.asList(files).contains(dir);
+            return roots != null && Arrays.asList(roots).contains(dir);
         }
         return false;
     }
@@ -561,6 +556,11 @@
                         ThreadGroupUtils.getRootThreadGroup(), comRun, name,
                         0, false);
                 thread.setDaemon(true);
+                /* This is important, since this thread running at lower priority
+                   leads to memory consumption when listDrives() function is called
+                   repeatedly.
+                 */
+                thread.setPriority(Thread.MAX_PRIORITY);
                 return thread;
             });
             return comThread;
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WColor.java	Fri Sep 01 14:13:40 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1996, 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.  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.awt.windows;
-
-import java.awt.Color;
-
-/*
- * This helper class maps Windows system colors to AWT Color objects.
- */
-final class WColor {
-
-    static final int WINDOW_BKGND = 1;  // COLOR_WINDOW
-    static final int WINDOW_TEXT  = 2;  // COLOR_WINDOWTEXT
-    static final int FRAME        = 3;  // COLOR_WINDOWFRAME
-    static final int SCROLLBAR    = 4;  // COLOR_SCROLLBAR
-    static final int MENU_BKGND   = 5;  // COLOR_MENU
-    static final int MENU_TEXT    = 6;  // COLOR MENUTEXT
-    static final int BUTTON_BKGND = 7;  // COLOR_3DFACE or COLOR_BTNFACE
-    static final int BUTTON_TEXT  = 8;  // COLOR_BTNTEXT
-    static final int HIGHLIGHT    = 9;  // COLOR_HIGHLIGHT
-
-    static native Color getDefaultColor(int index);
-}
--- a/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPanelPeer.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/classes/sun/awt/windows/WPanelPeer.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -22,10 +22,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package sun.awt.windows;
 
-import java.awt.*;
-import java.awt.peer.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.SystemColor;
+import java.awt.peer.PanelPeer;
 
 import sun.awt.SunGraphicsCallback;
 
@@ -81,13 +87,13 @@
 
         Color c = ((Component)target).getBackground();
         if (c == null) {
-            c = WColor.getDefaultColor(WColor.WINDOW_BKGND);
+            c = SystemColor.window;
             ((Component)target).setBackground(c);
             setBackground(c);
         }
         c = ((Component)target).getForeground();
         if (c == null) {
-            c = WColor.getDefaultColor(WColor.WINDOW_TEXT);
+            c = SystemColor.windowText;
             ((Component)target).setForeground(c);
             setForeground(c);
         }
--- a/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/ShellFolder2.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -109,6 +109,16 @@
 static IMalloc* pMalloc;
 static IShellFolder* pDesktop;
 
+// locale sensitive folder info
+static jfieldID FID_lsName;
+static jfieldID FID_lsSize;
+static jfieldID FID_lsType;
+static jfieldID FID_lsDate;
+static jstring lsName;
+static jstring lsSize;
+static jstring lsType;
+static jstring lsDate;
+
 // Some macros from awt.h, because it is not included in release
 #ifndef IS_WIN2000
 #define IS_WIN2000 (LOBYTE(LOWORD(::GetVersion())) >= 5)
@@ -246,6 +256,36 @@
     CHECK_NULL(FID_displayName);
     FID_folderType = env->GetFieldID(cls, "folderType", "Ljava/lang/String;");
     CHECK_NULL(FID_folderType);
+
+    FID_lsName = env->GetStaticFieldID(cls, "FNAME", "Ljava/lang/String;");
+    CHECK_NULL(FID_lsName);
+    if (env->ExceptionCheck()) {
+        env->ExceptionClear();
+        return;
+    }
+    FID_lsSize = env->GetStaticFieldID(cls, "FSIZE", "Ljava/lang/String;");
+    CHECK_NULL(FID_lsSize);
+    if (env->ExceptionCheck()) {
+        env->ExceptionClear();
+        return;
+    }
+    FID_lsType = env->GetStaticFieldID(cls, "FTYPE", "Ljava/lang/String;");
+    CHECK_NULL(FID_lsType);
+    if (env->ExceptionCheck()) {
+        env->ExceptionClear();
+        return;
+    }
+    FID_lsDate = env->GetStaticFieldID(cls, "FDATE", "Ljava/lang/String;");
+    CHECK_NULL(FID_lsDate);
+    if (env->ExceptionCheck()) {
+        env->ExceptionClear();
+        return;
+    }
+
+    lsName = (jstring) (env->NewGlobalRef(env->GetStaticObjectField(cls, FID_lsName)));
+    lsSize = (jstring) (env->NewGlobalRef(env->GetStaticObjectField(cls, FID_lsSize)));
+    lsType = (jstring) (env->NewGlobalRef(env->GetStaticObjectField(cls, FID_lsType)));
+    lsDate = (jstring) (env->NewGlobalRef(env->GetStaticObjectField(cls, FID_lsDate)));
 }
 
 
@@ -1105,11 +1145,21 @@
  */
 static jobject CreateColumnInfo(JNIEnv *pEnv,
                                 jclass *pClass, jmethodID *pConstructor,
-                                SHELLDETAILS *psd, ULONG visible)
+                                int colNum, SHELLDETAILS *psd, ULONG visible)
 {
     jstring str = jstringFromSTRRET(pEnv, NULL, &(psd->str));
     JNU_CHECK_EXCEPTION_RETURN(pEnv, NULL);
 
+    // Convert ShellFolder column names to locale-sensitive names
+    if (colNum == 0) {
+        str = lsName;
+    } else if (colNum == 1) {
+        str = lsSize;
+    } else if (colNum == 2) {
+        str = lsType;
+    } else if (colNum == 3) {
+        str = lsDate;
+    }
     return pEnv->NewObject(*pClass, *pConstructor,
                     str,
                     (jint)(psd->cxChar * 6), // TODO: is 6 OK for converting chars to pixels?
@@ -1178,7 +1228,7 @@
                     if(!(csFlags & SHCOLSTATE_HIDDEN)) {
                         jobject column = CreateColumnInfo(env,
                                             &columnClass, &columnConstructor,
-                                            &sd, csFlags & SHCOLSTATE_ONBYDEFAULT);
+                                            colNum, &sd, csFlags & SHCOLSTATE_ONBYDEFAULT);
                         if(!column){
                             pIShellFolder2->Release();
                             return NULL;
@@ -1222,7 +1272,7 @@
             if (SUCCEEDED (hr)) {
                 jobject column = CreateColumnInfo(env,
                                     &columnClass, &columnConstructor,
-                                    &sd, 1);
+                                    colNum, &sd, 1);
                 if(!column){
                     pIShellDetails->Release();
                     return NULL;
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, 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
@@ -57,68 +57,3 @@
 }
 
 } /* extern "C" */
-
-/************************************************************************
- * WColor native methods
- */
-
-extern "C" {
-
-/*
- * Class:     sun_awt_windows_WColor
- * Method:    getDefaultColor
- * Signature: (I)Ljava/awt/Color;
- */
-JNIEXPORT jobject JNICALL
-Java_sun_awt_windows_WColor_getDefaultColor(JNIEnv *env, jclass cls,
-                                            jint index)
-{
-    TRY;
-
-    int iColor = 0;
-    switch(index) {
-
-    case sun_awt_windows_WColor_WINDOW_BKGND:
-        iColor = COLOR_WINDOW;
-        break;
-    case sun_awt_windows_WColor_WINDOW_TEXT:
-        iColor = COLOR_WINDOWTEXT;
-        break;
-    case sun_awt_windows_WColor_FRAME:
-        iColor = COLOR_WINDOWFRAME;
-        break;
-    case sun_awt_windows_WColor_SCROLLBAR:
-        iColor = COLOR_SCROLLBAR;
-        break;
-    case sun_awt_windows_WColor_MENU_BKGND:
-        iColor = COLOR_MENU;
-        break;
-    case sun_awt_windows_WColor_MENU_TEXT:
-        iColor = COLOR_MENUTEXT;
-        break;
-    case sun_awt_windows_WColor_BUTTON_BKGND:
-        iColor = COLOR_BTNFACE;
-        break;
-    case sun_awt_windows_WColor_BUTTON_TEXT:
-        iColor = COLOR_BTNTEXT;
-        break;
-    case sun_awt_windows_WColor_HIGHLIGHT:
-        iColor = COLOR_HIGHLIGHT;
-        break;
-
-    default:
-        return NULL;
-    }
-    DWORD c = ::GetSysColor(iColor);
-
-    jobject wColor = JNU_NewObjectByName(env, "java/awt/Color", "(III)V",
-                                         GetRValue(c), GetGValue(c),
-                                         GetBValue(c));
-
-    DASSERT(!safe_ExceptionOccurred(env));
-    return wColor;
-
-    CATCH_BAD_ALLOC_RET(NULL);
-}
-
-} /* extern "C" */
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.h	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Color.h	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 #ifndef AWT_COLOR_H
 #define AWT_COLOR_H
 
-#include "sun_awt_windows_WColor.h"
 #include "stdhdrs.h"
 
 class AwtColor {
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -3871,12 +3871,14 @@
 {
     if (!m_useNativeCompWindow) {
         if (subMsg == IMN_OPENCANDIDATE) {
-            m_bitsCandType = subMsg;
+            m_bitsCandType = bitsCandType;
             InquireCandidatePosition();
         } else if (subMsg == IMN_OPENSTATUSWINDOW ||
                    subMsg == WM_IME_STARTCOMPOSITION) {
             m_bitsCandType = 0;
             InquireCandidatePosition();
+        } else if (subMsg == IMN_SETCANDIDATEPOS) {
+            InquireCandidatePosition();
         }
         return mrConsume;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Charset_Util.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+#include "PLATFORM_API_WinOS_Charset_Util.h"
+
+#include <cstring>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+LPSTR UnicodeToUTF8(const LPCWSTR lpUnicodeStr)
+{
+    DWORD dwUTF8Len = WideCharToMultiByte(CP_UTF8, 0, lpUnicodeStr, -1, nullptr, 0, nullptr, nullptr);
+    LPSTR lpUTF8Str = new CHAR[dwUTF8Len];
+    memset(lpUTF8Str, 0, sizeof(CHAR) * (dwUTF8Len));
+    WideCharToMultiByte(CP_UTF8, 0, lpUnicodeStr, -1, lpUTF8Str, dwUTF8Len, nullptr, nullptr);
+    return lpUTF8Str;
+}
+
+void UnicodeToUTF8AndCopy(LPSTR dest, LPCWSTR src, SIZE_T maxLength) {
+    LPSTR utf8EncodedName = UnicodeToUTF8(src);
+    strncpy(dest, utf8EncodedName, maxLength - 1);
+    delete[] utf8EncodedName;
+    dest[maxLength - 1] = '\0';
+}
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Charset_Util.h	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef PLATFORM_API_WINOS_CHARSET_UTILS_H
+#define PLATFORM_API_WINOS_CHARSET_UTILS_H
+
+#include <windows.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// NOTE: It's a caller responbility to free the allocated memory using delete[], just like in UnicodeToUTF8AndCopy function
+LPSTR _cdecl UnicodeToUTF8(const LPCWSTR lpAnsiStr);
+
+void _cdecl UnicodeToUTF8AndCopy(LPSTR dest, LPCWSTR src, SIZE_T maxLength);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -52,6 +52,9 @@
 }
 #endif
 
+/* include to prevent charset problem */
+#include "PLATFORM_API_WinOS_Charset_Util.h"
+
 #ifdef USE_DEBUG_SILENCING
 #define DEBUG_SILENCING0(p) TRACE0(p)
 #define DEBUG_SILENCING1(p1,p2) TRACE1(p1,p2)
@@ -227,13 +230,13 @@
 }
 
 BOOL CALLBACK DS_GetDescEnum(LPGUID lpGuid,
-                             LPCSTR lpstrDescription,
-                             LPCSTR lpstrModule,
+                             LPCWSTR lpstrDescription,
+                             LPCWSTR lpstrModule,
                              DirectAudioDeviceDescription* desc) {
 
     INT32 cacheIndex = findCacheItemByGUID(lpGuid, g_audioDeviceCache[desc->deviceID].isSource);
     if (cacheIndex == desc->deviceID) {
-        strncpy(desc->name, lpstrDescription, DAUDIO_STRING_LENGTH);
+        UnicodeToUTF8AndCopy(desc->name, lpstrDescription, DAUDIO_STRING_LENGTH);
         //strncpy(desc->description, lpstrModule, DAUDIO_STRING_LENGTH);
         desc->maxSimulLines = -1;
         /* do not continue enumeration */
@@ -257,10 +260,10 @@
     }
     desc->maxSimulLines = 0;
     if (g_audioDeviceCache[desc->deviceID].isSource) {
-        DirectSoundEnumerate((LPDSENUMCALLBACK) DS_GetDescEnum, desc);
+        DirectSoundEnumerateW((LPDSENUMCALLBACKW) DS_GetDescEnum, desc);
         strncpy(desc->description, "DirectSound Playback", DAUDIO_STRING_LENGTH);
     } else {
-        DirectSoundCaptureEnumerate((LPDSENUMCALLBACK) DS_GetDescEnum, desc);
+        DirectSoundCaptureEnumerateW((LPDSENUMCALLBACKW) DS_GetDescEnum, desc);
         strncpy(desc->description, "DirectSound Capture", DAUDIO_STRING_LENGTH);
     }
 
--- a/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp	Sat Sep 09 14:36:45 2017 +0200
@@ -31,6 +31,9 @@
 #include "PLATFORM_API_WinOS_Util.h"
 }
 
+/* include to prevent charset problem */
+#include "PLATFORM_API_WinOS_Charset_Util.h"
+
 #if USE_PLATFORM_MIDI_IN == TRUE
 
 #ifdef USE_ERROR
@@ -248,18 +251,17 @@
     return (INT32) midiInGetNumDevs();
 }
 
-INT32 getMidiInCaps(INT32 deviceID, MIDIINCAPS* caps, INT32* err) {
-    (*err) = midiInGetDevCaps(deviceID, caps, sizeof(MIDIINCAPS));
+INT32 getMidiInCaps(INT32 deviceID, MIDIINCAPSW* caps, INT32* err) {
+    (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPS));
     return ((*err) == MMSYSERR_NOERROR);
 }
 
 INT32 MIDI_IN_GetDeviceName(INT32 deviceID, char *name, UINT32 nameLength) {
-    MIDIINCAPS midiInCaps;
+    MIDIINCAPSW midiInCaps;
     INT32 err;
 
     if (getMidiInCaps(deviceID, &midiInCaps, &err)) {
-        strncpy(name, midiInCaps.szPname, nameLength-1);
-        name[nameLength-1] = 0;
+        UnicodeToUTF8AndCopy(name, midiInCaps.szPname, nameLength);
         return MIDI_SUCCESS;
     }
     MIDIIN_CHECK_ERROR;
@@ -279,7 +281,7 @@
 
 
 INT32 MIDI_IN_GetDeviceVersion(INT32 deviceID, char *name, UINT32 nameLength) {
-    MIDIINCAPS midiInCaps;
+    MIDIINCAPSW midiInCaps;
     INT32 err = MIDI_NOT_SUPPORTED;
 
     if (getMidiInCaps(deviceID, &midiInCaps, &err) && (nameLength>7)) {
--- a/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c	Sat Sep 09 14:36:45 2017 +0200
@@ -28,6 +28,9 @@
 
 #include "PLATFORM_API_WinOS_Util.h"
 
+/* include to prevent charset problem */
+#include "PLATFORM_API_WinOS_Charset_Util.h"
+
 #if USE_PLATFORM_MIDI_OUT == TRUE
 
 
@@ -66,24 +69,23 @@
 }
 
 
-INT32 getMidiOutCaps(INT32 deviceID, MIDIOUTCAPS* caps, INT32* err) {
+INT32 getMidiOutCaps(INT32 deviceID, MIDIOUTCAPSW* caps, INT32* err) {
     if (deviceID == 0) {
         deviceID = MIDI_MAPPER;
     } else {
         deviceID--;
     }
-    (*err) = (INT32) midiOutGetDevCaps(deviceID, caps, sizeof(MIDIOUTCAPS));
+    (*err) = (INT32) midiOutGetDevCapsW(deviceID, caps, sizeof(MIDIOUTCAPS));
     return ((*err) == MMSYSERR_NOERROR);
 }
 
 
 INT32 MIDI_OUT_GetDeviceName(INT32 deviceID, char *name, UINT32 nameLength) {
-    MIDIOUTCAPS midiOutCaps;
+    MIDIOUTCAPSW midiOutCaps;
     INT32 err;
 
     if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
-        strncpy(name, midiOutCaps.szPname, nameLength-1);
-        name[nameLength-1] = 0;
+        UnicodeToUTF8AndCopy(name, midiOutCaps.szPname, nameLength);
         return MIDI_SUCCESS;
     }
     MIDIOUT_CHECK_ERROR;
@@ -97,7 +99,7 @@
 
 
 INT32 MIDI_OUT_GetDeviceDescription(INT32 deviceID, char *name, UINT32 nameLength) {
-    MIDIOUTCAPS midiOutCaps;
+    MIDIOUTCAPSW midiOutCaps;
     char *desc;
     INT32 err;
 
@@ -134,7 +136,7 @@
 
 
 INT32 MIDI_OUT_GetDeviceVersion(INT32 deviceID, char *name, UINT32 nameLength) {
-    MIDIOUTCAPS midiOutCaps;
+    MIDIOUTCAPSW midiOutCaps;
     INT32 err;
 
     if (getMidiOutCaps(deviceID, &midiOutCaps, &err) && nameLength>7) {
--- a/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c	Sat Sep 09 14:36:45 2017 +0200
@@ -38,6 +38,9 @@
 #include <mmsystem.h>
 #include "Ports.h"
 
+/* include to prevent charset problem */
+#include "PLATFORM_API_WinOS_Charset_Util.h"
+
 #if USE_PORTS == TRUE
 
 typedef struct tag_PortControlID PortControlID;
@@ -353,10 +356,9 @@
 ///// implemented functions of Ports.h
 
 INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description) {
-    MIXERCAPS mixerCaps;
-    if (mixerGetDevCaps(mixerIndex, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
-        strncpy(description->name, mixerCaps.szPname, PORT_STRING_LENGTH-1);
-        description->name[PORT_STRING_LENGTH-1] = 0;
+    MIXERCAPSW mixerCaps;
+    if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
+        UnicodeToUTF8AndCopy(description->name, mixerCaps.szPname, PORT_STRING_LENGTH);
         sprintf(description->version, "%d.%d", (mixerCaps.vDriverVersion & 0xFF00) >> 8, mixerCaps.vDriverVersion & 0xFF);
         strncpy(description->description, "Port Mixer", PORT_STRING_LENGTH-1);
         return TRUE;
--- a/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/GB18030.java.template	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/jdk.charsets/share/classes/sun/nio/cs/ext/GB18030.java.template	Sat Sep 09 14:36:45 2017 +0200
@@ -60,11 +60,12 @@
                 || (cs.name().equals("ISO-8859-8"))
                 || (cs.name().equals("ISO-8859-9"))
                 || (cs.name().equals("ISO-8859-13"))
+                || (cs.name().equals("ISO-8859-15"))
+                || (cs.name().equals("ISO-8859-16"))
                 || (cs.name().equals("UTF-8"))
                 || (cs.name().equals("UTF-16"))
                 || (cs.name().equals("UTF-16LE"))
                 || (cs.name().equals("UTF-16BE"))
-                || (cs.name().equals("ISO-8859-15"))
                 || (cs.name().equals("windows-1251"))
                 || (cs.name().equals("windows-1252"))
                 || (cs.name().equals("windows-1253"))
--- a/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -28,6 +28,7 @@
 import java.io.*;
 import static java.io.StreamTokenizer.*;
 import java.math.BigInteger;
+import java.nio.charset.StandardCharsets;
 import java.util.*;
 
 import java.security.*;
@@ -202,7 +203,8 @@
             reader = new StringReader(config);
         } else {
             reader = new BufferedReader(new InputStreamReader
-                (new FileInputStream(expand(filename))));
+                (new FileInputStream(expand(filename)),
+                    StandardCharsets.ISO_8859_1));
         }
         parsedKeywords = new HashSet<String>();
         st = new StreamTokenizer(reader);
--- a/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ConnectionPool.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ConnectionPool.java	Sat Sep 09 14:36:45 2017 +0200
@@ -25,11 +25,14 @@
 
 package jdk.incubator.http;
 
+import java.lang.ref.WeakReference;
 import java.net.InetSocketAddress;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.ListIterator;
 import java.util.Objects;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
 import jdk.incubator.http.internal.common.Utils;
 
 /**
@@ -37,6 +40,21 @@
  */
 final class ConnectionPool {
 
+    // These counters are used to distribute ids for debugging
+    // The ACTIVE_CLEANER_COUNTER will tell how many CacheCleaner
+    // are active at a given time. It will increase when a new
+    // CacheCleaner is started and decrease when it exits.
+    static final AtomicLong ACTIVE_CLEANER_COUNTER = new AtomicLong();
+    // The POOL_IDS_COUNTER increases each time a new ConnectionPool
+    // is created. It may wrap and become negative but will never be
+    // decremented.
+    static final AtomicLong POOL_IDS_COUNTER = new AtomicLong();
+    // The cleanerCounter is used to name cleaner threads within a
+    // a connection pool, and increments monotically.
+    // It may wrap and become negative but will never be
+    // decremented.
+    final AtomicLong cleanerCounter = new AtomicLong();
+
     static final long KEEP_ALIVE = Utils.getIntegerNetProperty(
             "jdk.httpclient.keepalive.timeout", 1200); // seconds
 
@@ -44,7 +62,12 @@
 
     final HashMap<CacheKey,LinkedList<HttpConnection>> plainPool;
     final HashMap<CacheKey,LinkedList<HttpConnection>> sslPool;
-    CacheCleaner cleaner;
+    // A monotically increasing id for this connection pool.
+    // It may be negative (that's OK)
+    // Mostly used for debugging purposes when looking at thread dumps.
+    // Global scope.
+    final long poolID = POOL_IDS_COUNTER.incrementAndGet();
+    final AtomicReference<CacheCleaner> cleanerRef;
 
     /**
      * Entries in connection pool are keyed by destination address and/or
@@ -105,6 +128,7 @@
         plainPool = new HashMap<>();
         sslPool = new HashMap<>();
         expiryList = new LinkedList<>();
+        cleanerRef = new AtomicReference<>();
     }
 
     void start() {
@@ -143,7 +167,7 @@
     findConnection(CacheKey key,
                    HashMap<CacheKey,LinkedList<HttpConnection>> pool) {
         LinkedList<HttpConnection> l = pool.get(key);
-        if (l == null || l.size() == 0) {
+        if (l == null || l.isEmpty()) {
             return null;
         } else {
             HttpConnection c = l.removeFirst();
@@ -175,19 +199,36 @@
         l.add(c);
     }
 
-    // only runs while entries exist in cache
+    static String makeCleanerName(long poolId, long cleanerId) {
+        return "HTTP-Cache-cleaner-" + poolId + "-" + cleanerId;
+    }
 
-    final class CacheCleaner extends Thread {
+    // only runs while entries exist in cache
+    final static class CacheCleaner extends Thread {
 
         volatile boolean stopping;
+        // A monotically increasing id. May wrap and become negative (that's OK)
+        // Mostly used for debugging purposes when looking at thread dumps.
+        // Scoped per connection pool.
+        final long cleanerID;
+        // A reference to the owning ConnectionPool.
+        // This reference's referent may become null if the HttpClientImpl
+        // that owns this pool is GC'ed.
+        final WeakReference<ConnectionPool> ownerRef;
 
-        CacheCleaner() {
-            super(null, null, "HTTP-Cache-cleaner", 0, false);
+        CacheCleaner(ConnectionPool owner) {
+            this(owner, owner.cleanerCounter.incrementAndGet());
+        }
+
+        CacheCleaner(ConnectionPool owner, long cleanerID) {
+            super(null, null, makeCleanerName(owner.poolID, cleanerID), 0, false);
+            this.cleanerID = cleanerID;
+            this.ownerRef = new WeakReference<>(owner);
             setDaemon(true);
         }
 
         synchronized boolean stopping() {
-            return stopping;
+            return stopping || ownerRef.get() == null;
         }
 
         synchronized void stopCleaner() {
@@ -196,11 +237,19 @@
 
         @Override
         public void run() {
-            while (!stopping()) {
-                try {
-                    Thread.sleep(3000);
-                } catch (InterruptedException e) {}
-                cleanCache();
+            ACTIVE_CLEANER_COUNTER.incrementAndGet();
+            try {
+                while (!stopping()) {
+                    try {
+                        Thread.sleep(3000);
+                    } catch (InterruptedException e) {}
+                    ConnectionPool owner = ownerRef.get();
+                    if (owner == null) return;
+                    owner.cleanCache(this);
+                    owner = null;
+                }
+            } finally {
+                ACTIVE_CLEANER_COUNTER.decrementAndGet();
             }
         }
     }
@@ -217,13 +266,15 @@
                 return;
             }
         }
-        if (expiryList.isEmpty()) {
+        CacheCleaner cleaner = this.cleanerRef.get();
+        if (expiryList.isEmpty() && cleaner != null) {
+            this.cleanerRef.compareAndSet(cleaner, null);
             cleaner.stopCleaner();
-            cleaner = null;
+            cleaner.interrupt();
         }
     }
 
-    private void cleanCache() {
+    private void cleanCache(CacheCleaner cleaner) {
         long now = System.currentTimeMillis() / 1000;
         LinkedList<HttpConnection> closelist = new LinkedList<>();
 
@@ -242,6 +293,10 @@
                     }
                 }
             }
+            if (expiryList.isEmpty() && cleaner != null) {
+                this.cleanerRef.compareAndSet(cleaner, null);
+                cleaner.stopCleaner();
+            }
         }
         for (HttpConnection c : closelist) {
             //System.out.println ("KAC: closing " + c);
@@ -252,10 +307,13 @@
     private synchronized void addToExpiryList(HttpConnection conn) {
         long now = System.currentTimeMillis() / 1000;
         long then = now + KEEP_ALIVE;
-
         if (expiryList.isEmpty()) {
-            cleaner = new CacheCleaner();
-            cleaner.start();
+            CacheCleaner cleaner = new CacheCleaner(this);
+            if (this.cleanerRef.compareAndSet(null, cleaner)) {
+                cleaner.start();
+            }
+            expiryList.add(new ExpiryEntry(conn, then));
+            return;
         }
 
         ListIterator<ExpiryEntry> li = expiryList.listIterator();
--- a/jdk/src/jdk.jdwp.agent/share/native/include/jdwpTransport.h	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/jdk.jdwp.agent/share/native/include/jdwpTransport.h	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -33,7 +33,8 @@
 #include "jni.h"
 
 enum {
-    JDWPTRANSPORT_VERSION_1_0 = 0x00010000
+    JDWPTRANSPORT_VERSION_1_0 = 0x00010000,
+    JDWPTRANSPORT_VERSION_1_1 = 0x00010001
 };
 
 #ifdef __cplusplus
@@ -142,6 +143,13 @@
                                                jint version,
                                                jdwpTransportEnv** env);
 
+/*
+ * JDWP transport configuration from the agent.
+ */
+typedef struct jdwpTransportConfiguration {
+    /* Field added in JDWPTRANSPORT_VERSION_1_1: */
+    const char* allowed_peers;       /* Peers allowed for connection */
+} jdwpTransportConfiguration;
 
 
 /* Function Interface */
@@ -191,6 +199,9 @@
     jdwpTransportError (JNICALL *GetLastError)(jdwpTransportEnv* env,
         char** error);
 
+    /*  12: SetTransportConfiguration added in JDWPTRANSPORT_VERSION_1_1 */
+    jdwpTransportError (JNICALL *SetTransportConfiguration)(jdwpTransportEnv* env,
+        jdwpTransportConfiguration *config);
 };
 
 
@@ -248,6 +259,10 @@
         return functions->GetLastError(this, error);
     }
 
+    /*  SetTransportConfiguration added in JDWPTRANSPORT_VERSION_1_1 */
+    jdwpTransportError SetTransportConfiguration(jdwpTransportEnv* env,
+        return functions->SetTransportConfiguration(this, config);
+    }
 
 #endif /* __cplusplus */
 };
--- a/jdk/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c	Sat Sep 09 14:36:45 2017 +0200
@@ -34,6 +34,9 @@
 #ifdef _WIN32
  #include <winsock2.h>
  #include <ws2tcpip.h>
+#else
+ #include <arpa/inet.h>
+ #include <sys/socket.h>
 #endif
 
 /*
@@ -73,6 +76,19 @@
 static jint recv_fully(int, char *, int);
 static jint send_fully(int, char *, int);
 
+/* version >= JDWPTRANSPORT_VERSION_1_1 */
+typedef struct {
+    uint32_t subnet;
+    uint32_t netmask;
+} AllowedPeerInfo;
+
+#define STR(x) #x
+#define MAX_PEER_ENTRIES 32
+#define MAX_PEERS_STR STR(MAX_PEER_ENTRIES)
+static AllowedPeerInfo _peers[MAX_PEER_ENTRIES];
+static int _peers_cnt = 0;
+
+
 /*
  * Record the last error for this thread.
  */
@@ -260,7 +276,7 @@
     char *colon;
     int port;
 
-    memset((void *)sa,0,sizeof(struct sockaddr_in));
+    memset((void *)sa, 0, sizeof(struct sockaddr_in));
     sa->sin_family = AF_INET;
 
     /* check for host:port or port */
@@ -274,7 +290,7 @@
     if (colon == NULL) {
         // bind to localhost only if no address specified
         sa->sin_addr.s_addr = getLocalHostAddress();
-    } else if (strncmp(address,"localhost:",10) == 0) {
+    } else if (strncmp(address, "localhost:", 10) == 0) {
         // optimize for common case
         sa->sin_addr.s_addr = getLocalHostAddress();
     } else if (*address == '*' && *(address+1) == ':') {
@@ -286,7 +302,7 @@
         char *hostname;
         uint32_t addr;
 
-        buf = (*callback->alloc)((int)strlen(address)+1);
+        buf = (*callback->alloc)((int)strlen(address) + 1);
         if (buf == NULL) {
             RETURN_ERROR(JDWPTRANSPORT_ERROR_OUT_OF_MEMORY, "out of memory");
         }
@@ -320,6 +336,131 @@
     return JDWPTRANSPORT_ERROR_NONE;
 }
 
+static const char *
+ip_s2u(const char *instr, uint32_t *ip) {
+    // Convert string representation of ip to integer
+    // in network byte order (big-endian)
+    char t[4] = { 0, 0, 0, 0 };
+    const char *s = instr;
+    int i = 0;
+
+    while (1) {
+        if (*s == '.') {
+            ++i;
+            ++s;
+            continue;
+        }
+        if (*s == 0 || *s == '+' || *s == '/') {
+            break;
+        }
+        if (*s < '0' || *s > '9') {
+            return instr;
+        }
+        t[i] = (t[i] * 10) + (*s - '0');
+        ++s;
+    }
+
+    *ip = *(uint32_t*)(t);
+    return s;
+}
+
+static const char *
+mask_s2u(const char *instr, uint32_t *mask) {
+    // Convert the number of bits to a netmask
+    // in network byte order (big-endian)
+    unsigned char m = 0;
+    const char *s = instr;
+
+    while (1) {
+        if (*s == 0 || *s == '+') {
+            break;
+        }
+        if (*s < '0' || *s > '9') {
+            return instr;
+        }
+        m = (m * 10) + (*s - '0');
+        ++s;
+    }
+
+    if (m == 0 || m > 32) {
+       // Drop invalid input
+       return instr;
+    }
+
+    *mask = htonl(-1 << (32 - m));
+    return s;
+}
+
+static int
+ip_in_subnet(uint32_t subnet, uint32_t mask, uint32_t ipaddr) {
+    return (ipaddr & mask) == subnet;
+}
+
+static jdwpTransportError
+parseAllowedPeers(const char *allowed_peers) {
+    // Build a list of allowed peers from char string
+    // of format 192.168.0.10+192.168.0.0/24
+    const char *s = NULL;
+    const char *p = allowed_peers;
+    uint32_t   ip = 0;
+    uint32_t mask = 0xFFFFFFFF;
+
+    while (1) {
+        s = ip_s2u(p, &ip);
+        if (s == p) {
+            _peers_cnt = 0;
+            fprintf(stderr, "Error in allow option: '%s'\n", s);
+            RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT,
+                         "invalid IP address in allow option");
+        }
+
+        if (*s == '/') {
+            // netmask specified
+            s = mask_s2u(s + 1, &mask);
+            if (*(s - 1) == '/') {
+                // Input is not consumed, something bad happened
+                _peers_cnt = 0;
+                fprintf(stderr, "Error in allow option: '%s'\n", s);
+                RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT,
+                             "invalid netmask in allow option");
+            }
+        } else {
+            // reset netmask
+            mask = 0xFFFFFFFF;
+        }
+
+        if (*s == '+' || *s == 0) {
+            if (_peers_cnt >= MAX_PEER_ENTRIES) {
+                fprintf(stderr, "Error in allow option: '%s'\n", allowed_peers);
+                RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT,
+                             "exceeded max number of allowed peers: " MAX_PEERS_STR);
+            }
+            _peers[_peers_cnt].subnet = ip;
+            _peers[_peers_cnt].netmask = mask;
+            _peers_cnt++;
+            if (*s == 0) {
+                // end of options
+                break;
+            }
+            // advance to next IP block
+            p = s + 1;
+        }
+    }
+    return JDWPTRANSPORT_ERROR_NONE;
+}
+
+static int
+isPeerAllowed(struct sockaddr_in *peer) {
+    int i;
+    for (i = 0; i < _peers_cnt; ++i) {
+        int peer_ip = peer->sin_addr.s_addr;
+        if (ip_in_subnet(_peers[i].subnet, _peers[i].netmask, peer_ip)) {
+            return 1;
+        }
+    }
+
+    return 0;
+}
 
 static jdwpTransportError JNICALL
 socketTransport_getCapabilities(jdwpTransportEnv* env,
@@ -412,7 +553,7 @@
 socketTransport_accept(jdwpTransportEnv* env, jlong acceptTimeout, jlong handshakeTimeout)
 {
     socklen_t socketLen;
-    int err;
+    int err = JDWPTRANSPORT_ERROR_NONE;
     struct sockaddr_in socket;
     jlong startTime = (jlong)0;
 
@@ -474,14 +615,34 @@
             return JDWPTRANSPORT_ERROR_IO_ERROR;
         }
 
-        /* handshake with the debugger */
-        err = handshake(socketFD, handshakeTimeout);
+        /*
+         * version >= JDWPTRANSPORT_VERSION_1_1:
+         * Verify that peer is allowed to connect.
+         */
+        if (_peers_cnt > 0) {
+            if (!isPeerAllowed(&socket)) {
+                char ebuf[64] = { 0 };
+                char buf[INET_ADDRSTRLEN] = { 0 };
+                const char* addr_str = inet_ntop(AF_INET, &(socket.sin_addr), buf, INET_ADDRSTRLEN);
+                sprintf(ebuf, "ERROR: Peer not allowed to connect: %s\n",
+                        (addr_str == NULL) ? "<bad address>" : addr_str);
+                dbgsysSocketClose(socketFD);
+                socketFD = -1;
+                err = JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT;
+                setLastError(err, ebuf);
+            }
+        }
+
+        if (socketFD > 0) {
+          /* handshake with the debugger */
+          err = handshake(socketFD, handshakeTimeout);
+        }
 
         /*
          * If the handshake fails then close the connection. If there if an accept
          * timeout then we must adjust the timeout for the next poll.
          */
-        if (err) {
+        if (err != JDWPTRANSPORT_ERROR_NONE) {
             fprintf(stderr, "Debugger failed to attach: %s\n", getLastError());
             dbgsysSocketClose(socketFD);
             socketFD = -1;
@@ -743,20 +904,20 @@
     packet->type.cmd.len = length;
 
 
-    n = recv_fully(socketFD,(char *)&(packet->type.cmd.id),sizeof(jint));
+    n = recv_fully(socketFD,(char *)&(packet->type.cmd.id), sizeof(jint));
     if (n < (int)sizeof(jint)) {
         RETURN_RECV_ERROR(n);
     }
 
     packet->type.cmd.id = (jint)dbgsysNetworkToHostLong(packet->type.cmd.id);
 
-    n = recv_fully(socketFD,(char *)&(packet->type.cmd.flags),sizeof(jbyte));
+    n = recv_fully(socketFD,(char *)&(packet->type.cmd.flags), sizeof(jbyte));
     if (n < (int)sizeof(jbyte)) {
         RETURN_RECV_ERROR(n);
     }
 
     if (packet->type.cmd.flags & JDWPTRANSPORT_FLAGS_REPLY) {
-        n = recv_fully(socketFD,(char *)&(packet->type.reply.errorCode),sizeof(jbyte));
+        n = recv_fully(socketFD,(char *)&(packet->type.reply.errorCode), sizeof(jbyte));
         if (n < (int)sizeof(jshort)) {
             RETURN_RECV_ERROR(n);
         }
@@ -765,12 +926,12 @@
 
 
     } else {
-        n = recv_fully(socketFD,(char *)&(packet->type.cmd.cmdSet),sizeof(jbyte));
+        n = recv_fully(socketFD,(char *)&(packet->type.cmd.cmdSet), sizeof(jbyte));
         if (n < (int)sizeof(jbyte)) {
             RETURN_RECV_ERROR(n);
         }
 
-        n = recv_fully(socketFD,(char *)&(packet->type.cmd.cmd),sizeof(jbyte));
+        n = recv_fully(socketFD,(char *)&(packet->type.cmd.cmd), sizeof(jbyte));
         if (n < (int)sizeof(jbyte)) {
             RETURN_RECV_ERROR(n);
         }
@@ -814,11 +975,44 @@
     return JDWPTRANSPORT_ERROR_NONE;
 }
 
+static jdwpTransportError JNICALL
+socketTransport_setConfiguration(jdwpTransportEnv* env, jdwpTransportConfiguration* cfg) {
+    const char* allowed_peers = NULL;
+
+    if (cfg == NULL) {
+        RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT,
+                     "NULL pointer to transport configuration is invalid");
+    }
+    allowed_peers = cfg->allowed_peers;
+    _peers_cnt = 0;
+    if (allowed_peers != NULL) {
+        size_t len = strlen(allowed_peers);
+        if (len == 0) { /* Impossible: parseOptions() would reject it */
+            fprintf(stderr, "Error in allow option: '%s'\n", allowed_peers);
+            RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT,
+                         "allow option should not be empty");
+        } else if (*allowed_peers == '*') {
+            if (len != 1) {
+                fprintf(stderr, "Error in allow option: '%s'\n", allowed_peers);
+                RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT,
+                             "allow option '*' cannot be expanded");
+            }
+        } else {
+            int err = parseAllowedPeers(allowed_peers);
+            if (err != JDWPTRANSPORT_ERROR_NONE) {
+                return err;
+            }
+        }
+    }
+    return JDWPTRANSPORT_ERROR_NONE;
+}
+
 jint JNICALL
 jdwpTransport_OnLoad(JavaVM *vm, jdwpTransportCallback* cbTablePtr,
-                     jint version, jdwpTransportEnv** result)
+                     jint version, jdwpTransportEnv** env)
 {
-    if (version != JDWPTRANSPORT_VERSION_1_0) {
+    if (version < JDWPTRANSPORT_VERSION_1_0 ||
+        version > JDWPTRANSPORT_VERSION_1_1) {
         return JNI_EVERSION;
     }
     if (initialized) {
@@ -842,7 +1036,10 @@
     interface.ReadPacket = &socketTransport_readPacket;
     interface.WritePacket = &socketTransport_writePacket;
     interface.GetLastError = &socketTransport_getLastError;
-    *result = &single_env;
+    if (version >= JDWPTRANSPORT_VERSION_1_1) {
+        interface.SetTransportConfiguration = &socketTransport_setConfiguration;
+    }
+    *env = &single_env;
 
     /* initialized TLS */
     tlsIndex = dbgsysTlsAlloc();
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -89,6 +89,7 @@
     char *name;
     char *address;
     long timeout;
+    char *allow;
 } TransportSpec;
 
 /*
@@ -564,7 +565,8 @@
 
     LOG_MISC(("Begin startTransport"));
     serror = transport_startTransport(enumArg->isServer, transport->name,
-                                     transport->address, transport->timeout);
+                                      transport->address, transport->timeout,
+                                      transport->allow);
     if (serror != JDWP_ERROR(NONE)) {
         ERROR_MESSAGE(("JDWP Transport %s failed to initialize, %s(%d)",
                 transport->name, jdwpErrorText(serror), serror));
@@ -1060,7 +1062,6 @@
         if (transports == NULL) {
             EXIT_ERROR(AGENT_ERROR_OUT_OF_MEMORY,"transports");
         }
-
     }
 
     current = names;
@@ -1080,6 +1081,9 @@
                 goto syntax_error;
             }
             currentTransport->name = current;
+            currentTransport->address = NULL;
+            currentTransport->allow = NULL;
+            currentTransport->timeout = 0L;
             current += strlen(current) + 1;
         } else if (strcmp(buf, "address") == 0) {
             if (currentTransport == NULL) {
@@ -1092,7 +1096,18 @@
             }
             currentTransport->address = current;
             current += strlen(current) + 1;
-        } else if (strcmp(buf, "timeout") == 0) {
+        } else if (strcmp(buf, "allow") == 0) {
+            if (currentTransport == NULL) {
+                errmsg = "allow specified without transport";
+                goto bad_option_with_errmsg;
+            }
+            /*LINTED*/
+            if (!get_tok(&str, current, (int)(end - current), ',')) {
+                goto syntax_error;
+            }
+            currentTransport->allow = current;
+            current += strlen(current) + 1;
+         } else if (strcmp(buf, "timeout") == 0) {
             if (currentTransport == NULL) {
                 errmsg = "timeout specified without transport";
                 goto bad_option_with_errmsg;
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/transport.c	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/transport.c	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -29,7 +29,9 @@
 #include "debugLoop.h"
 #include "sys.h"
 
-static jdwpTransportEnv *transport;
+static jdwpTransportEnv *transport = NULL;
+static unsigned transportVersion = JDWPTRANSPORT_VERSION_1_0;
+
 static jrawMonitorID listenerLock;
 static jrawMonitorID sendLock;
 
@@ -41,6 +43,8 @@
     jdwpTransportEnv *transport;
     char *address;
     long timeout;
+    char *allowed_peers;
+    unsigned transportVersion;
 } TransportInfo;
 
 static struct jdwpTransportCallback callback = {jvmtiAllocate, jvmtiDeallocate};
@@ -135,7 +139,7 @@
  * JDK 1.2 javai.c v1.61
  */
 static jdwpError
-loadTransport(const char *name, jdwpTransportEnv **transportPtr)
+loadTransport(const char *name, TransportInfo *info)
 {
     JNIEnv                 *env;
     jdwpTransport_OnLoad_t  onLoad;
@@ -147,6 +151,10 @@
         ERROR_MESSAGE(("library name is empty"));
         return JDWP_ERROR(TRANSPORT_LOAD);
     }
+    if (info == NULL) {
+        ERROR_MESSAGE(("internal error: info should not be NULL"));
+        return JDWP_ERROR(TRANSPORT_LOAD);
+    }
 
     /* First, look in sun.boot.library.path. This should find the standard
      *  dt_socket and dt_shmem transport libraries, or any library
@@ -192,22 +200,34 @@
 
     /* Get transport interface */
     env = getEnv();
-    if ( env != NULL ) {
-        jdwpTransportEnv *t;
-        JavaVM           *jvm;
-        jint              ver;
+    if (env != NULL) {
+        jdwpTransportEnv *t = NULL;
+        JavaVM           *jvm = NULL;
+        jint              rc;
+        size_t            i;
+        /* If a new version is added here, update 'case JNI_EVERSION' below. */
+        jint supported_versions[2] = {JDWPTRANSPORT_VERSION_1_1, JDWPTRANSPORT_VERSION_1_0};
 
         JNI_FUNC_PTR(env,GetJavaVM)(env, &jvm);
-        ver = (*onLoad)(jvm, &callback, JDWPTRANSPORT_VERSION_1_0, &t);
-        if (ver != JNI_OK) {
-            switch (ver) {
+
+        /* Try version 1.1 first, fallback to 1.0 on error */
+        for (i = 0; i < sizeof(supported_versions); ++i) {
+            rc = (*onLoad)(jvm, &callback, supported_versions[i], &t);
+            if (rc != JNI_EVERSION) {
+                info->transportVersion = supported_versions[i];
+                break;
+            }
+        }
+
+        if (rc != JNI_OK) {
+            switch (rc) {
                 case JNI_ENOMEM :
                     ERROR_MESSAGE(("insufficient memory to complete initialization"));
                     break;
 
                 case JNI_EVERSION :
-                    ERROR_MESSAGE(("transport doesn't recognize version %x",
-                        JDWPTRANSPORT_VERSION_1_0));
+                    ERROR_MESSAGE(("transport doesn't recognize all supported versions: "
+                                   "{ 1_1, 1_0 }"));
                     break;
 
                 case JNI_EEXIST :
@@ -215,13 +235,19 @@
                     break;
 
                 default:
-                    ERROR_MESSAGE(("unrecognized error %d from transport", ver));
+                    ERROR_MESSAGE(("unrecognized error %d from transport", rc));
                     break;
             }
 
             return JDWP_ERROR(TRANSPORT_INIT);
         }
-        *transportPtr = t;
+
+        /* Store transport version to global variable to be able to
+         * set correct transport version for subsequent connect,
+         * even if info is already deallocated.
+         */
+        transportVersion = info->transportVersion;
+        info->transport = t;
     } else {
         return JDWP_ERROR(TRANSPORT_LOAD);
     }
@@ -314,7 +340,6 @@
 
     info = (TransportInfo*)(void*)arg;
     t = info->transport;
-
     rc = (*t)->Accept(t, info->timeout, 0);
 
     /* System property no longer needed */
@@ -339,8 +364,10 @@
 static void JNICALL
 attachThread(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg)
 {
+    TransportInfo *info = (TransportInfo*)(void*)arg;
+
     LOG_MISC(("Begin attach thread"));
-    connectionInitiated((jdwpTransportEnv *)(void*)arg);
+    connectionInitiated(info->transport);
     LOG_MISC(("End attach thread"));
 }
 
@@ -418,13 +445,26 @@
 
 jdwpError
 transport_startTransport(jboolean isServer, char *name, char *address,
-                         long timeout)
+                         long timeout, char *allowed_peers)
 {
     jvmtiStartFunction func;
-    jdwpTransportEnv *trans;
     char threadName[MAXPATHLEN + 100];
     jint err;
     jdwpError serror;
+    jdwpTransportConfiguration cfg = {0};
+    TransportInfo *info;
+    jdwpTransportEnv *trans;
+
+    info = jvmtiAllocate(sizeof(*info));
+    if (info == NULL) {
+        return JDWP_ERROR(OUT_OF_MEMORY);
+    }
+
+    info->transport = transport;
+    info->transportVersion = transportVersion;
+    info->name = NULL;
+    info->address = NULL;
+    info->allowed_peers = NULL;
 
     /*
      * If the transport is already loaded then use it
@@ -434,28 +474,24 @@
      * That probably means we have a bag a transport environments
      * to correspond to the transports bag.
      */
-    if (transport != NULL) {
-        trans = transport;
-    } else {
-        serror = loadTransport(name, &trans);
+    if (info->transport == NULL) {
+        serror = loadTransport(name, info);
         if (serror != JDWP_ERROR(NONE)) {
+            jvmtiDeallocate(info);
             return serror;
         }
     }
 
+    // Cache the value
+    trans = info->transport;
+
     if (isServer) {
-
         char *retAddress;
         char *launchCommand;
-        TransportInfo *info;
         jvmtiError error;
         int len;
         char* prop_value;
 
-        info = jvmtiAllocate(sizeof(*info));
-        if (info == NULL) {
-            return JDWP_ERROR(OUT_OF_MEMORY);
-        }
         info->timeout = timeout;
 
         info->name = jvmtiAllocate((int)strlen(name)+1);
@@ -465,7 +501,6 @@
         }
         (void)strcpy(info->name, name);
 
-        info->address = NULL;
         if (address != NULL) {
             info->address = jvmtiAllocate((int)strlen(address)+1);
             if (info->address == NULL) {
@@ -475,7 +510,32 @@
             (void)strcpy(info->address, address);
         }
 
-        info->transport = trans;
+        if (info->transportVersion == JDWPTRANSPORT_VERSION_1_0) {
+            if (allowed_peers != NULL) {
+                ERROR_MESSAGE(("Allow parameter is specified but transport doesn't support it"));
+                serror = JDWP_ERROR(TRANSPORT_INIT);
+                goto handleError;
+            }
+        } else {
+            /* Memory is allocated only for transport versions > 1.0
+             * as the version 1.0 does not support the 'allow' option.
+             */
+            if (allowed_peers != NULL) {
+                info->allowed_peers = jvmtiAllocate((int)strlen(allowed_peers) + 1);
+                if (info->allowed_peers == NULL) {
+                    serror = JDWP_ERROR(OUT_OF_MEMORY);
+                    goto handleError;
+                }
+                (void)strcpy(info->allowed_peers, allowed_peers);
+            }
+            cfg.allowed_peers = info->allowed_peers;
+            err = (*trans)->SetTransportConfiguration(trans, &cfg);
+            if (err != JDWPTRANSPORT_ERROR_NONE) {
+                printLastError(trans, err);
+                serror = JDWP_ERROR(TRANSPORT_INIT);
+                goto handleError;
+            }
+        }
 
         err = (*trans)->StartListening(trans, address, &retAddress);
         if (err != JDWPTRANSPORT_ERROR_NONE) {
@@ -527,6 +587,7 @@
 handleError:
         jvmtiDeallocate(info->name);
         jvmtiDeallocate(info->address);
+        jvmtiDeallocate(info->allowed_peers);
         jvmtiDeallocate(info);
     } else {
         /*
@@ -543,6 +604,10 @@
          if (err != JDWPTRANSPORT_ERROR_NONE) {
              printLastError(trans, err);
              serror = JDWP_ERROR(TRANSPORT_INIT);
+             /* The name, address and allowed_peers fields in 'info'
+              * are not allocated in the non-server case so
+              * they do not need to be freed. */
+             jvmtiDeallocate(info);
              return serror;
          }
 
@@ -553,7 +618,7 @@
          (void)strcat(threadName, name);
 
          func = &attachThread;
-         err = spawnNewThread(func, (void*)trans, threadName);
+         err = spawnNewThread(func, (void*)info, threadName);
          serror = map2jdwpError(err);
     }
     return serror;
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/transport.h	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/transport.h	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2003, 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
@@ -30,7 +30,8 @@
 
 void transport_initialize(void);
 void transport_reset(void);
-jdwpError transport_startTransport(jboolean isServer, char *name, char *address, long timeout);
+jdwpError transport_startTransport(jboolean isServer, char *name, char *address,
+                                   long timeout, char *allowed_peers);
 
 jint transport_receivePacket(jdwpPacket *);
 jint transport_sendPacket(jdwpPacket *);
--- a/jdk/src/linux/doc/man/java.1	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/linux/doc/man/java.1	Sat Sep 09 14:36:45 2017 +0200
@@ -921,11 +921,6 @@
 at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
 .RE
 .PP
-\-Xprof
-.RS 4
-Profiles the running program and sends profiling data to standard output\&. This option is provided as a utility that is useful in program development and is not intended to be used in production systems\&.
-.RE
-.PP
 \-Xrs
 .RS 4
 Reduces the use of operating system signals by the JVM\&.
--- a/jdk/src/solaris/doc/sun/man/man1/java.1	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/src/solaris/doc/sun/man/man1/java.1	Sat Sep 09 14:36:45 2017 +0200
@@ -921,11 +921,6 @@
 at startup, the class objects in the application will be left untouched during GC and will always be considered live\&. This can result in more memory being permanently occupied which, if not used carefully, will throw an out of memory exception\&.
 .RE
 .PP
-\-Xprof
-.RS 4
-Profiles the running program and sends profiling data to standard output\&. This option is provided as a utility that is useful in program development and is not intended to be used in production systems\&.
-.RE
-.PP
 \-Xrs
 .RS 4
 Reduces the use of operating system signals by the JVM\&.
--- a/jdk/test/ProblemList.txt	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/ProblemList.txt	Sat Sep 09 14:36:45 2017 +0200
@@ -224,8 +224,6 @@
 # jdk_sound
 javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java 8178401 windows-all
 
-javax/sound/sampled/Clip/ClipCloseLoss.java                          8178403 generic-all
-
 javax/sound/sampled/DirectAudio/bug6372428.java                      8055097 generic-all
 javax/sound/sampled/Clip/bug5070081.java                             8055097 generic-all
 javax/sound/sampled/DataLine/LongFramePosition.java                  8055097 generic-all
--- a/jdk/test/TEST.groups	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/TEST.groups	Sat Sep 09 14:36:45 2017 +0200
@@ -318,7 +318,9 @@
     java/awt \
     com/sun/awt \
     com/apple/eawt \
-    sun/awt
+    com/apple/laf \
+    sun/awt \
+    sun/applet
 
 jdk_2d = \
     javax/print \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/apple/laf/TEST.properties	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,2 @@
+modules=java.desktop
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/BasicJDWPConnectionTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,200 @@
+/*
+ * 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
+ * @summary Smoke test for JDWP hardening
+ * @library /lib/testlibrary
+ * @library /test/lib
+ * @run driver BasicJDWPConnectionTest
+ */
+
+import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+
+import java.net.Socket;
+import java.net.SocketException;
+
+import jdk.test.lib.apps.LingeredApp;
+import jdk.testlibrary.Utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class BasicJDWPConnectionTest {
+
+    public static int handshake(int port) throws IOException {
+        // Connect to the debuggee and handshake
+        int res = -1;
+        Socket s = null;
+        try {
+            s = new Socket("localhost", port);
+            s.getOutputStream().write("JDWP-Handshake".getBytes("UTF-8"));
+            byte[] buffer = new byte[24];
+            res = s.getInputStream().read(buffer);
+        }
+        catch (SocketException ex) {
+            // pass
+        } finally {
+            if (s != null) {
+                s.close();
+            }
+        }
+        return res;
+    }
+
+    public static ArrayList<String> prepareCmd(int port, String allowOpt) {
+         String address = "*:" + String.valueOf(port);
+         ArrayList<String> cmd = new ArrayList<>();
+
+         String jdwpArgs = "-agentlib:jdwp=transport=dt_socket,server=y," +
+                           "suspend=n,address=" + address + allowOpt;
+         cmd.add(jdwpArgs);
+         return cmd;
+    }
+
+    public static void positiveTest(String testName, String allowOpt)
+        throws InterruptedException, IOException {
+        System.err.println("\nStarting " + testName);
+        int port = Utils.getFreePort();
+        ArrayList<String> cmd = prepareCmd(port, allowOpt);
+
+        LingeredApp a = LingeredApp.startApp(cmd);
+        int res = handshake(port);
+        a.stopApp();
+        if (res < 0) {
+            throw new RuntimeException(testName + " FAILED");
+        }
+        System.err.println(testName + " PASSED");
+    }
+
+    public static void negativeTest(String testName, String allowOpt)
+        throws InterruptedException, IOException {
+        System.err.println("\nStarting " + testName);
+        int port = Utils.getFreePort();
+        ArrayList<String> cmd = prepareCmd(port, allowOpt);
+
+        LingeredApp a = LingeredApp.startApp(cmd);
+        int res = handshake(port);
+        a.stopApp();
+        if (res > 0) {
+            System.err.println(testName + ": res=" + res);
+            throw new RuntimeException(testName + " FAILED");
+        }
+        System.err.println(testName + ": returned a negative code as expected: " + res);
+        System.err.println(testName + " PASSED");
+    }
+
+    public static void badAllowOptionTest(String testName, String allowOpt)
+        throws InterruptedException, IOException {
+        System.err.println("\nStarting " + testName);
+        int port = Utils.getFreePort();
+        ArrayList<String> cmd = prepareCmd(port, allowOpt);
+
+        try {
+            LingeredApp a = LingeredApp.startApp(cmd);
+        } catch (IOException ex) {
+            System.err.println(testName + ": caught expected IOException");
+            System.err.println(testName + " PASSED");
+            return;
+        }
+        throw new RuntimeException(testName + " FAILED");
+    }
+
+    public static void DefaultTest() throws InterruptedException, IOException {
+        // No allow option is the same as the allow option ',allow=*' is passed
+        String allowOpt = "";
+        positiveTest("DefaultTest", allowOpt);
+    }
+
+    static void ExplicitDefaultTest() throws InterruptedException, IOException {
+        // Explicit permission for connections from everywhere
+        String allowOpt = ",allow=*";
+        positiveTest("ExplicitDefaultTest" ,allowOpt);
+    }
+
+    public static void AllowTest() throws InterruptedException, IOException {
+        String allowOpt = ",allow=127.0.0.1";
+        positiveTest("AllowTest", allowOpt);
+    }
+
+    public static void MultiAllowTest() throws InterruptedException, IOException {
+        String allowOpt = ",allow=127.0.0.1+10.0.0.0/8+172.16.0.0/12+192.168.0.0/24";
+        positiveTest("MultiAllowTest", allowOpt);
+    }
+
+    public static void DenyTest() throws InterruptedException, IOException {
+        // Bad allow address
+        String allowOpt = ",allow=0.0.0.0";
+        negativeTest("DenyTest", allowOpt);
+    }
+
+    public static void MultiDenyTest() throws InterruptedException, IOException {
+        // Wrong separator ';' is used for allow option
+        String allowOpt = ",allow=127.0.0.1;192.168.0.0/24";
+        badAllowOptionTest("MultiDenyTest", allowOpt);
+    }
+
+    public static void EmptyAllowOptionTest() throws InterruptedException, IOException {
+        // Empty allow option
+        String allowOpt = ",allow=";
+        badAllowOptionTest("EmptyAllowOptionTest", allowOpt);
+    }
+
+    public static void ExplicitMultiDefault1Test() throws InterruptedException, IOException {
+        // Bad mix of allow option '*' with address value
+        String allowOpt = ",allow=*+allow=127.0.0.1";
+        badAllowOptionTest("ExplicitMultiDefault1Test", allowOpt);
+    }
+
+    public static void ExplicitMultiDefault2Test() throws InterruptedException, IOException {
+        // Bad mix of allow address value with '*'
+        String allowOpt = ",allow=allow=127.0.0.1+*";
+        badAllowOptionTest("ExplicitMultiDefault2Test", allowOpt);
+    }
+
+    public static void main(String[] args) {
+        try {
+            DefaultTest();
+            ExplicitDefaultTest();
+            AllowTest();
+            MultiAllowTest();
+            DenyTest();
+            MultiDenyTest();
+            EmptyAllowOptionTest();
+            ExplicitMultiDefault1Test();
+            ExplicitMultiDefault2Test();
+            System.err.println("\nTest PASSED");
+        } catch (InterruptedException ex) {
+            System.err.println("\nTest ERROR, getFreePort");
+            ex.printStackTrace();
+            System.exit(3);
+        } catch (IOException ex) {
+            System.err.println("\nTest ERROR");
+            ex.printStackTrace();
+            System.exit(3);
+        }
+    }
+}
--- a/jdk/test/java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java	Sat Sep 09 14:36:45 2017 +0200
@@ -36,6 +36,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8176448
  * @run main/timeout=300 ChoicePopupLocation
  */
--- a/jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/Dialog/DialogAboveFrame/DialogAboveFrameTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8169589 8171909
  * @summary Activating a dialog puts to back another dialog owned by the same frame
  * @author Dmitry Markov
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FontClass/SurrogateTest/SuppCharDrawTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2017 JetBrains s.r.o.
+ * 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 8174744
+ * @summary Wrong rendering of string containing surrogate pairs on macOS
+ */
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+
+public class SuppCharDrawTest {
+    private static final Font FONT = new Font(Font.MONOSPACED, Font.PLAIN, 12);
+    private static final int IMAGE_WIDTH = 20;
+    private static final int IMAGE_HEIGHT = 20;
+
+
+    public static void main(String[] args) {
+        BufferedImage base = renderFirstChar("A");
+        BufferedImage basePlusSurrogate = renderFirstChar("A \uD835\uDC00");
+
+        if (!imagesAreEqual(base, basePlusSurrogate)) {
+            throw new RuntimeException("Unexpected rendering change");
+        }
+    }
+
+    private static BufferedImage renderFirstChar(String s) {
+        BufferedImage image = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        Graphics g = image.createGraphics();
+        g.setColor(Color.white);
+        g.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
+        g.setColor(Color.black);
+        g.setFont(FONT);
+        FontMetrics metrics = g.getFontMetrics();
+        g.clipRect(0, 0, metrics.charWidth(s.charAt(0)), IMAGE_HEIGHT);
+        g.drawString(s, 0, metrics.getAscent());
+        g.dispose();
+        return image;
+    }
+
+    private static boolean imagesAreEqual(BufferedImage i1, BufferedImage i2) {
+        if (i1.getWidth() != i2.getWidth() || i1.getHeight() != i2.getHeight()) return false;
+        for (int i = 0; i < i1.getWidth(); i++) {
+            for (int j = 0; j < i1.getHeight(); j++) {
+                if (i1.getRGB(i, j) != i2.getRGB(i, j)) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+}
--- a/jdk/test/java/awt/Frame/ObscuredFrame/ObscuredFrameTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/Frame/ObscuredFrame/ObscuredFrameTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8171952
  * @summary Tests that getMousePosition() returns null for obscured component.
  * @author Dmitry Markov
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/InputMethods/InputMethodKeyEventsTest/InputMethodKeyEventsTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,144 @@
+/*
+ * 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 8177414
+ * @summary KEY_PRESSED and KEY_TYPED events are not generated if a key's held
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main/manual InputMethodKeyEventsTest
+ */
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class InputMethodKeyEventsTest {
+    private static final AtomicBoolean testCompleted = new AtomicBoolean(false);
+    private static volatile boolean testResult = false;
+
+    private static Dialog controlDialog;
+    private static Frame testFrame;
+
+    private static final String instructions =
+            "Verify that KEY_PRESSED and KEY_TYPED events are generated after a key's " +
+            "\npressed and held.\n" +
+            "\nThis test is for OS X only. For other platforms please simply press \"Pass\".\n" +
+            "\n1. Go to \"System Preferences -> Keyboard -> Input Sources\" and add \"British\" IM." +
+            "\n2. Set current IM to \"British\"." +
+            "\n3. Set focus to the frame located at north-west corner." +
+            "\n4. Pres and hold the \"i\" key for 3 seconds." +
+            "\n5. Press and release the \"i\" key again. Use log area to ensure that " +
+            "\n   KEY_TYPED and KEY_PRESSED events are still generated." +
+            "\nIf KEY_PRESSED, KEY_TYPED and KEY_RELEASED are generated for every key press then " +
+            "\npress \"Pass\", otherwise press \"Fail\".";
+
+    public static void main(String[] args) {
+        try {
+            Robot robot = Util.createRobot();
+
+            createAndShowGUI();
+            Util.waitForIdle(robot);
+
+            Util.waitForCondition(testCompleted);
+            if (!testResult) {
+                throw new RuntimeException("Test FAILED!");
+            }
+        } finally {
+            if (controlDialog != null) {
+                controlDialog.dispose();
+            }
+            if (testFrame != null) {
+                testFrame.dispose();
+            }
+        }
+    }
+
+    private static void createAndShowGUI() {
+        controlDialog = new Dialog((Frame)null, "InputMethodKeyEventsTest");
+
+        TextArea messageArea = new TextArea(instructions, 15, 80, TextArea.SCROLLBARS_BOTH);
+        controlDialog.add("North", messageArea);
+
+        TextArea logArea = new TextArea("Test's logs are displayed here\n", 15, 80, TextArea.SCROLLBARS_BOTH);
+        controlDialog.add("Center", logArea);
+
+        Button passedButton = new Button("Pass");
+        passedButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                testResult = true;
+                completeTest();
+            }
+        });
+
+        Button failedButton = new Button("Fail");
+        failedButton.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                testResult = false;
+                completeTest();
+            }
+        });
+
+        Panel buttonPanel = new Panel();
+        buttonPanel.add("West",passedButton);
+        buttonPanel.add("East", failedButton);
+        controlDialog.add("South", buttonPanel);
+
+        controlDialog.setBounds(250, 0, 500, 500);
+        controlDialog.setVisible(true);
+
+        testFrame = new Frame("InputMethodKeyEventsTest");
+        testFrame.setSize(200, 200);
+        testFrame.addKeyListener(new KeyListener() {
+            @Override
+            public void keyTyped(KeyEvent e) {
+                logArea.append("KEY_TYPED keyCode = " + e.getKeyCode() + "\n");
+            }
+
+            @Override
+            public void keyPressed(KeyEvent e) {
+                logArea.append("KEY_PRESSED keyCode = " + e.getKeyCode() + "\n");
+            }
+
+            @Override
+            public void keyReleased(KeyEvent e) {
+                logArea.append("KEY_RELEASED keyCode = " + e.getKeyCode() + "\n");
+            }
+        });
+        testFrame.setVisible(true);
+    }
+
+    private static void completeTest() {
+        testCompleted.set(true);
+        synchronized (testCompleted) {
+            testCompleted.notifyAll();
+        }
+    }
+}
--- a/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithPopup.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -31,7 +31,7 @@
 /**
  * @test
  * @key headful
- * @bug 8012026
+ * @bug 8012026 8027154
  * @summary Component.getMousePosition() does not work in an applet on MacOS
  * @author Petr Pchelko
  * @library ../../regtesthelpers
@@ -80,33 +80,31 @@
         frame1.setBounds(100, 100, 100, 100);
         frame1.addMouseMotionListener(new MouseMotionAdapter() {
 
-            private boolean shown = false;
-
             @Override
             public void mouseMoved(MouseEvent e) {
-                if (shown) {
-                    return;
-                }
-
-                shown = true;
-
                 frame2 = new Frame();
                 frame2.setBounds(120, 120, 120, 120);
-                frame2.setVisible(true);
 
-                Point positionInFrame2 = frame2.getMousePosition();
-                if (positionInFrame2.x != 30 || positionInFrame2.y != 30) {
-                    throw new RuntimeException("Wrong position reported. Should be [30, 30] but was [" +
-                            positionInFrame2.x + ", " + positionInFrame2.y + "]");
-                }
+                frame2.addMouseMotionListener(new MouseMotionAdapter() {
+                    @Override
+                    public void mouseMoved(MouseEvent e)
+                    {
+                        Point positionInFrame2 = frame2.getMousePosition();
+                        if (positionInFrame2.x != 30 || positionInFrame2.y != 30) {
+                            throw new RuntimeException("Wrong position reported. Should be [30, 30] but was [" +
+                                    positionInFrame2.x + ", " + positionInFrame2.y + "]");
+                        }
 
-                Point positionInFrame1 = frame1.getMousePosition();
-                if (positionInFrame1 != null) {
-                    throw new RuntimeException("Wrong position reported. Should be null");
-                }
+                        Point positionInFrame1 = frame1.getMousePosition();
+                        if (positionInFrame1 != null) {
+                            throw new RuntimeException("Wrong position reported. Should be null");
+                        }
+                    }
+                });
 
+                frame2.setVisible(true);
             }
         });
         frame1.setVisible(true);
     }
-}
+}
\ No newline at end of file
--- a/jdk/test/java/awt/PopupMenu/PopupMenuLocation.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/PopupMenu/PopupMenuLocation.java	Sat Sep 09 14:36:45 2017 +0200
@@ -38,6 +38,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8160270
  * @run main/timeout=300 PopupMenuLocation
  */
--- a/jdk/test/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/Robot/HiDPIScreenCapture/ScreenCaptureTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -23,6 +23,7 @@
 
  /*
  * @test
+ * @key headful
  * @bug 8162959
  * @summary Validate output of createMultiResolutionScreenCapture
  *          new API which returns MultiResolutionImage.
--- a/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 import java.awt.event.KeyEvent;
 import java.awt.event.MouseEvent;
 
+import static jdk.testlibrary.Asserts.assertNull;
 import static jdk.testlibrary.Asserts.assertTrue;
 
 /*
@@ -57,9 +58,8 @@
     private int[] textKeys, modifierKeys, inputMasks;
     private boolean[] modifierStatus, textStatus;
 
-    private final static int waitDelay = 5000;
-    private Object tempLock = new Object();
-    private Object keyLock = new Object();
+    private final static int WAIT_DELAY = 5000;
+    private final Object lock = new Object();
 
     public static void main(String[] args) throws Exception {
         ModifierRobotKeyTest test = new ModifierRobotKeyTest();
@@ -99,27 +99,28 @@
     }
 
     public void keyPressed(KeyEvent event) {
-
-        tempPress = true;
-        synchronized (tempLock) { tempLock.notifyAll(); }
+        synchronized (lock) {
+            tempPress = true;
+            lock.notifyAll();
 
-        if (! startTest) {
-            return;
-        }
-        for (int x = 0; x < inputMasks.length; x++) {
-            if ((event.getModifiers() & inputMasks[x]) != 0) {
-                System.out.println("Modifier set: " + event.getKeyModifiersText(inputMasks[x]));
-                modifierStatus[x] = true;
+            if (! startTest) {
+                return;
+            }
+            for (int x = 0; x < inputMasks.length; x++) {
+                if ((event.getModifiers() & inputMasks[x]) != 0) {
+                    System.out.println("Modifier set: " +
+                                      event.getKeyModifiersText(inputMasks[x]));
+                    modifierStatus[x] = true;
+                }
+            }
+            for (int x = 0; x < textKeys.length; x++) {
+                if (event.getKeyCode() == textKeys[x]) {
+                    System.out.println("Text set: " +
+                                                 event.getKeyText(textKeys[x]));
+                    textStatus[x] = true;
+                }
             }
         }
-        for (int x = 0; x < textKeys.length; x++) {
-            if (event.getKeyCode() == textKeys[x]) {
-                System.out.println("Text set: " + event.getKeyText(textKeys[x]));
-                textStatus[x] = true;
-            }
-        }
-
-        synchronized (keyLock) { keyLock.notifyAll(); }
     }
 
     private void initializeGUI() {
@@ -131,100 +132,115 @@
         canvas.addKeyListener(this);
         frame.setLayout(new BorderLayout());
         frame.add(canvas);
-        frame.setSize(200, 200);
+        frame.setBounds(200, 200, 200, 200);
         frame.setVisible(true);
     }
 
     public void doTest() throws Exception {
         robot = new ExtendedRobot();
+        robot.setAutoDelay(20);
+        robot.waitForIdle();
 
-        robot.mouseMove((int) frame.getLocationOnScreen().getX() + frame.getSize().width / 2,
-                        (int) frame.getLocationOnScreen().getY() + frame.getSize().height / 2);
+        robot.mouseMove((int) frame.getLocationOnScreen().getX() +
+                                                    frame.getSize().width / 2,
+                        (int) frame.getLocationOnScreen().getY() +
+                                                    frame.getSize().height / 2);
         robot.click(MouseEvent.BUTTON1_MASK);
         robot.waitForIdle();
-
         assertTrue(focusGained, "FAIL: Canvas gained focus!");
 
+        String error = null;
+        exit1:
         for (int i = 0; i < modifierKeys.length; i++) {
             for (int j = 0; j < textKeys.length; j++) {
-                tempPress = false;
-                robot.keyPress(modifierKeys[i]);
-                robot.waitForIdle();
-                if (! tempPress) {
-                    synchronized (tempLock) { tempLock.wait(waitDelay); }
+                if (error != null) {
+                    break exit1;
                 }
-                assertTrue(tempPress, "FAIL: keyPressed triggered for i=" + i);
-
-                resetStatus();
-                startTest = true;
-                robot.keyPress(textKeys[j]);
-                robot.waitForIdle();
-                if (! modifierStatus[i] || ! textStatus[j]) {
-                    synchronized (keyLock) { keyLock.wait(waitDelay); }
+                robot.waitForIdle(100);
+                synchronized (lock) {
+                    tempPress = false;
+                    robot.keyPress(modifierKeys[i]);
+                    lock.wait(WAIT_DELAY);
+                }
+                if (!tempPress) {
+                    error ="FAIL: keyPressed triggered for i=" + i;
                 }
 
+                synchronized (lock) {
+                    resetStatus();
+                    startTest = true;
+                    robot.keyPress(textKeys[j]);
+                    lock.wait(WAIT_DELAY);
+                }
 
-                assertTrue(modifierStatus[i] && textStatus[j],
-                        "FAIL: KeyEvent not proper!"+
-                        "Key checked: i=" + i + "; j=" + j+
-                        "ModifierStatus = " + modifierStatus[i]+
-                        "TextStatus = " + textStatus[j]);
+                if (!(modifierStatus[i] && textStatus[j])) {
+                    error = "FAIL: KeyEvent not proper!"+
+                            "Key checked: i=" + i + "; j=" + j+
+                            "ModifierStatus = " + modifierStatus[i]+
+                            "TextStatus = " + textStatus[j];
+                }
+
                 startTest = false;
                 robot.keyRelease(textKeys[j]);
-                robot.waitForIdle();
                 robot.keyRelease(modifierKeys[i]);
-                robot.waitForIdle();
             }
         }
 
+        exit2:
         for (int i = 0; i < modifierKeys.length; i++) {
             for (int j = i + 1; j < modifierKeys.length; j++) {
                 for (int k = 0; k < textKeys.length; k++) {
-                    tempPress = false;
-                    robot.keyPress(modifierKeys[i]);
-                    robot.waitForIdle();
-                    if (! tempPress) {
-                        synchronized (tempLock) { tempLock.wait(waitDelay); }
+                    if (error != null) {
+                        break exit2;
+                    }
+                    robot.waitForIdle(100);
+                    synchronized (lock) {
+                        tempPress = false;
+                        robot.keyPress(modifierKeys[i]);
+                        lock.wait(WAIT_DELAY);
+                    }
+
+                    if (!tempPress) {
+                        error = "FAIL: MultiKeyTest: keyPressed " +
+                                                         "triggered for i=" + i;
                     }
 
-                    assertTrue(tempPress, "FAIL: MultiKeyTest: keyPressed triggered for i=" + i);
-
-                    tempPress = false;
-                    robot.keyPress(modifierKeys[j]);
-                    robot.waitForIdle();
-                    if (! tempPress) {
-                        synchronized (tempLock) { tempLock.wait(waitDelay); }
+                    synchronized (lock) {
+                        tempPress = false;
+                        robot.keyPress(modifierKeys[j]);
+                        lock.wait(WAIT_DELAY);
                     }
-                    assertTrue(tempPress, "FAIL: MultiKeyTest keyPressed triggered for j=" + j);
+                    if (!tempPress) {
+                        error = "FAIL: MultiKeyTest keyPressed " +
+                                                         "triggered for j=" + j;
+                    };
 
-                    resetStatus();
-                    startTest = true;
-                    robot.keyPress(textKeys[k]);
-                    robot.waitForIdle();
-                    if (! modifierStatus[i] || ! modifierStatus[j] || ! textStatus[k]) {
-                        synchronized (keyLock) {
-                            keyLock.wait(waitDelay);
-                        }
+                    synchronized (lock) {
+                        resetStatus();
+                        startTest = true;
+                        robot.keyPress(textKeys[k]);
+                        lock.wait(WAIT_DELAY);
                     }
-                    assertTrue(modifierStatus[i] && modifierStatus[j] && textStatus[k],
-                            "FAIL: KeyEvent not proper!"+
-                            "Key checked: i=" + i + "; j=" + j + "; k=" + k+
-                            "Modifier1Status = " + modifierStatus[i]+
-                            "Modifier2Status = " + modifierStatus[j]+
-                            "TextStatus = " + textStatus[k]);
+                    if (!(modifierStatus[i] && modifierStatus[j]
+                                                              && textStatus[k]))
+                    {
+                        error = "FAIL: KeyEvent not proper!" +
+                               "Key checked: i=" + i + "; j=" + j + "; k=" + k +
+                               "Modifier1Status = " + modifierStatus[i] +
+                               "Modifier2Status = " + modifierStatus[j] +
+                               "TextStatus = " + textStatus[k];
+                    }
 
                     startTest = false;
                     robot.keyRelease(textKeys[k]);
-                    robot.waitForIdle();
                     robot.keyRelease(modifierKeys[j]);
-                    robot.waitForIdle();
                     robot.keyRelease(modifierKeys[i]);
-                    robot.waitForIdle();
                 }
             }
         }
 
         frame.dispose();
+        assertNull(error, error);
     }
 
     private void resetStatus() {
--- a/jdk/test/java/awt/Robot/MultiScreenRobotPosition/MultiScreenRobotPosition.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/Robot/MultiScreenRobotPosition/MultiScreenRobotPosition.java	Sat Sep 09 14:36:45 2017 +0200
@@ -31,6 +31,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8176009
  */
 public class MultiScreenRobotPosition {
--- a/jdk/test/java/awt/Window/WindowDeadlockTest/WindowDeadlockTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/Window/WindowDeadlockTest/WindowDeadlockTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -23,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8176490
  * @summary Tests that there is no hang or deadlock when the visibility
  *      of parent and child windows is changed.
--- a/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/dnd/MissingEventsOnModalDialog/MissingEventsOnModalDialogTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -41,20 +41,44 @@
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.concurrent.TimeUnit;
+
 /*
  * @test
  * @key headful
- * @bug 8134917
+ * @bug 8134917 8139050
  * @summary [macosx] JOptionPane doesn't receive mouse events when opened from a drop event
- * @author Alexandr Scherbatiy
+ * @run main MissingEventsOnModalDialogTest RUN_PROCESS
  */
 public class MissingEventsOnModalDialogTest {
 
+    private static final String RUN_PROCESS = "RUN_PROCESS";
+    private static final String RUN_TEST = "RUN_TEST";
+    private static boolean exception = false;
     private static volatile boolean passed = false;
 
     public static void main(String[] args) throws Exception {
-        Frame sourceFrame = createFrame("Source Frame", 0, 0);
-        Frame targetFrame = createFrame("Target Frame", 250, 250);
+        String command = args.length < 1 ? RUN_TEST : args[0];
+        switch (command) {
+            case RUN_PROCESS:
+                runProcess();
+                break;
+            case RUN_TEST:
+                runTest();
+                break;
+            default:
+                throw new RuntimeException("Unknown command: " + command);
+        }
+    }
+
+    private static void runTest() throws Exception {
+        Frame sourceFrame = createFrame("Source Frame", 100, 100);
+        Frame targetFrame = createFrame("Target Frame", 350, 350);
 
         DragSource defaultDragSource
                 = DragSource.getDefaultDragSource();
@@ -237,4 +261,50 @@
             throw new RuntimeException(e);
         }
     }
+
+    private static void runProcess() throws Exception {
+        String javaPath = System.getProperty("java.home", "");
+        String command = javaPath + File.separator + "bin" + File.separator + "java"
+                + " " + MissingEventsOnModalDialogTest.class.getName() + " " + RUN_TEST;
+
+        Process process = Runtime.getRuntime().exec(command);
+        boolean processExit = process.waitFor(20, TimeUnit.SECONDS);
+
+        StringBuilder inStream = new StringBuilder();
+        StringBuilder errStream = new StringBuilder();
+        checkErrors(process.getErrorStream(), errStream);
+        checkErrors(process.getInputStream(), inStream);
+
+        if (exception) {
+            System.out.println(inStream);
+            System.err.println(errStream);
+            throw new RuntimeException("Exception in the output!");
+        }
+
+        if (!processExit) {
+            process.destroy();
+            throw new RuntimeException(""
+                    + "The sub process has not exited!");
+        }
+    }
+
+    private static boolean containsError(String line) {
+        line = line.toLowerCase();
+        return line.contains("exception") || line.contains("error")
+                || line.contains("selector");
+    }
+
+    private static void checkErrors(InputStream in, StringBuilder stream) throws IOException {
+        try (BufferedReader bufferedReader
+                = new BufferedReader(new InputStreamReader(in))) {
+
+            String line = null;
+            while ((line = bufferedReader.readLine()) != null) {
+                if (!exception) {
+                    exception = containsError(line);
+                }
+                stream.append(line).append("\n");
+            }
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/RemoveDropTargetCrashTest/RemoveDropTargetCrashTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,339 @@
+/*
+ * 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
+ * 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.awt.Button;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.Panel;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DragSourceDragEvent;
+import java.awt.dnd.DragSourceDropEvent;
+import java.awt.dnd.DragSourceEvent;
+import java.awt.dnd.DragSourceListener;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetContext;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.dnd.DropTargetEvent;
+import java.awt.dnd.DropTargetListener;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Serializable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @test
+ * @key headful
+ * @bug 4393148 8136999 8186263
+ * @summary tests that removal of the drop target or disposal of frame during
+ *          drop processing doesn't cause crash
+ * @run main RemoveDropTargetCrashTest RUN_PROCESS
+ */
+public class RemoveDropTargetCrashTest {
+
+    private static final String RUN_PROCESS = "RUN_PROCESS";
+    private static final String RUN_TEST = "RUN_TEST";
+    private static boolean exception;
+    private static volatile CountDownLatch go;
+
+    public static void main(String[] args) throws Exception {
+        String command = args.length < 1 ? RUN_TEST : args[0];
+
+        switch (command) {
+            case RUN_PROCESS:
+                runProcess();
+                break;
+            case RUN_TEST:
+                for (int i = 0; i < 10; ++i) {
+                    runTest(i * 10);
+                    runTest(-1);
+                }
+                break;
+            default:
+                throw new RuntimeException("Unknown command: " + command);
+        }
+    }
+
+    private static void runTest(int delay) throws Exception {
+
+        Robot robot = new Robot();
+        robot.setAutoDelay(10);
+        Frame frame = null;
+        try {
+            DragSourceButton dragSourceButton = new DragSourceButton();
+            dragSourceButton.addActionListener(e -> go.countDown());
+
+            DropTargetPanel dropTargetPanel = new DropTargetPanel();
+
+            frame = new Frame();
+            frame.setTitle("Test frame");
+            frame.setLocation(200, 200);
+            frame.setLayout(new GridLayout(2, 1));
+            frame.add(dragSourceButton);
+            frame.add(dropTargetPanel);
+
+            frame.pack();
+            frame.setVisible(true);
+
+            robot.waitForIdle();
+            robot.delay(200);
+
+            Point dragPoint = dragSourceButton.getLocationOnScreen();
+            Dimension size = dragSourceButton.getSize();
+            dragPoint.translate(size.width / 2, size.height / 2);
+
+            pressOnButton(robot, dragPoint);
+
+            Point dropPoint = dropTargetPanel.getLocationOnScreen();
+            size = dropTargetPanel.getSize();
+            dropPoint.translate(size.width / 2, size.height / 2);
+
+            robot.mouseMove(dragPoint.x, dragPoint.y);
+            robot.keyPress(KeyEvent.VK_CONTROL);
+            robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+
+            Point tmpPoint = new Point(dragPoint);
+            for (; !tmpPoint.equals(dropPoint);
+                 tmpPoint.translate(sign(dropPoint.x - tmpPoint.x),
+                            sign(dropPoint.y - tmpPoint.y))) {
+                robot.mouseMove(tmpPoint.x, tmpPoint.y);
+            }
+            robot.keyRelease(KeyEvent.VK_CONTROL);
+            robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+            // This delay() is important part of the test, because we need to
+            // test a different delays before frame.dispose().
+            if (delay >= 0) {
+                robot.delay(delay);
+            } else {
+                robot.waitForIdle();
+                robot.delay(1000);
+
+                Point clickPoint = dragSourceButton.getLocationOnScreen();
+                size = dragSourceButton.getSize();
+                clickPoint.translate(size.width / 2, size.height / 2);
+
+                if (clickPoint.equals(dragPoint)) {
+                    throw new RuntimeException("Button was not moved");
+                }
+                pressOnButton(robot, clickPoint);
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+        }
+    }
+
+    private static void pressOnButton(Robot robot, Point clickPoint)
+            throws InterruptedException {
+        go = new CountDownLatch(1);
+        robot.mouseMove(clickPoint.x, clickPoint.y);
+        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        if (!go.await(10, TimeUnit.SECONDS)) {
+            throw new RuntimeException("Button was not pressed");
+        }
+    }
+
+    public static int sign(int n) {
+        return n < 0 ? -1 : n == 0 ? 0 : 1;
+    }
+
+    static class DragSourceButton extends Button implements Serializable,
+            Transferable,
+            DragGestureListener,
+            DragSourceListener {
+
+        private static DataFlavor dataflavor;
+
+        static {
+            try {
+                dataflavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
+                dataflavor.setHumanPresentableName("Local Object Flavor");
+            } catch (ClassNotFoundException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        public DragSourceButton() {
+            this("DragSourceButton");
+        }
+
+        public DragSourceButton(String str) {
+            super(str);
+
+            DragSource ds = DragSource.getDefaultDragSource();
+            ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY,
+                    this);
+        }
+
+        public void dragGestureRecognized(DragGestureEvent dge) {
+            dge.startDrag(null, this, this);
+        }
+
+        public void dragEnter(DragSourceDragEvent dsde) {
+        }
+
+        public void dragExit(DragSourceEvent dse) {
+        }
+
+        public void dragOver(DragSourceDragEvent dsde) {
+        }
+
+        public void dragDropEnd(DragSourceDropEvent dsde) {
+        }
+
+        public void dropActionChanged(DragSourceDragEvent dsde) {
+        }
+
+        public Object getTransferData(DataFlavor flavor)
+                throws UnsupportedFlavorException, IOException {
+
+            if (!isDataFlavorSupported(flavor)) {
+                throw new UnsupportedFlavorException(flavor);
+            }
+
+            return this;
+        }
+
+        public DataFlavor[] getTransferDataFlavors() {
+            return new DataFlavor[]{dataflavor};
+        }
+
+        public boolean isDataFlavorSupported(DataFlavor dflavor) {
+            return dataflavor.equals(dflavor);
+        }
+    }
+
+    static class DropTargetPanel extends Panel implements DropTargetListener {
+
+        final Dimension preferredSize = new Dimension(100, 100);
+
+        public DropTargetPanel() {
+            setDropTarget(new DropTarget(this, this));
+        }
+
+        public Dimension getPreferredSize() {
+            return preferredSize;
+        }
+
+        public void dragEnter(DropTargetDragEvent dtde) {
+        }
+
+        public void dragExit(DropTargetEvent dte) {
+        }
+
+        public void dragOver(DropTargetDragEvent dtde) {
+        }
+
+        public void dropActionChanged(DropTargetDragEvent dtde) {
+        }
+
+        public void drop(DropTargetDropEvent dtde) {
+
+            setDropTarget(null);
+
+            DropTargetContext dtc = dtde.getDropTargetContext();
+
+            if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) {
+                dtde.acceptDrop(DnDConstants.ACTION_COPY);
+            } else {
+                dtde.rejectDrop();
+            }
+
+            DataFlavor[] dfs = dtde.getCurrentDataFlavors();
+
+            if (dfs != null && dfs.length >= 1) {
+                Transferable transfer = dtde.getTransferable();
+                Component comp;
+                try {
+                    comp = (Component) transfer.getTransferData(dfs[0]);
+                } catch (Throwable e) {
+                    dtc.dropComplete(false);
+                    throw new RuntimeException(e);
+                }
+                add(comp);
+                validate();
+            }
+            dtc.dropComplete(true);
+        }
+    }
+
+    private static void runProcess() throws Exception {
+        String javaPath = System.getProperty("java.home", "");
+        String command = javaPath + File.separator + "bin" + File.separator + "java"
+                + " " + RemoveDropTargetCrashTest.class.getName() + " " + RUN_TEST;
+
+        Process process = Runtime.getRuntime().exec(command);
+        boolean processExit = process.waitFor(100, TimeUnit.SECONDS);
+
+        StringBuilder inStream = new StringBuilder();
+        StringBuilder errStream = new StringBuilder();
+        checkErrors(process.getErrorStream(), errStream);
+        checkErrors(process.getInputStream(), inStream);
+
+        System.out.println(inStream);
+        System.err.println(errStream);
+
+        if (exception) {
+            throw new RuntimeException("Exception in the output!");
+        }
+
+        if (!processExit) {
+            process.destroy();
+            throw new RuntimeException(""
+                    + "The sub process has not exited!");
+        }
+    }
+
+    private static void checkErrors(InputStream in, StringBuilder stream) throws IOException {
+        try (BufferedReader bufferedReader
+                = new BufferedReader(new InputStreamReader(in))) {
+
+            String line = null;
+            while ((line = bufferedReader.readLine()) != null) {
+                if (!exception) {
+                    exception = line.contains("Exception") || line.contains("Error");
+                }
+                stream.append(line).append("\n");
+            }
+        }
+    }
+}
+
--- a/jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/font/TextLayout/ArabicDiacriticTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  */
 
 /* @test
+ * @key headful
  * @summary verify Arab Diacritic Positioning
  * @bug 8168759
  */
--- a/jdk/test/java/awt/geom/Path2D/Path2DCopyConstructor.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/awt/geom/Path2D/Path2DCopyConstructor.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -34,9 +34,10 @@
 
 /**
  * @test
- * @bug 8076419
+ * @bug 8076419 8078192 8186364
  * @summary Check Path2D copy constructor (trims arrays)
  *          and constructor with zero capacity
+ *          and Path2D.trimToSize()
  * @run main Path2DCopyConstructor
  */
 public class Path2DCopyConstructor {
@@ -179,58 +180,232 @@
     }
 
     static void test(Path2D p2d, boolean isEmpty) {
-        testEqual(new Path2D.Float(p2d), p2d);
-        testEqual(new Path2D.Double(p2d), p2d);
-        testEqual(new GeneralPath(p2d), p2d);
+        Path2D c;
+        Path2D.Float pf;
+        Path2D.Double pd;
+        GeneralPath gp;
 
-        testIterator(new Path2D.Float(p2d), p2d);
-        testIterator(new Path2D.Double(p2d), p2d);
-        testIterator((Path2D) p2d.clone(), p2d);
+        pf = new Path2D.Float(p2d);
+        testEqual(pf, p2d);
+        pf.trimToSize();
+        testEqual(pf, p2d);
+        pd = new Path2D.Double(p2d);
+        testEqual(pd, p2d);
+        pd.trimToSize();
+        testEqual(pd, p2d);
+        c = (Path2D)p2d.clone();
+        testEqual(c, p2d);
+        c.trimToSize();
+        testEqual(c, p2d);
+        gp = new GeneralPath(p2d);
+        testEqual(gp, p2d);
+        gp.trimToSize();
+        testEqual(gp, p2d);
 
-        testFlattening(new Path2D.Float(p2d), p2d);
-        testFlattening(new Path2D.Double(p2d), p2d);
-        testFlattening((Path2D) p2d.clone(), p2d);
+        pf = new Path2D.Float(p2d);
+        testIterator(pf, p2d);
+        pf.trimToSize();
+        testIterator(pf, p2d);
+        pd = new Path2D.Double(p2d);
+        testIterator(pd, p2d);
+        pd.trimToSize();
+        testIterator(pd, p2d);
+        c = (Path2D)p2d.clone();
+        testIterator(c, p2d);
+        c.trimToSize();
+        testIterator(c, p2d);
+        gp = new GeneralPath(p2d);
+        testIterator(gp, p2d);
+        gp.trimToSize();
+        testIterator(gp, p2d);
 
-        testAddMove(new Path2D.Float(p2d));
-        testAddMove(new Path2D.Double(p2d));
-        testAddMove((Path2D) p2d.clone());
+        pf = new Path2D.Float(p2d);
+        testFlattening(pf, p2d);
+        pf.trimToSize();
+        testFlattening(pf, p2d);
+        pd = new Path2D.Double(p2d);
+        testFlattening(pd, p2d);
+        pd.trimToSize();
+        testFlattening(pd, p2d);
+        c = (Path2D)p2d.clone();
+        testFlattening(c, p2d);
+        c.trimToSize();
+        testFlattening(c, p2d);
+        gp = new GeneralPath(p2d);
+        testFlattening(gp, p2d);
+        gp.trimToSize();
+        testFlattening(gp, p2d);
+
+        pf = new Path2D.Float(p2d);
+        testAddMove(pf);
+        pf.trimToSize();
+        testAddMove(pf);
+        pd = new Path2D.Double(p2d);
+        testAddMove(pd);
+        pd.trimToSize();
+        testAddMove(pd);
+        c = (Path2D)p2d.clone();
+        testAddMove(c);
+        c.trimToSize();
+        testAddMove(c);
+        gp = new GeneralPath(p2d);
+        testAddMove(gp);
+        gp.trimToSize();
+        testAddMove(gp);
 
         // These should expect exception if empty
-        testAddLine(new Path2D.Float(p2d), isEmpty);
-        testAddLine(new Path2D.Double(p2d), isEmpty);
-        testAddLine((Path2D) p2d.clone(), isEmpty);
+        pf = new Path2D.Float(p2d);
+        testAddLine(pf, isEmpty);
+        pf.trimToSize();
+        testAddLine(pf, isEmpty);
+        pd = new Path2D.Double(p2d);
+        testAddLine(pd, isEmpty);
+        pd.trimToSize();
+        testAddLine(pd, isEmpty);
+        c = (Path2D)p2d.clone();
+        testAddLine(c, isEmpty);
+        c.trimToSize();
+        testAddLine(c, isEmpty);
+        gp = new GeneralPath(p2d);
+        testAddLine(gp, isEmpty);
+        gp.trimToSize();
+        testAddLine(gp, isEmpty);
 
-        testAddQuad(new Path2D.Float(p2d), isEmpty);
-        testAddQuad(new Path2D.Double(p2d), isEmpty);
-        testAddQuad((Path2D) p2d.clone(), isEmpty);
+        pf = new Path2D.Float(p2d);
+        testAddQuad(pf, isEmpty);
+        pf.trimToSize();
+        testAddQuad(pf, isEmpty);
+        pd = new Path2D.Double(p2d);
+        testAddQuad(pd, isEmpty);
+        pd.trimToSize();
+        testAddQuad(pd, isEmpty);
+        c = (Path2D)p2d.clone();
+        testAddQuad(c, isEmpty);
+        c.trimToSize();
+        testAddQuad(c, isEmpty);
+        gp = new GeneralPath(p2d);
+        testAddQuad(gp, isEmpty);
+        gp.trimToSize();
+        testAddQuad(gp, isEmpty);
 
-        testAddCubic(new Path2D.Float(p2d), isEmpty);
-        testAddCubic(new Path2D.Double(p2d), isEmpty);
-        testAddCubic((Path2D) p2d.clone(), isEmpty);
+        pf = new Path2D.Float(p2d);
+        testAddCubic(pf, isEmpty);
+        pf.trimToSize();
+        testAddCubic(pf, isEmpty);
+        pd = new Path2D.Double(p2d);
+        testAddCubic(pd, isEmpty);
+        pd.trimToSize();
+        testAddCubic(pd, isEmpty);
+        c = (Path2D)p2d.clone();
+        testAddCubic(c, isEmpty);
+        c.trimToSize();
+        testAddCubic(c, isEmpty);
+        gp = new GeneralPath(p2d);
+        testAddCubic(gp, isEmpty);
+        gp.trimToSize();
+        testAddCubic(gp, isEmpty);
 
-        testAddClose(new Path2D.Float(p2d), isEmpty);
-        testAddClose(new Path2D.Double(p2d), isEmpty);
-        testAddClose((Path2D) p2d.clone(), isEmpty);
+        pf = new Path2D.Float(p2d);
+        testAddClose(pf, isEmpty);
+        pf.trimToSize();
+        testAddClose(pf, isEmpty);
+        pd = new Path2D.Double(p2d);
+        testAddClose(pd, isEmpty);
+        pd.trimToSize();
+        testAddClose(pd, isEmpty);
+        c = (Path2D)p2d.clone();
+        testAddClose(c, isEmpty);
+        c.trimToSize();
+        testAddClose(c, isEmpty);
+        gp = new GeneralPath(p2d);
+        testAddClose(gp, isEmpty);
+        gp.trimToSize();
+        testAddClose(gp, isEmpty);
 
-        testGetBounds(new Path2D.Float(p2d), p2d);
-        testGetBounds(new Path2D.Double(p2d), p2d);
-        testGetBounds((Path2D) p2d.clone(), p2d);
+        pf = new Path2D.Float(p2d);
+        testGetBounds(pf, p2d);
+        pf.trimToSize();
+        testGetBounds(pf, p2d);
+        pd = new Path2D.Double(p2d);
+        testGetBounds(pd, p2d);
+        pd.trimToSize();
+        testGetBounds(pd, p2d);
+        c = (Path2D)p2d.clone();
+        testGetBounds(c, p2d);
+        c.trimToSize();
+        testGetBounds(c, p2d);
+        gp = new GeneralPath(p2d);
+        testGetBounds(gp, p2d);
+        gp.trimToSize();
+        testGetBounds(gp, p2d);
 
-        testTransform(new Path2D.Float(p2d));
-        testTransform(new Path2D.Double(p2d));
-        testTransform((Path2D) p2d.clone());
+        pf = new Path2D.Float(p2d);
+        testTransform(pf);
+        pf.trimToSize();
+        testTransform(pf);
+        pd = new Path2D.Double(p2d);
+        testTransform(pd);
+        pd.trimToSize();
+        testTransform(pd);
+        c = (Path2D)p2d.clone();
+        testTransform(c);
+        c.trimToSize();
+        testTransform(c);
+        gp = new GeneralPath(p2d);
+        testTransform(gp);
+        gp.trimToSize();
+        testTransform(gp);
 
-        testIntersect(new Path2D.Float(p2d), p2d);
-        testIntersect(new Path2D.Double(p2d), p2d);
-        testIntersect((Path2D) p2d.clone(), p2d);
+        pf = new Path2D.Float(p2d);
+        testIntersect(pf, p2d);
+        pf.trimToSize();
+        testIntersect(pf, p2d);
+        pd = new Path2D.Double(p2d);
+        testIntersect(pd, p2d);
+        pd.trimToSize();
+        testIntersect(pd, p2d);
+        c = (Path2D)p2d.clone();
+        testIntersect(c, p2d);
+        c.trimToSize();
+        testIntersect(c, p2d);
+        gp = new GeneralPath(p2d);
+        testIntersect(gp, p2d);
+        gp.trimToSize();
+        testIntersect(gp, p2d);
 
-        testContains(new Path2D.Float(p2d), p2d);
-        testContains(new Path2D.Double(p2d), p2d);
-        testContains((Path2D) p2d.clone(), p2d);
+        pf = new Path2D.Float(p2d);
+        testContains(pf, p2d);
+        pf.trimToSize();
+        testContains(pf, p2d);
+        pd = new Path2D.Double(p2d);
+        testContains(pd, p2d);
+        pd.trimToSize();
+        testContains(pd, p2d);
+        c = (Path2D)p2d.clone();
+        testContains(c, p2d);
+        c.trimToSize();
+        testContains(c, p2d);
+        gp = new GeneralPath(p2d);
+        testContains(gp, p2d);
+        gp.trimToSize();
+        testContains(gp, p2d);
 
-        testGetCurrentPoint(new Path2D.Float(p2d), p2d);
-        testGetCurrentPoint(new Path2D.Double(p2d), p2d);
-        testGetCurrentPoint((Path2D) p2d.clone(), p2d);
+        pf = new Path2D.Float(p2d);
+        testGetCurrentPoint(pf, p2d);
+        pf.trimToSize();
+        testGetCurrentPoint(pf, p2d);
+        pd = new Path2D.Double(p2d);
+        testGetCurrentPoint(pd, p2d);
+        pd.trimToSize();
+        testGetCurrentPoint(pd, p2d);
+        c = (Path2D)p2d.clone();
+        testGetCurrentPoint(c, p2d);
+        c.trimToSize();
+        testGetCurrentPoint(c, p2d);
+        gp = new GeneralPath(p2d);
+        testGetCurrentPoint(gp, p2d);
+        gp.trimToSize();
+        testGetCurrentPoint(gp, p2d);
     }
 
     static void testEqual(Path2D pathA, Path2D pathB) {
--- a/jdk/test/java/net/MulticastSocket/TestInterfaces.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/net/MulticastSocket/TestInterfaces.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -24,10 +24,15 @@
 /*
  * @test
  * @bug 4422122
- * @key intermittent
  * @summary Test that MulticastSocket.getInterface returns the
  *          same InetAddress set by MulticastSocket.setInterface
+ * @library /test/lib
+ * @build jdk.test.lib.NetworkConfiguration
+ *        jdk.test.lib.Platform
+ * @run main TestInterfaces
  */
+import jdk.test.lib.NetworkConfiguration;
+
 import java.net.*;
 import java.util.Arrays;
 import java.util.Collections;
@@ -52,6 +57,10 @@
             if (isWindows && dName != null && dName.contains("Teredo"))
                 continue;
 
+            // Skip those interfaces not up or not support multicast
+            if (!ni.isUp() || !ni.supportsMulticast())
+                continue;
+
             /*
              * Test MulticastSocket.getInterface
              */
@@ -115,6 +124,8 @@
         }
 
         if (failures > 0) {
+            System.err.println("********************************");
+            NetworkConfiguration.printSystemConfiguration(System.err);
             System.out.println("********************************");
             throw new Exception(failures + " test(s) failed!!!");
         }
--- a/jdk/test/java/net/httpclient/whitebox/Driver.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/net/httpclient/whitebox/Driver.java	Sat Sep 09 14:36:45 2017 +0200
@@ -23,9 +23,10 @@
 
 /*
  * @test
- * @bug 8151299 8164704
- * @modules jdk.incubator.httpclient
+ * @bug 8151299 8164704 8187044
+ * @modules jdk.incubator.httpclient java.management
  * @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
+ * @run main/othervm --add-reads jdk.incubator.httpclient=java.management jdk.incubator.httpclient/jdk.incubator.http.ConnectionPoolTest
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/ConnectionPoolTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,252 @@
+/*
+ * 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 java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.net.Authenticator;
+import java.net.CookieManager;
+import java.net.InetSocketAddress;
+import java.net.ProxySelector;
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executor;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLParameters;
+import jdk.incubator.http.internal.common.ByteBufferReference;
+
+/**
+ * @summary Verifies that the ConnectionPool won't prevent an HttpClient
+ *          from being GC'ed. Verifies that the ConnectionPool has at most
+ *          one CacheCleaner thread running.
+ * @bug 8187044
+ * @author danielfuchs
+ */
+public class ConnectionPoolTest {
+
+    static long getActiveCleaners() throws ClassNotFoundException {
+        // ConnectionPool.ACTIVE_CLEANER_COUNTER.get()
+        // ConnectionPoolTest.class.getModule().addReads(
+        //      Class.forName("java.lang.management.ManagementFactory").getModule());
+        return java.util.stream.Stream.of(ManagementFactory.getThreadMXBean()
+                .dumpAllThreads(false, false))
+              .filter(t -> t.getThreadName().startsWith("HTTP-Cache-cleaner"))
+              .count();
+    }
+
+    public static void main(String[] args) throws Exception {
+        testCacheCleaners();
+    }
+
+    public static void testCacheCleaners() throws Exception {
+        ConnectionPool pool = new ConnectionPool();
+        HttpClient client = new HttpClientStub(pool);
+        InetSocketAddress proxy = InetSocketAddress.createUnresolved("bar", 80);
+        System.out.println("Adding 10 connections to pool");
+        for (int i=0; i<10; i++) {
+            InetSocketAddress addr = InetSocketAddress.createUnresolved("foo"+i, 80);
+            HttpConnection c1 = new HttpConnectionStub(client, addr, proxy, true);
+            pool.returnToPool(c1);
+        }
+        while (getActiveCleaners() == 0) {
+            System.out.println("Waiting for cleaner to start");
+            Thread.sleep(10);
+        }
+        System.out.println("Active CacheCleaners: " + getActiveCleaners());
+        if (getActiveCleaners() > 1) {
+            throw new RuntimeException("Too many CacheCleaner active: "
+                    + getActiveCleaners());
+        }
+        System.out.println("Removing 9 connections from pool");
+        for (int i=0; i<9; i++) {
+            InetSocketAddress addr = InetSocketAddress.createUnresolved("foo"+i, 80);
+            HttpConnection c2 = pool.getConnection(true, addr, proxy);
+            if (c2 == null) {
+                throw new RuntimeException("connection not found for " + addr);
+            }
+        }
+        System.out.println("Active CacheCleaners: " + getActiveCleaners());
+        if (getActiveCleaners() != 1) {
+            throw new RuntimeException("Wrong number of CacheCleaner active: "
+                    + getActiveCleaners());
+        }
+        System.out.println("Removing last connection from pool");
+        for (int i=9; i<10; i++) {
+            InetSocketAddress addr = InetSocketAddress.createUnresolved("foo"+i, 80);
+            HttpConnection c2 = pool.getConnection(true, addr, proxy);
+            if (c2 == null) {
+                throw new RuntimeException("connection not found for " + addr);
+            }
+        }
+        System.out.println("Active CacheCleaners: " + getActiveCleaners()
+                + " (may be 0 or may still be 1)");
+        if (getActiveCleaners() > 1) {
+            throw new RuntimeException("Too many CacheCleaner active: "
+                    + getActiveCleaners());
+        }
+        InetSocketAddress addr = InetSocketAddress.createUnresolved("foo", 80);
+        HttpConnection c = new HttpConnectionStub(client, addr, proxy, true);
+        System.out.println("Adding/Removing one connection from pool 20 times in a loop");
+        for (int i=0; i<20; i++) {
+            pool.returnToPool(c);
+            HttpConnection c2 = pool.getConnection(true, addr, proxy);
+            if (c2 == null) {
+                throw new RuntimeException("connection not found for " + addr);
+            }
+            if (c2 != c) {
+                throw new RuntimeException("wrong connection found for " + addr);
+            }
+        }
+        if (getActiveCleaners() > 1) {
+            throw new RuntimeException("Too many CacheCleaner active: "
+                    + getActiveCleaners());
+        }
+        ReferenceQueue<HttpClient> queue = new ReferenceQueue<>();
+        WeakReference<HttpClient> weak = new WeakReference<>(client, queue);
+        System.gc();
+        Reference.reachabilityFence(pool);
+        client = null; pool = null; c = null;
+        while (true) {
+            long cleaners = getActiveCleaners();
+            System.out.println("Waiting for GC to release stub HttpClient;"
+                    + " active cache cleaners: " + cleaners);
+            System.gc();
+            Reference<?> ref = queue.remove(1000);
+            if (ref == weak) {
+                System.out.println("Stub HttpClient GC'ed");
+                break;
+            }
+        }
+        while (getActiveCleaners() > 0) {
+            System.out.println("Waiting for CacheCleaner to stop");
+            Thread.sleep(1000);
+        }
+        System.out.println("Active CacheCleaners: "
+                + getActiveCleaners());
+
+        if (getActiveCleaners() > 0) {
+            throw new RuntimeException("Too many CacheCleaner active: "
+                    + getActiveCleaners());
+        }
+    }
+    static <T> T error() {
+        throw new InternalError("Should not reach here: wrong test assumptions!");
+    }
+
+    // Emulates an HttpConnection that has a strong reference to its HttpClient.
+    static class HttpConnectionStub extends HttpConnection {
+
+        public HttpConnectionStub(HttpClient client,
+                InetSocketAddress address,
+                InetSocketAddress proxy,
+                boolean secured) {
+            super(address, null);
+            this.key = ConnectionPool.cacheKey(address, proxy);
+            this.address = address;
+            this.proxy = proxy;
+            this.secured = secured;
+            this.client = client;
+        }
+
+        InetSocketAddress proxy;
+        InetSocketAddress address;
+        boolean secured;
+        ConnectionPool.CacheKey key;
+        HttpClient client;
+
+        // All these return something
+        @Override boolean connected() {return true;}
+        @Override boolean isSecure() {return secured;}
+        @Override boolean isProxied() {return proxy!=null;}
+        @Override ConnectionPool.CacheKey cacheKey() {return key;}
+        @Override public void close() {}
+        @Override void shutdownInput() throws IOException {}
+        @Override void shutdownOutput() throws IOException {}
+        public String toString() {
+            return "HttpConnectionStub: " + address + " proxy: " + proxy;
+        }
+
+        // All these throw errors
+        @Override
+        public void connect() throws IOException, InterruptedException {error();}
+        @Override public CompletableFuture<Void> connectAsync() {return error();}
+        @Override SocketChannel channel() {return error();}
+        @Override void flushAsync() throws IOException {error();}
+        @Override
+        protected ByteBuffer readImpl() throws IOException {return error();}
+        @Override CompletableFuture<Void> whenReceivingResponse() {return error();}
+        @Override
+        long write(ByteBuffer[] buffers, int start, int number) throws IOException {
+            throw (Error)error();
+        }
+        @Override
+        long write(ByteBuffer buffer) throws IOException {throw (Error)error();}
+        @Override
+        void writeAsync(ByteBufferReference[] buffers) throws IOException {
+            error();
+        }
+        @Override
+        void writeAsyncUnordered(ByteBufferReference[] buffers)
+                throws IOException {
+            error();
+        }
+    }
+    // Emulates an HttpClient that has a strong reference to its connection pool.
+    static class HttpClientStub extends HttpClient {
+        public HttpClientStub(ConnectionPool pool) {
+            this.pool = pool;
+        }
+        final ConnectionPool pool;
+        @Override public Optional<CookieManager> cookieManager() {return error();}
+        @Override public HttpClient.Redirect followRedirects() {return error();}
+        @Override public Optional<ProxySelector> proxy() {return error();}
+        @Override public SSLContext sslContext() {return error();}
+        @Override public Optional<SSLParameters> sslParameters() {return error();}
+        @Override public Optional<Authenticator> authenticator() {return error();}
+        @Override public HttpClient.Version version() {return HttpClient.Version.HTTP_1_1;}
+        @Override public Executor executor() {return error();}
+        @Override
+        public <T> HttpResponse<T> send(HttpRequest req,
+                HttpResponse.BodyHandler<T> responseBodyHandler)
+                throws IOException, InterruptedException {
+            return error();
+        }
+        @Override
+        public <T> CompletableFuture<HttpResponse<T>> sendAsync(HttpRequest req,
+                HttpResponse.BodyHandler<T> responseBodyHandler) {
+            return error();
+        }
+        @Override
+        public <U, T> CompletableFuture<U> sendAsync(HttpRequest req,
+                HttpResponse.MultiProcessor<U, T> multiProcessor) {
+            return error();
+        }
+    }
+
+}
--- a/jdk/test/java/nio/charset/Charset/CharsetContainmentTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/nio/charset/Charset/CharsetContainmentTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -32,9 +32,9 @@
 public class CharsetContainmentTest {
     static String[] encodings =
         { "US-ASCII", "UTF-16", "UTF-16BE", "UTF-16LE", "UTF-8",
-          "windows-1252", "ISO-8859-1", "ISO-8859-15", "ISO-8859-2",
-          "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6",
-          "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-13",
+          "windows-1252", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3",
+          "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7",
+          "ISO-8859-8", "ISO-8859-9", "ISO-8859-13", "ISO-8859-15", "ISO-8859-16",
           "ISO-2022-JP", "ISO-2022-KR",
 
           // Temporarily remove ISO-2022-CN-* charsets until full encoder/decoder
@@ -57,7 +57,6 @@
            encodings,
           {"US-ASCII", "windows-1252"},
           {"US-ASCII", "ISO-8859-1"},
-          {"US-ASCII", "ISO-8859-15"},
           {"US-ASCII", "ISO-8859-2"},
           {"US-ASCII", "ISO-8859-3"},
           {"US-ASCII", "ISO-8859-4"},
@@ -67,6 +66,8 @@
           {"US-ASCII", "ISO-8859-8"},
           {"US-ASCII", "ISO-8859-9"},
           {"US-ASCII", "ISO-8859-13"},
+          {"US-ASCII", "ISO-8859-15"},
+          {"US-ASCII", "ISO-8859-16"},
           {"ISO-2022-JP"},
           {"ISO-2022-KR"},
           // Temporarily remove ISO-2022-CN-* charsets until full encoder/decoder
--- a/jdk/test/java/nio/charset/Charset/RegisteredCharsets.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/java/nio/charset/Charset/RegisteredCharsets.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /* @test
  * @bug 4473201 4696726 4652234 4482298 4784385 4966197 4267354 5015668
-        6911753 8071447
+        6911753 8071447 8186751
  * @summary Check that registered charsets are actually registered
  * @modules jdk.charsets
  */
@@ -42,7 +42,8 @@
                             "ISO-8859-1", "ISO-8859-2", "ISO-8859-3",
                             "ISO-8859-4", "ISO-8859-5", "ISO-8859-6",
                             "ISO-8859-7", "ISO-8859-8", "ISO-8859-9",
-                            "ISO-8859-13", "ISO-8859-15", "windows-1251",
+                            "ISO-8859-13", "ISO-8859-15", "ISO-8859-16",
+                            "windows-1251",
                             "windows-1252", "windows-1253", "windows-1254",
                             "windows-1255", "windows-1256", "windows-31j",
                             "Shift_JIS", "JIS_X0201", "JIS_X0212-1990",
@@ -416,6 +417,8 @@
                 new String[] {
                     // IANA alias
                     "ISO_8859-15",
+                    "Latin-9",
+                    "csISO885915",
                     // JDK historical aliases
                     "8859_15",
                     "ISO-8859-15",
@@ -432,8 +435,17 @@
                     "csISOlatin0",
                     "csISOlatin9",
                     "ISO8859_15_FDIS"
+                });
 
-                });
+        aliasCheck("ISO-8859-16",
+                new String[] {
+                    "iso-ir-226",
+                    "ISO_8859-16:2001",
+                    "ISO_8859-16",
+                    "latin10",
+                    "l10",
+                    "csISO885916"
+                   });
 
         aliasCheck("JIS_X0212-1990",
                 new String[] {
--- a/jdk/test/javax/accessibility/JList/AccessibleJListChildNPETest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/accessibility/JList/AccessibleJListChildNPETest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -35,6 +35,7 @@
 import javax.swing.WindowConstants;
 
 /* @test
+   @key headful
    @bug 8076249
    @summary  NPE in AccessBridge while editing JList model
    @author Mikhail Cherkasov
--- a/jdk/test/javax/imageio/AllowSearch.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/imageio/AllowSearch.java	Sat Sep 09 14:36:45 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4420318
+ * @bug 4420318 8183341
  * @summary Checks that an IllegalStateException is thrown by getNumImages(true)
  *          when seekForwardOnly is true
  * @modules java.desktop/com.sun.imageio.plugins.gif
@@ -33,6 +33,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
 
 import javax.imageio.ImageIO;
 import javax.imageio.ImageReader;
@@ -43,20 +44,33 @@
 import com.sun.imageio.plugins.png.PNGImageReader;
 
 public class AllowSearch {
-
     private static void test(ImageReader reader, String format)
         throws IOException {
-        File f = File.createTempFile("imageio", ".tmp");
-        ImageInputStream stream = ImageIO.createImageInputStream(f);
-        reader.setInput(stream, true);
-
         boolean gotISE = false;
+        File f = null;
+        ImageInputStream stream = null;
         try {
-            int numImages = reader.getNumImages(true);
-        } catch (IOException ioe) {
-            gotISE = false;
-        } catch (IllegalStateException ise) {
-            gotISE = true;
+            f = File.createTempFile("imageio", ".tmp");
+            stream = ImageIO.createImageInputStream(f);
+            reader.setInput(stream, true);
+
+            try {
+                int numImages = reader.getNumImages(true);
+            } catch (IOException ioe) {
+                gotISE = false;
+            } catch (IllegalStateException ise) {
+                gotISE = true;
+            }
+        } finally {
+            if (stream != null) {
+                stream.close();
+            }
+
+            reader.dispose();
+
+            if (f != null) {
+                Files.delete(f.toPath());
+            }
         }
 
         if (!gotISE) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/png/PngCreationTimeTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,416 @@
+/*
+ * 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 8164971 8187113
+ * @summary The test decodes a png file and checks if the metadata contains
+ *          image creation time. In addition, the test also merges the custom
+ *          metadata tree (both standard and native) and succeeds when the
+ *          metadata contains expected image creation time.
+ * @run main PngCreationTimeTest
+ */
+import java.io.IOException;
+import java.io.File;
+import java.nio.file.Files;
+import java.util.Iterator;
+import java.awt.Graphics2D;
+import java.awt.Color;
+import java.awt.image.BufferedImage;
+import javax.imageio.ImageIO;
+import javax.imageio.IIOImage;
+import javax.imageio.ImageTypeSpecifier;
+import javax.imageio.stream.ImageInputStream;
+import javax.imageio.stream.ImageOutputStream;
+import javax.imageio.ImageReadParam;
+import javax.imageio.ImageReader;
+import javax.imageio.ImageWriter;
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.metadata.IIOMetadataNode;
+import org.w3c.dom.Node;
+import org.w3c.dom.NamedNodeMap;
+
+public class PngCreationTimeTest {
+    // Members
+    private static IIOMetadata pngMetadata = null;
+
+    public static void initializeTest() throws IOException {
+        Iterator<ImageReader> iterR = null;
+        ImageReader pngImageReader = null;
+        BufferedImage decImage = null;
+        ImageInputStream imageStream = null;
+        String fileName = "duke.png";
+        String separator = System.getProperty("file.separator");
+        String dirPath = System.getProperty("test.src", ".");
+        String filePath = dirPath + separator + fileName;
+        File file = null;
+
+        try {
+            // Open the required file and check if file exists.
+            file = new File(filePath);
+            if (file != null && !file.exists()) {
+                reportExceptionAndFail("Test Failed. Required image file was"
+                        + " not found.");
+            }
+
+            // Get PNG image reader
+            iterR = ImageIO.getImageReadersBySuffix("PNG");
+            if (iterR.hasNext()) {
+                pngImageReader = iterR.next();
+                ImageReadParam param = pngImageReader.getDefaultReadParam();
+                imageStream = ImageIO.createImageInputStream(file);
+                if (imageStream != null) {
+                    // Last argument informs reader not to ignore metadata
+                    pngImageReader.setInput(imageStream,
+                                            false,
+                                            false);
+                    decImage = pngImageReader.read(0, param);
+                    pngMetadata = pngImageReader.getImageMetadata(0);
+                    if (pngMetadata != null) {
+                        // Check if the metadata contains creation time
+                        testImageMetadata(pngMetadata);
+                    } else {
+                        reportExceptionAndFail("Test Failed. Reader could not"
+                                + " generate image metadata.");
+                    }
+                } else {
+                    reportExceptionAndFail("Test Failed. Could not initialize"
+                            + " image input stream.");
+                }
+            } else {
+                reportExceptionAndFail("Test Failed. Required image reader"
+                        + " was not found.");
+            }
+        } finally {
+            // Release ther resources
+            if (imageStream != null) {
+                imageStream.close();
+            }
+            if (pngImageReader != null) {
+                pngImageReader.dispose();
+            }
+        }
+    }
+
+    public static void testImageMetadata(IIOMetadata metadata) {
+        /*
+         * The source file contains Creation Time in its text chunk. Upon
+         * successful decoding, the Standard/Document/ImageCreationTime
+         * should exist in the metadata.
+         */
+        if (metadata != null) {
+            Node keyNode = findNode(metadata.getAsTree("javax_imageio_1.0"),
+                    "ImageCreationTime");
+            if (keyNode == null) {
+                reportExceptionAndFail("Test Failed: Could not find image"
+                        + " creation time in the metadata.");
+            }
+        }
+    }
+
+    public static void testSaveCreationTime() throws IOException {
+        File file = null;
+        Iterator<ImageWriter> iterW = null;
+        Iterator<ImageReader> iterR = null;
+        ImageWriter pngImageWriter = null;
+        ImageReader pngImageReader = null;
+        ImageInputStream inputStream = null;
+        ImageOutputStream outputStream = null;
+        try {
+            // Create a simple image and fill with a color
+            int imageSize = 200;
+            BufferedImage buffImage = new BufferedImage(imageSize, imageSize,
+                    BufferedImage.TYPE_INT_ARGB);
+            Graphics2D g2d = buffImage.createGraphics();
+            g2d.setColor(Color.red);
+            g2d.fillRect(0, 0, imageSize, imageSize);
+
+            // Create a temporary file for the output png image
+            String fileName = "RoundTripTest";
+            file = File.createTempFile(fileName, ".png");
+            if (file == null) {
+                reportExceptionAndFail("Test Failed. Could not create a"
+                        + " temporary file for round trip test.");
+            }
+
+            // Create a PNG writer and write test image with metadata
+            iterW = ImageIO.getImageWritersBySuffix("PNG");
+            if (iterW.hasNext()) {
+                pngImageWriter = iterW.next();
+                outputStream = ImageIO.createImageOutputStream(file);
+                if (outputStream != null) {
+                    pngImageWriter.setOutput(outputStream);
+
+                    // Get the default metadata & add image creation time to it.
+                    ImageTypeSpecifier imgType =
+                            ImageTypeSpecifier.createFromRenderedImage(buffImage);
+                    IIOMetadata metadata =
+                            pngImageWriter.getDefaultImageMetadata(imgType, null);
+                    IIOMetadataNode root = createStandardMetadataNodeTree();
+                    metadata.mergeTree("javax_imageio_1.0", root);
+
+                    // Write a png image using buffImage & metadata
+                    IIOImage iioImage = new IIOImage(buffImage, null, metadata);
+                    pngImageWriter.write(iioImage);
+                } else {
+                    reportExceptionAndFail("Test Failed. Could not initialize"
+                            + " image output stream for round trip test.");
+                }
+            } else {
+                reportExceptionAndFail("Test Failed. Could not find required"
+                        + " image writer for the round trip test.");
+            }
+
+            // Create a PNG reader and check if metadata was written
+            iterR = ImageIO.getImageReadersBySuffix("PNG");
+            if (iterR.hasNext()) {
+                pngImageReader = iterR.next();
+                inputStream = ImageIO.createImageInputStream(file);
+                if (inputStream != null) {
+                    // Read the image and get the metadata
+                    pngImageReader.setInput(inputStream, false, false);
+                    pngImageReader.read(0);
+                    IIOMetadata imgMetadata =
+                            pngImageReader.getImageMetadata(0);
+
+                    // Test if the metadata contains creation time.
+                    testImageMetadata(imgMetadata);
+                } else {
+                    reportExceptionAndFail("Test Failed. Could not initialize"
+                            + " image input stream for round trip test.");
+                }
+            } else {
+                reportExceptionAndFail("Test Failed. Cound not find the"
+                        + " required image reader.");
+            }
+        } finally {
+            // Release the resources held
+            if (inputStream != null) {
+                inputStream.close();
+            }
+            if (outputStream != null) {
+                outputStream.close();
+            }
+            if (pngImageWriter != null) {
+                pngImageWriter.dispose();
+            }
+            if (pngImageReader != null) {
+                pngImageReader.dispose();
+            }
+            // Delete the temp file as well
+            if (file != null) {
+                Files.delete(file.toPath());
+            }
+        }
+    }
+
+    public static void reportExceptionAndFail(String message) {
+        // A common method to report exception.
+        throw new RuntimeException(message);
+    }
+
+    public static void testMergeNativeTree() {
+        // Merge a custom native metadata tree and inspect creation time
+        if (pngMetadata != null) {
+            try {
+                IIOMetadataNode root = createNativeMetadataNodeTree();
+
+                /*
+                 * Merge the native metadata tree created. The data should
+                 * reflect in Standard/Document/ImageCreationTime Node
+                 */
+                pngMetadata.mergeTree("javax_imageio_png_1.0", root);
+                Node keyNode = findNode(pngMetadata.getAsTree("javax_imageio_1.0"),
+                        "ImageCreationTime");
+                if (keyNode != null) {
+                    // Query the attributes of the node and check for the value
+                    NamedNodeMap attrMap = keyNode.getAttributes();
+                    String attrValue = attrMap.getNamedItem("year")
+                                              .getNodeValue();
+                    int decYear = Integer.parseInt(attrValue);
+                    if (decYear != 2014) {
+                        // Throw exception. Incorrect year value observed
+                        reportExceptionAndFail("Test Failed: Incorrect"
+                                + " creation time value observed.");
+                    }
+                } else {
+                    // Throw exception.
+                    reportExceptionAndFail("Test Failed: Image creation"
+                            + " time doesn't exist in metadata.");
+                }
+            } catch (IOException ex) {
+                // Throw exception.
+                reportExceptionAndFail("Test Failed: While executing"
+                        + " mergeTree on metadata.");
+            }
+        }
+    }
+
+    public static void testMergeStandardTree() {
+        // Merge a standard metadata tree and inspect creation time
+        if (pngMetadata != null) {
+            try {
+                IIOMetadataNode root = createStandardMetadataNodeTree();
+
+                /*
+                 * Merge the standard metadata tree created. The data should
+                 * correctly reflect in the native tree
+                 */
+                pngMetadata.mergeTree("javax_imageio_1.0", root);
+                Node keyNode = findNode(pngMetadata.getAsTree("javax_imageio_png_1.0"),
+                        "tEXtEntry");
+                // Last text entry would contain the merged information
+                while (keyNode != null && keyNode.getNextSibling() != null) {
+                    keyNode = keyNode.getNextSibling();
+                }
+
+                if (keyNode != null) {
+                    // Query the attributes of the node and check for the value
+                    NamedNodeMap attrMap = keyNode.getAttributes();
+                    String attrValue = attrMap.getNamedItem("value")
+                                              .getNodeValue();
+                    if (!attrValue.contains("2016")) {
+                        // Throw exception. Incorrect year value observed
+                        throw new RuntimeException("Test Failed: Incorrect"
+                                + " creation time value observed.");
+                    }
+                } else {
+                    // Throw exception.
+                    reportExceptionAndFail("Test Failed: Image creation"
+                            + " time doesn't exist in metadata.");
+                }
+            } catch (IOException ex) {
+                // Throw exception.
+                reportExceptionAndFail("Test Failed: While executing"
+                        + " mergeTree on metadata.");
+            }
+        }
+    }
+
+    public static IIOMetadataNode createNativeMetadataNodeTree() {
+        // Create a text node to hold tEXtEntries
+        IIOMetadataNode tEXtNode = new IIOMetadataNode("tEXt");
+
+        // Create tEXt entry to hold random date time
+        IIOMetadataNode randomTimeEntry = new IIOMetadataNode("tEXtEntry");
+        randomTimeEntry.setAttribute("keyword", "Creation Time");
+        randomTimeEntry.setAttribute("value", "21 Dec 2015,Monday");
+        tEXtNode.appendChild(randomTimeEntry);
+
+        // Create a tEXt entry to hold time in RFC1123 format
+        IIOMetadataNode rfcTextEntry = new IIOMetadataNode("tEXtEntry");
+        rfcTextEntry.setAttribute("keyword", "Creation Time");
+        rfcTextEntry.setAttribute("value", "Mon, 21 Dec 2015 09:04:30 +0530");
+        tEXtNode.appendChild(rfcTextEntry);
+
+        // Create a tEXt entry to hold time in ISO format
+        IIOMetadataNode isoTextEntry = new IIOMetadataNode("tEXtEntry");
+        isoTextEntry.setAttribute("keyword", "Creation Time");
+        isoTextEntry.setAttribute("value", "2014-12-21T09:04:30+05:30");
+        tEXtNode.appendChild(isoTextEntry);
+
+        // Create a root node append the text node
+        IIOMetadataNode root = new IIOMetadataNode("javax_imageio_png_1.0");
+        root.appendChild(tEXtNode);
+
+        return root;
+    }
+
+    public static IIOMetadataNode createStandardMetadataNodeTree() {
+        /*
+         * Create standard metadata tree with creation time in
+         * Standard(Root)/Document/ImageCreationTime node
+         */
+        IIOMetadataNode createTimeNode = new IIOMetadataNode("ImageCreationTime");
+        createTimeNode.setAttribute("year", "2016");
+        createTimeNode.setAttribute("month", "12");
+        createTimeNode.setAttribute("day", "21");
+        createTimeNode.setAttribute("hour", "18");
+        createTimeNode.setAttribute("minute", "30");
+        createTimeNode.setAttribute("second", "00");
+
+        // Create the Document node
+        IIOMetadataNode documentNode = new IIOMetadataNode("Document");
+        documentNode.appendChild(createTimeNode);
+
+        // Create a root node append the Document node
+        IIOMetadataNode root = new IIOMetadataNode("javax_imageio_1.0");
+        root.appendChild(documentNode);
+
+        return root;
+    }
+
+    public static Node findNode(Node root, String nodeName) {
+        // Return value
+        Node retVal = null;
+
+        if (root != null ) {
+            // Check if the name of root node matches the key
+            String name = root.getNodeName();
+            if (name.equalsIgnoreCase(nodeName)) {
+                return root;
+            }
+
+            // Process all children
+            Node node = root.getFirstChild();
+            while (node != null) {
+                retVal = findNode(node, nodeName);
+                if (retVal != null ) {
+                    // We found the node. Stop the search
+                    break;
+                }
+                node = node.getNextSibling();
+            }
+       }
+
+        return retVal;
+    }
+
+    public static void main(String[] args) throws IOException {
+        /*
+         * Initialize the test by decoding a PNG image that has creation
+         * time in one of its text chunks and check if the metadata returned
+         * contains image creation time.
+         */
+        initializeTest();
+
+        /*
+         * Test the round trip usecase. Write a PNG file with "Creation Time"
+         * in text chunk and decode the same to check if the creation time
+         * was indeed written to the PNG file.
+         */
+        testSaveCreationTime();
+
+        /*
+         * Modify the metadata by merging a standard metadata tree and inspect
+         * the value in the native tree
+         */
+        testMergeNativeTree();
+
+        /*
+         * Modify the metadata by merging a native metadata tree and inspect
+         * the value in the standard tree.
+         */
+        testMergeStandardTree();
+    }
+}
Binary file jdk/test/javax/imageio/plugins/png/duke.png has changed
--- a/jdk/test/javax/imageio/plugins/shared/CanWriteSequence.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/imageio/plugins/shared/CanWriteSequence.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.nio.file.Files;
 import java.util.Iterator;
 
 import javax.imageio.ImageIO;
@@ -34,11 +35,18 @@
 
 /**
  * @test
- * @bug 4958064
- * @author Sergey Bylokhov
+ * @bug     4958064 8183349
+ * @summary Test verifies that when we try to forcefully run
+ *          prepareWriteSequence() where it is not supported
+ *          will ImageIO throws an UnsupportedOperationException
+ *          or not.
+ * @run     main CanWriteSequence
  */
 public final class CanWriteSequence {
 
+    private static File file;
+    private static FileOutputStream fos;
+
     public static void main(final String[] args) throws Exception {
         final IIORegistry registry = IIORegistry.getDefaultInstance();
         final Iterator<ImageWriterSpi> iter =
@@ -54,25 +62,33 @@
     }
 
     private static void test(final ImageWriter writer) throws Exception {
-        final File file = File.createTempFile("temp", ".img");
-        file.deleteOnExit();
-        final FileOutputStream fos = new FileOutputStream(file);
-        final ImageOutputStream ios = ImageIO.createImageOutputStream(fos);
-        writer.setOutput(ios);
-        final IIOMetadata data = writer.getDefaultStreamMetadata(null);
+        try {
+            file = File.createTempFile("temp", ".img");
+            fos = new FileOutputStream(file);
+            final ImageOutputStream ios = ImageIO.createImageOutputStream(fos);
+            writer.setOutput(ios);
+            final IIOMetadata data = writer.getDefaultStreamMetadata(null);
 
-        if (writer.canWriteSequence()) {
-            writer.prepareWriteSequence(data);
-        } else {
-            try {
+            if (writer.canWriteSequence()) {
                 writer.prepareWriteSequence(data);
-                throw new RuntimeException(
-                        "UnsupportedOperationException was not thrown");
-            } catch (final UnsupportedOperationException ignored) {
+            } else {
+                try {
+                    writer.prepareWriteSequence(data);
+                    throw new RuntimeException(
+                            "UnsupportedOperationException was not thrown");
+                } catch (final UnsupportedOperationException ignored) {
                 // expected
+                }
+            }
+        } finally {
+            writer.dispose();
+            if (file != null) {
+                if (fos != null) {
+                    fos.close();
+                }
+                Files.delete(file.toPath());
             }
         }
-        writer.dispose();
-        ios.close();
     }
 }
+
--- a/jdk/test/javax/imageio/plugins/shared/WriteAfterAbort.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/imageio/plugins/shared/WriteAfterAbort.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -29,6 +29,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.Iterator;
+import java.nio.file.Files;
 
 import javax.imageio.ImageIO;
 import javax.imageio.ImageWriter;
@@ -41,9 +42,9 @@
 
 /**
  * @test
- * @bug 4952954
+ * @bug     4952954 8183349
  * @summary abortFlag must be cleared for every ImageWriter.write operation
- * @author Sergey Bylokhov
+ * @run     main WriteAfterAbort
  */
 public final class WriteAfterAbort implements IIOWriteProgressListener {
 
@@ -54,73 +55,85 @@
     private volatile boolean isStartedCalled;
     private static final int WIDTH = 100;
     private static final int HEIGHT = 100;
+    private static FileOutputStream fos;
+    private static File file;
 
     private void test(final ImageWriter writer) throws IOException {
-        // Image initialization
-        final BufferedImage imageWrite = new BufferedImage(WIDTH, HEIGHT,
-                                                           TYPE_BYTE_BINARY);
-        final Graphics2D g = imageWrite.createGraphics();
-        g.setColor(Color.WHITE);
-        g.fillRect(0, 0, WIDTH, HEIGHT);
-        g.dispose();
+        try {
+            // Image initialization
+            final BufferedImage imageWrite =
+                    new BufferedImage(WIDTH, HEIGHT, TYPE_BYTE_BINARY);
+            final Graphics2D g = imageWrite.createGraphics();
+            g.setColor(Color.WHITE);
+            g.fillRect(0, 0, WIDTH, HEIGHT);
+            g.dispose();
+
+            // File initialization
+            file = File.createTempFile("temp", ".img");
+            fos = new SkipWriteOnAbortOutputStream(file);
+            final ImageOutputStream ios = ImageIO.createImageOutputStream(fos);
+            writer.setOutput(ios);
+            writer.addIIOWriteProgressListener(this);
 
-        // File initialization
-        final File file = File.createTempFile("temp", ".img");
-        file.deleteOnExit();
-        final FileOutputStream fos = new SkipWriteOnAbortOutputStream(file);
-        final ImageOutputStream ios = ImageIO.createImageOutputStream(fos);
-        writer.setOutput(ios);
-        writer.addIIOWriteProgressListener(this);
+            // This write will be aborted, and file will not be touched
+            writer.write(imageWrite);
+            if (!isStartedCalled) {
+                throw new RuntimeException("Started should be called");
+            }
+            if (!isProgressCalled) {
+                throw new RuntimeException("Progress should be called");
+            }
+            if (!isAbortCalled) {
+                throw new RuntimeException("Abort should be called");
+            }
+            if (isCompleteCalled) {
+                throw new RuntimeException("Complete should not be called");
+            }
+            // Flush aborted data
+            ios.flush();
 
-        // This write will be aborted, and file will not be touched
-        writer.write(imageWrite);
-        if (!isStartedCalled) {
-            throw new RuntimeException("Started should be called");
-        }
-        if (!isProgressCalled) {
-            throw new RuntimeException("Progress should be called");
-        }
-        if (!isAbortCalled) {
-            throw new RuntimeException("Abort should be called");
-        }
-        if (isCompleteCalled) {
-            throw new RuntimeException("Complete should not be called");
-        }
-        // Flush aborted data
-        ios.flush();
+            /*
+             * This write should be completed successfully and the file should
+             * contain correct image data.
+             */
+            abortFlag = false;
+            isAbortCalled = false;
+            isCompleteCalled = false;
+            isProgressCalled = false;
+            isStartedCalled = false;
+            writer.write(imageWrite);
 
-        // This write should be completed successfully and the file should
-        // contain correct image data.
-        abortFlag = false;
-        isAbortCalled = false;
-        isCompleteCalled = false;
-        isProgressCalled = false;
-        isStartedCalled = false;
-        writer.write(imageWrite);
+            if (!isStartedCalled) {
+                throw new RuntimeException("Started should be called");
+            }
+            if (!isProgressCalled) {
+                throw new RuntimeException("Progress should be called");
+            }
+            if (isAbortCalled) {
+                throw new RuntimeException("Abort should not be called");
+            }
+            if (!isCompleteCalled) {
+                throw new RuntimeException("Complete should be called");
+            }
+            ios.close();
 
-        if (!isStartedCalled) {
-            throw new RuntimeException("Started should be called");
-        }
-        if (!isProgressCalled) {
-            throw new RuntimeException("Progress should be called");
-        }
-        if (isAbortCalled) {
-            throw new RuntimeException("Abort should not be called");
-        }
-        if (!isCompleteCalled) {
-            throw new RuntimeException("Complete should be called");
-        }
-        writer.dispose();
-        ios.close();
-
-        // Validates content of the file.
-        final BufferedImage imageRead = ImageIO.read(file);
-        for (int x = 0; x < WIDTH; ++x) {
-            for (int y = 0; y < HEIGHT; ++y) {
-                if (imageRead.getRGB(x, y) != imageWrite.getRGB(x, y)) {
-                    throw new RuntimeException("Test failed.");
+            // Validates content of the file.
+            final BufferedImage imageRead = ImageIO.read(file);
+            for (int x = 0; x < WIDTH; ++x) {
+                for (int y = 0; y < HEIGHT; ++y) {
+                    if (imageRead.getRGB(x, y) != imageWrite.getRGB(x, y)) {
+                        throw new RuntimeException("Test failed.");
+                    }
                 }
             }
+        } finally {
+            writer.dispose();
+            if (file != null) {
+                if (fos != null) {
+                    fos.close();
+                }
+                Files.delete(file.toPath());
+            }
         }
     }
 
--- a/jdk/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh	Sat Sep 09 14:36:45 2017 +0200
@@ -22,7 +22,7 @@
 #
 #   @test
 #
-#   @bug        6342404 7078379 8167503
+#   @bug        6342404 7078379 8167503 8183351
 #
 #   @summary    Test verifies that incorrectly configured ImageIO plugin spi
 #               does not affect registration of other ImageIO plugin in the
@@ -57,6 +57,7 @@
  { echo "The test failed :-("
    echo "$*" 1>&2
    echo "exit status was $status"
+   clean
    exit $status
  } #end of fail()
 
@@ -65,9 +66,19 @@
 pass()
  { echo "The test passed!!!"
    echo "$*" 1>&2
+   clean
    exit 0
  } #end of pass()
 
+#Clean up the test_ext directory (PLUGINDST_DIR) before leaving
+clean()
+ {
+ echo "Removing PLUGINDST_DIR ${PLUGINDST_DIR}"
+ if [ -n "${PLUGINDST_DIR}" -a -d "${PLUGINDST_DIR}" ] ; then
+ rm -rf "${PLUGINDST_DIR}"
+ fi
+ }
+
 # end of subroutines
 
 
@@ -169,13 +180,10 @@
 # app have file read permission for all subdirs of the
 # scratch dir
 
-PLUGINDST_DIR=${TMP}/test_ext
-#PLUGINDST_DIR=${TESTJAVA}/lib/ext
-TEST_PLUGIN=dummy.jar
+PLUGINDST_DIR=$(mktemp -d ${TMP}/iio_test.XXXXXXXX)
+echo "Created PLUGINDST_DIR as ${PLUGINDST_DIR}"
 
-if [ ! -d ${PLUGINDST_DIR} ] ; then
-    mkdir ${PLUGINDST_DIR}
-fi
+TEST_PLUGIN=dummy.jar
 
 # remove old service declaration
 if [ -d META-INF ] ; then
--- a/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/sound/sampled/Clip/ClipCloseLoss.java	Sat Sep 09 14:36:45 2017 +0200
@@ -33,10 +33,9 @@
 
 /**
  * @test
- * @bug 4946913
+ * @bug 4946913 8178403
  * @summary DirectClip doesn't kill the thread correctly, sometimes
  * @run main/othervm ClipCloseLoss
- * @key intermittent
  */
 public class ClipCloseLoss {
     static int frameCount = 441000; // lets say 10 seconds
@@ -47,7 +46,7 @@
     static int success = 0;
     static boolean failed = false;
 
-    public static void run(Mixer m) {
+    public static void run(Mixer m, long sleep) {
         Clip clip = null;
         try {
             if (m == null) {
@@ -69,6 +68,8 @@
             clip.open(new AudioInputStream(bais, format, frameCount));
 
             out(" clip.close()");
+            // emulates a different delay between open() and close()
+            Thread.sleep(sleep);
             //long t = System.currentTimeMillis();
             clip.close();
             //if (System.currentTimeMillis() - t > 1950) {
@@ -107,13 +108,15 @@
     public static void main(String[] args) throws Exception    {
         if (isSoundcardInstalled()) {
             bais.mark(0);
-            run(null);
             Mixer.Info[] infos = AudioSystem.getMixerInfo();
-            for (int i = 0; i<infos.length; i++) {
-                try {
-                    Mixer m = AudioSystem.getMixer(infos[i]);
-                    run(m);
-                } catch (Exception e) {
+            for (int sleep = 0; sleep < 100; ++sleep) {
+                run(null, sleep);
+                for (int i = 0; i < infos.length; i++) {
+                    try {
+                        Mixer m = AudioSystem.getMixer(infos[i]);
+                        run(m, sleep);
+                    } catch (Exception e) {
+                    }
                 }
             }
             out("Waiting 1 second to dispose of all threads");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/DefaultButtonModel/DefaultButtonModelCrashTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,85 @@
+/*
+ * 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 8182577
+ * @summary  Verifies if moving focus via custom ButtonModel causes crash
+ * @run main DefaultButtonModelCrashTest
+ */
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+import javax.swing.ButtonModel;
+import javax.swing.DefaultButtonModel;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+
+public class DefaultButtonModelCrashTest {
+    private JFrame frame = null;
+    private JPanel panel;
+    private volatile Point p = null;
+
+    public static void main(String[] args) throws Exception {
+        new DefaultButtonModelCrashTest();
+    }
+
+    public DefaultButtonModelCrashTest() throws Exception {
+        try {
+            Robot robot = new Robot();
+            robot.setAutoDelay(200);
+            SwingUtilities.invokeAndWait(() -> go());
+            robot.waitForIdle();
+            robot.keyPress(KeyEvent.VK_TAB);
+            robot.keyRelease(KeyEvent.VK_TAB);
+            robot.delay(100);
+            robot.keyPress(KeyEvent.VK_TAB);
+            robot.keyRelease(KeyEvent.VK_TAB);
+        } finally {
+            SwingUtilities.invokeAndWait(()->frame  .dispose());
+        }
+    }
+
+    private void go() {
+
+        frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        Container contentPane = frame.getContentPane();
+        ButtonModel model = new DefaultButtonModel();
+
+        JCheckBox check = new JCheckBox("a bit broken");
+        check.setModel(model);
+        panel = new JPanel(new BorderLayout());
+        panel.add(new JTextField("Press Tab (twice?)"), BorderLayout.NORTH);
+        panel.add(check);
+        contentPane.add(panel);
+        frame.setLocationRelativeTo(null);
+        frame.pack();
+        frame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/8182031/ComboPopupTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,99 @@
+/*
+ * 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 8182031
+ * @summary  Verifies if ComboBox Popup opens and closes immediately
+ * @run main ComboPopupTest
+ */
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+public class ComboPopupTest {
+    JFrame frame = null;
+    JComboBox<String> comboBox = null;
+    private volatile Point p = null;
+    private volatile Dimension d = null;
+
+    void blockTillDisplayed(JComponent comp) throws Exception {
+        while (p == null) {
+            try {
+                SwingUtilities.invokeAndWait(() -> {
+                    p = comp.getLocationOnScreen();
+                    d = comboBox.getSize();
+                });
+            } catch (IllegalStateException e) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException ie) {
+                }
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        new ComboPopupTest();
+    }
+
+    public ComboPopupTest() throws Exception {
+        try {
+            Robot robot = new Robot();
+            robot.setAutoDelay(200);
+            SwingUtilities.invokeAndWait(() -> start());
+            blockTillDisplayed(comboBox);
+            robot.waitForIdle();
+            robot.mouseMove(p.x + d.width-1, p.y + d.height/2);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            robot.waitForIdle();
+
+            System.out.println("popmenu visible " + comboBox.isPopupVisible());
+            if (!comboBox.isPopupVisible()) {
+                throw new RuntimeException("combobox popup is not visible");
+            }
+        } finally {
+            SwingUtilities.invokeAndWait(()->frame.dispose());
+        }
+    }
+
+    public void start() {
+        frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        Container contentPane = frame.getContentPane();
+        comboBox = new JComboBox<String>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" });
+        contentPane.setLayout(new FlowLayout());
+        contentPane.add(comboBox);
+        frame.setLocationRelativeTo(null);
+        frame.pack();
+        frame.setVisible(true);
+    }
+}
+
--- a/jdk/test/javax/swing/JFileChooser/6738668/bug6738668.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JFileChooser/6738668/bug6738668.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009,2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,21 +22,25 @@
  */
 
 /* @test
-   @bug 6738668
+   @bug 6738668 6962725
    @summary JFileChooser cannot be created under SecurityManager
    @author Pavel Porvatov
    @run main/othervm/policy=security.policy bug6738668
 */
 
-import javax.swing.*;
 import java.io.File;
+import javax.swing.JFileChooser;
+import javax.swing.UIManager;
 
 public class bug6738668 {
     public static void main(String[] args) throws Exception {
         for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) {
             UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
 
-            new JFileChooser(new File("c:/temp"));
+            String tmpdir = System.getProperty("java.io.tmpdir");
+            System.out.println("tmp dir " + tmpdir);
+            new JFileChooser(new File(tmpdir+"/temp"));
+
 
             System.out.println("Test passed for LookAndFeel " + lookAndFeelInfo.getClassName());
         }
--- a/jdk/test/javax/swing/JFileChooser/6738668/security.policy	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JFileChooser/6738668/security.policy	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 grant {
-    permission java.io.FilePermission "C:\\temp\\*", "read";
-    permission java.io.FilePermission "C:\\temp", "read";
+    permission java.io.FilePermission "${java.io.tmpdir}${/}temp${/}*", "read";
+    permission java.io.FilePermission "${java.io.tmpdir}${/}temp", "read";
     permission java.util.PropertyPermission "*", "read";
 };
--- a/jdk/test/javax/swing/JFileChooser/8067660/FileChooserTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JFileChooser/8067660/FileChooserTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8067660
+ * @bug 8067660 8178106
  * @summary JFileChooser create new folder fails silently
  * @requires (os.family == "windows")
  * @run main/manual FileChooserTest
@@ -52,15 +52,21 @@
             @Override
             public void run() {
                 String[] instructions
-                        = {
-                            "1) Create a folder with read only permissions",
-                            "2) Click on run test button.It will open a open dialog"
-                            + " Navigate to the newly created read only folder",
-                            "3) Click on the create new folder button in open dialog",
-                            "4) If an error message does not pops up"
-                            + "test failed otherwise passed.",
-                            "5) Pressing Pass/Fail button will mark test as "
-                            + "pass/fail and will shutdown JVM"};
+                     = {
+                       "1) Create a folder with read only permissions by "
+                       + "changing security permission through Security tab"
+                       + "under Folder->Properties menu to deny write permission"
+                       + " to the newly created folder",
+                       "2) Click on run test button.It will open a open dialog"
+                       + " Navigate to the newly created read only folder",
+                       "3) Click on the create new folder button in open dialog",
+                       "4) If an error message does not pops up"
+                       + "test failed otherwise passed.",
+                       "5) Pressing Pass/Fail button will mark test as "
+                       + "pass/fail and will shutdown JVM",
+                       "6) Newly created folder permissions can now be restored"
+                       + " back to default",
+                };
 
                 Sysout.createDialogWithInstructions(instructions);
                 Sysout.printInstructions(instructions);
--- a/jdk/test/javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -30,6 +30,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8175301
  * @summary Java GUI hangs on Windows when Display set to 125%
  * @run main/othervm -Dsun.java2d.uiScale=2 ScaledFrameBackgroundTest
--- a/jdk/test/javax/swing/JFrame/AlwaysOnTop/AlwaysOnTopImeTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JFrame/AlwaysOnTop/AlwaysOnTopImeTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -23,6 +23,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8179665
  * @summary [Windows] java.awt.IllegalComponentStateException: component must
  *          be showing on the screen to determine its location
--- a/jdk/test/javax/swing/JLightweightFrame/JLightweightFrameRoundTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JLightweightFrame/JLightweightFrameRoundTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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,6 +23,7 @@
 
 /*
  * @test
+ * @key headful
  * @bug 8170387
  * @summary JLightweightFrame#syncCopyBuffer() may throw IOOBE
  * @modules java.desktop/sun.swing
--- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -24,9 +24,10 @@
 /**
  * @test
  * @key headful
- * @bug 7160951 8152492
+ * @bug 7160951 8152492 8178448
  * @summary [macosx] ActionListener called twice for JMenuItem using ScreenMenuBar
  * @author vera.akulova@oracle.com
+ * @modules java.desktop/java.awt:open
  * @library ../../../../lib/testlibrary
  * @build jdk.testlibrary.OSInfo
  * @run main ActionListenerCalledTwiceTest
@@ -39,7 +40,8 @@
 
 public class ActionListenerCalledTwiceTest {
 
-    static String menuItems[] = {"Item1", "Item2", "Item3", "Item4", "Item5", "Item6"};
+    static String menuItems[] = {"Item1", "Item2", "Item3",
+                                    "Item4", "Item5", "Item6"};
     static KeyStroke keyStrokes[] = {
         KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK),
         KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
@@ -48,74 +50,50 @@
         KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK),
         KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.META_MASK)
     };
-    static JMenu menu;
+
+    static JMenuBar bar;
     static JFrame frame;
     static volatile int listenerCallCounter = 0;
 
     public static void main(String[] args) throws Exception {
         if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
-            System.out.println("This test is for MacOS only. Automatically passed on other platforms.");
+            System.out.println("This test is for MacOS only." +
+                    " Automatically passed on other platforms.");
             return;
         }
 
-        System.setProperty("apple.laf.useScreenMenuBar", "true");
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                createAndShowGUI();
-            }
-        });
+        try {
 
-        Robot robot = new Robot();
-        robot.setAutoDelay(100);
+            System.setProperty("apple.laf.useScreenMenuBar", "true");
+            SwingUtilities.invokeAndWait(
+                    ActionListenerCalledTwiceTest::createAndShowGUI);
 
-        for (int i = 0; i < menuItems.length; ++i) {
-            KeyStroke ks = keyStrokes[i];
-            int modKeyCode = getModKeyCode(ks.getModifiers());
-
-            if (modKeyCode != 0) {
-                robot.keyPress(modKeyCode);
-            }
+            Robot robot = new Robot();
+            robot.setAutoDelay(100);
 
-            robot.keyPress(ks.getKeyCode());
-            robot.keyRelease(ks.getKeyCode());
+            testForTwice(robot, "");
 
-            if (modKeyCode != 0) {
-                robot.keyRelease(modKeyCode);
-            }
-
+            SwingUtilities.invokeAndWait(
+                    ActionListenerCalledTwiceTest::testDefaultMenuBar);
             robot.waitForIdle();
 
-            if (listenerCallCounter != 1) {
-                throw new Exception("Test failed: ActionListener for " + menuItems[i]
-                        + " called " + listenerCallCounter + " times instead of 1!");
-            }
-
-            listenerCallCounter = 0;
+            testForTwice(robot, "DefaultMenuBar");
+        } finally {
+            SwingUtilities.invokeAndWait(() -> frame.dispose());
         }
-        SwingUtilities.invokeAndWait(new Runnable() {
-            public void run() {
-                frame.dispose();
-            }
-        });
     }
 
     private static void createAndShowGUI() {
-        menu = new JMenu("Menu");
+        JMenu menu = new JMenu("Menu");
 
         for (int i = 0; i < menuItems.length; ++i) {
             JMenuItem newItem = new JMenuItem(menuItems[i]);
             newItem.setAccelerator(keyStrokes[i]);
-            newItem.addActionListener(
-                    new ActionListener() {
-                public void actionPerformed(ActionEvent e) {
-                    listenerCallCounter++;
-                }
-            }
-            );
+            newItem.addActionListener(e -> listenerCallCounter++);
             menu.add(newItem);
         }
 
-        JMenuBar bar = new JMenuBar();
+        bar = new JMenuBar();
         bar.add(menu);
         frame = new JFrame("Test");
         frame.setJMenuBar(bar);
@@ -143,4 +121,40 @@
 
         return 0;
     }
+
+    private static void testForTwice(Robot robot, String exceptionPrefix)
+                                        throws Exception{
+        for (int i = 0; i < menuItems.length; ++i) {
+            KeyStroke ks = keyStrokes[i];
+            int modKeyCode = getModKeyCode(ks.getModifiers());
+
+            if (modKeyCode != 0) {
+                robot.keyPress(modKeyCode);
+            }
+
+            robot.keyPress(ks.getKeyCode());
+            robot.keyRelease(ks.getKeyCode());
+
+            if (modKeyCode != 0) {
+                robot.keyRelease(modKeyCode);
+            }
+
+            robot.waitForIdle();
+
+            if (listenerCallCounter != 1) {
+                throw new Exception(exceptionPrefix
+                        + " Test failed: ActionListener for " + menuItems[i]
+                        + " called " + listenerCallCounter + " times instead of 1!");
+            }
+
+            listenerCallCounter = 0;
+        }
+    }
+
+    private static void testDefaultMenuBar() {
+        if (Desktop.getDesktop().isSupported(Desktop.Action.APP_MENU_BAR)) {
+            Desktop.getDesktop().setDefaultMenuBar(bar);
+            frame.setExtendedState(JFrame.ICONIFIED);
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JOptionPane/7042497/JOptionPaneConfirmDlgTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,100 @@
+/*
+ * 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 7042497
+ * @summary  Verifies if JOptionPane.showInternalConfirmDialog
+             throws RuntimeException if parentComponent argument is null
+ * @run main/manual JOptionPaneConfirmDlgTest
+ */
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
+public class JOptionPaneConfirmDlgTest {
+    JInternalFrame  textFrame;
+    JFrame f = null;
+
+    public static void main(String[] args) throws Exception{
+            new JOptionPaneConfirmDlgTest();
+    }
+
+    public JOptionPaneConfirmDlgTest() throws Exception {
+
+        try {
+            SwingUtilities.invokeAndWait(()->createGUI());
+            Thread.sleep(10000);
+        } finally {
+            SwingUtilities.invokeAndWait(()->f.dispose());
+        }
+
+    }
+
+    public void createGUI() {
+        JOptionPane.showMessageDialog(
+            (Component) null,
+            "An internalFrame with 2 buttons will be displayed. \n" +
+           " Press \"Hit me 1\" button. The bug causes a RuntimeException to be thrown here\n" +
+           " But If a confirmation dialog comes, test has passed\n" +
+           " Similarly, press \"Hit me 2\" button. The bug will cause a RuntimeException\n" +
+           " to be thrown here but if a confirmation dialog comes, test has passed.\n" +
+           " Close the dialog and frame.",
+            "information", JOptionPane.INFORMATION_MESSAGE);
+        f = new JFrame();
+
+        textFrame = new JInternalFrame("Main-Frame", true);
+        f.setContentPane(textFrame);
+
+        Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
+        f.setSize(dim.width/6, dim.height/5);
+        textFrame.setBounds(10, 10, dim.width/8, dim.height/8);
+
+        textFrame.setVisible(true);
+
+        JButton b1 = new JButton("Hit me 1");
+        b1.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                JOptionPane.showInternalConfirmDialog(null, "Test?");
+            }});
+
+        JButton b2 = new JButton("Hit me 2");
+        b2.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                JOptionPane.showInternalConfirmDialog(new JInternalFrame(), "Test?");
+            }});
+
+        textFrame.setLayout(new FlowLayout());
+        textFrame.add(b1);
+        textFrame.add(b2);
+        f.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/4870644/bug4870644.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,162 @@
+/*
+ * 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
+ * @key headful
+ * @bug 4870644 7190539
+ * @summary  Default button responds to CTRL-ENTER while popup menu is active.
+ * @run main bug4870644
+ */
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+
+public class bug4870644 {
+    JButton b1, b2, b3;
+    JFrame frame;
+    JMenu menu;
+    JPopupMenu popup;
+    static Robot robot;
+    static boolean passed = true;
+    private volatile Point p = null;
+    private volatile Dimension d = null;
+    void blockTillDisplayed(JComponent comp) throws Exception {
+        while (p == null) {
+            try {
+                SwingUtilities.invokeAndWait(() -> {
+                    p = comp.getLocationOnScreen();
+                    d = comp.getSize();
+                });
+            } catch (IllegalStateException e) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException ie) {
+                }
+            }
+        }
+    }
+
+    private static void setLookAndFeel(final UIManager.LookAndFeelInfo laf) {
+        try {
+            UIManager.setLookAndFeel(laf.getClassName());
+            System.out.println("LookAndFeel: " + laf.getClassName());
+        } catch (ClassNotFoundException | InstantiationException |
+                UnsupportedLookAndFeelException | IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        robot = new Robot();
+        robot.setAutoDelay(100);
+        for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
+            try {
+                SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
+                System.out.println("Test for LookAndFeel " + laf.getClassName());
+                new bug4870644();
+                System.out.println("Test passed for LookAndFeel " + laf.getClassName());
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    public bug4870644() throws Exception {
+
+        SwingUtilities.invokeAndWait(() -> {
+            JMenuBar menuBar = new JMenuBar();
+            menu = new JMenu("Menu");
+            menuBar.add(menu);
+            JMenuItem menuItem = new JMenuItem("Item");
+            menu.add(menuItem);
+            menu.add(new JMenuItem("Item 2"));
+            frame = new JFrame("test");
+            frame.setJMenuBar(menuBar);
+
+            b1 = new JButton("One");
+            b2 = new JButton("Two");
+            b3 = new JButton("Default");
+            b3.addActionListener(new AbstractAction() {
+                public void actionPerformed(ActionEvent e) {
+                    passed = false;
+                }
+            });
+            frame.getContentPane().add(b1, BorderLayout.NORTH);
+            frame.getContentPane().add(b2, BorderLayout.CENTER);
+            frame.getContentPane().add(b3, BorderLayout.SOUTH);
+            frame.getRootPane().setDefaultButton(b3);
+            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+            frame.pack();
+            frame.setVisible(true);
+        });
+
+        blockTillDisplayed(b1);
+        robot.waitForIdle();
+
+        robot.delay(500);
+        robot.mouseMove(p.x + d.width-1, p.y + d.height/2);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_F10);
+        robot.keyRelease(KeyEvent.VK_F10);
+        robot.keyPress(KeyEvent.VK_DOWN);
+        robot.keyRelease(KeyEvent.VK_DOWN);
+        robot.waitForIdle();
+
+        SwingUtilities.invokeAndWait(() -> {
+            popup = menu.getPopupMenu();
+        });
+
+        blockTillDisplayed(popup);
+        robot.waitForIdle();
+        robot.mouseMove(p.x + d.width-1, p.y + d.height/2);
+        robot.keyPress(KeyEvent.VK_CONTROL);
+        robot.keyPress(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_ENTER);
+        robot.keyRelease(KeyEvent.VK_CONTROL);
+        robot.waitForIdle();
+
+        SwingUtilities.invokeAndWait(() -> frame.dispose());
+        if(!passed) {
+            String cause = "Default button reacted on \"ctrl ENTER\" while menu is active.";
+            throw new RuntimeException(cause);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/8075063/ContextMenuScrollTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,197 @@
+/*
+ * 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
+ * @key headful
+ * @bug 8075063
+ * @summary  Verifies if Context menu closes on mouse scroll
+ * @run main ContextMenuScrollTest
+ */
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.JSeparator;
+import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
+
+public class ContextMenuScrollTest extends JPopupMenu
+{
+    private JMenuItem undo;
+    private JMenuItem redo;
+    private JMenuItem cut;
+    private JMenuItem copy;
+    private JMenuItem paste;
+    private JMenuItem delete;
+    private JMenuItem selectAll;
+    private final Robot robot;
+    private JFrame frame;
+    private JMenuBar menuBar;
+    private JMenu menu;
+    private volatile Point p = null;
+    private volatile Dimension d = null;
+
+    public static void main(String[] args) throws Exception {
+        new ContextMenuScrollTest();
+    }
+    void blockTillDisplayed(JComponent comp) throws Exception {
+        while (p == null) {
+            try {
+                SwingUtilities.invokeAndWait(() -> {
+                    p = comp.getLocationOnScreen();
+                    d = menu.getSize();
+                });
+            } catch (IllegalStateException e) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException ie) {
+                }
+            }
+        }
+    }
+
+    public ContextMenuScrollTest() throws Exception
+    {
+        robot = new Robot();
+        robot.setAutoDelay(200);
+        try {
+            SwingUtilities.invokeAndWait(()->createGUI());
+            blockTillDisplayed(menu);
+            robot.waitForIdle();
+
+            robot.mouseMove(p.x + d.width/2, p.y + d.height/2);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            robot.waitForIdle();
+
+            System.out.println("popmenu visible " + menu.isPopupMenuVisible());
+            robot.mouseWheel(1);
+            robot.waitForIdle();
+            System.out.println("popmenu visible " + menu.isPopupMenuVisible());
+            if (!menu.isPopupMenuVisible()) {
+                throw new RuntimeException("Popup closes on mouse scroll");
+            }
+        } finally {
+            SwingUtilities.invokeAndWait(()->frame.dispose());
+        }
+    }
+
+    public void createGUI() {
+        frame = new JFrame();
+        menuBar = new JMenuBar();
+        menu = new JMenu("Menu");
+        menuBar.add(menu);
+
+        undo = new JMenuItem("Undo");
+        undo.setEnabled(false);
+        undo.setAccelerator(KeyStroke.getKeyStroke("control Z"));
+        undo.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+            }
+        });
+
+        menu.add(undo);
+
+        redo = new JMenuItem("Redo");
+        redo.setEnabled(false);
+        redo.setAccelerator(KeyStroke.getKeyStroke("control Y"));
+        redo.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+            }
+        });
+        menu.add(redo);
+
+        menu.add(new JSeparator());
+
+        cut = new JMenuItem("Cut");
+        cut.setEnabled(false);
+        cut.setAccelerator(KeyStroke.getKeyStroke("control X"));
+        cut.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+            }
+        });
+
+        menu.add(cut);
+
+        copy = new JMenuItem("Copy");
+        copy.setEnabled(false);
+        copy.setAccelerator(KeyStroke.getKeyStroke("control C"));
+        copy.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+            }
+        });
+
+        menu.add(copy);
+
+        paste = new JMenuItem("Paste");
+        paste.setEnabled(false);
+        paste.setAccelerator(KeyStroke.getKeyStroke("control V"));
+        paste.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+            }
+        });
+
+        menu.add(paste);
+
+        delete = new JMenuItem("Delete");
+        delete.setEnabled(false);
+        delete.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
+        delete.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+            }
+        });
+
+        menu.add(delete);
+
+        menu.add(new JSeparator());
+
+        selectAll = new JMenuItem("Select All");
+        selectAll.setEnabled(false);
+        selectAll.setAccelerator(KeyStroke.getKeyStroke("control A"));
+        selectAll.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent event) {
+            }
+        });
+        menu.add(selectAll);
+        frame.setJMenuBar(menuBar);
+
+        frame.pack();
+        frame.setVisible(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JPopupMenu/8173739/TestPopupMenu.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,202 @@
+/*
+ * 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
+ * @key headful
+ * @bug 8173739
+ * @summary  Verifies if JPopupMenu disappears on KeyEvent
+ * @run main TestPopupMenu
+ */
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.beans.PropertyVetoException;
+import javax.swing.JComponent;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
+
+public class TestPopupMenu {
+    private JFrame frame;
+    private JLabel label;
+    private volatile Point p = null;
+    private volatile Dimension d = null;
+
+    public static void main(String[] args) throws Exception {
+        new TestPopupMenu();
+    }
+
+    void blockTillDisplayed(JComponent comp) throws Exception {
+        while (p == null) {
+            try {
+                SwingUtilities.invokeAndWait(() -> {
+                    p = comp.getLocationOnScreen();
+                    d = comp.getSize();
+                });
+            } catch (IllegalStateException e) {
+                try {
+                    Thread.sleep(1000);
+                } catch (InterruptedException ie) {
+                }
+            }
+        }
+    }
+
+    public TestPopupMenu() throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(200);
+        try {
+            SwingUtilities.invokeAndWait(() -> {
+                try {
+                    createAndShowUI();
+                } catch (Exception ex) {
+                    throw new RuntimeException(ex);
+                }
+            });
+            blockTillDisplayed(label);
+            robot.waitForIdle();
+            robot.mouseMove(p.x + d.width/2, p.y + d.height/2);
+            robot.mousePress(InputEvent.BUTTON3_DOWN_MASK);
+            robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK);
+            robot.waitForIdle();
+            robot.keyPress(KeyEvent.VK_CONTROL);
+            robot.keyPress(KeyEvent.VK_U);
+            robot.keyRelease(KeyEvent.VK_U);
+            robot.keyRelease(KeyEvent.VK_CONTROL);
+            robot.waitForIdle();
+            JPopupMenu popup = label.getComponentPopupMenu();
+            if (popup != null && popup.isVisible()) {
+                throw new RuntimeException("Popup is visible in wrong internal frame");
+            }
+        } finally {
+            SwingUtilities.invokeAndWait(()->frame.dispose());
+        }
+    }
+
+    private void createAndShowUI() throws Exception {
+        frame = new JFrame();
+        frame.setTitle("Test Frame");
+        frame.setSize(800, 600);
+
+        JDesktopPane pane = new JDesktopPane();
+        TestInternalFrameWPopup testInternalFrame1 = new TestInternalFrameWPopup();
+        pane.add(testInternalFrame1);
+
+        testInternalFrame1.setVisible(true);
+        JScrollPane scrollPane = new JScrollPane(pane);
+        frame.getContentPane().add(scrollPane);
+        testInternalFrame1.setMaximum(true);
+        frame.getRootPane().registerKeyboardAction(e -> {
+            TestInternalFrame testInternalFrame2 = new TestInternalFrame();
+            pane.add(testInternalFrame2);
+            try {
+                testInternalFrame2.setMaximum(true);
+            } catch (PropertyVetoException ex) {
+                throw new RuntimeException(ex);
+            }
+            testInternalFrame2.setVisible(true);
+        }, KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.CTRL_MASK),
+                                 JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+
+        frame.setVisible(true);
+    }
+
+    /**
+     * Background color Cyan
+     */
+    class TestInternalFrameWPopup extends JInternalFrame {
+
+        TestInternalFrameWPopup() {
+            jbInit();
+        }
+
+        private void jbInit() {
+            setTitle("Test Internal Frame With Popup");
+            setContentPane(getContainerPanel());
+            setMaximizable(true);
+            setClosable(true);
+            setMinimumSize(new Dimension(500, 300));
+            setSize(500, 300);
+        }
+
+        private JPanel getContainerPanel() {
+            JPanel panel = new JPanel();
+            panel.setLayout(new GridBagLayout());
+            label = new JLabel("Test Label");
+            JPopupMenu popup = new JPopupMenu();
+            JMenuItem menuItem1 = new JMenuItem("Item 1");
+            JMenuItem menuItem2 = new JMenuItem("Item 2");
+            JMenuItem menuItem3 = new JMenuItem("Item 3");
+            JMenuItem menuItem4 = new JMenuItem("Item 4");
+            JMenuItem menuItem5 = new JMenuItem("Item 5");
+            menuItem1.setOpaque(false);
+            menuItem2.setOpaque(false);
+            menuItem3.setOpaque(false);
+            menuItem4.setOpaque(false);
+            menuItem5.setOpaque(false);
+            popup.add(menuItem1);
+            popup.add(menuItem2);
+            popup.add(menuItem3);
+            popup.add(menuItem4);
+            popup.add(menuItem5);
+            label.setComponentPopupMenu(popup);
+            popup.setBackground(Color.CYAN);
+            panel.add(label, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
+                    GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
+            panel.setBackground(Color.CYAN);
+            return panel;
+        }
+    }
+
+    /**
+     * Background color Gray
+     *
+     */
+    class TestInternalFrame extends JInternalFrame {
+        public TestInternalFrame() {
+            jbInit();
+        }
+
+        private void jbInit() {
+            setTitle("Test Internal Frame");
+            getContentPane().setBackground(Color.GRAY);
+            setMaximizable(true);
+            setClosable(true);
+            setMinimumSize(new Dimension(500, 300));
+            setSize(500, 300);
+        }
+    }
+}
--- a/jdk/test/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,7 @@
  */
 
 /* @test
+ * @key headful
  * @bug 8074883
  * @summary Tab key should move to focused button in a button group
  * @run main ButtonGroupFocusTest
--- a/jdk/test/javax/swing/JTabbedPane/4310381/bug4310381.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JTabbedPane/4310381/bug4310381.java	Sat Sep 09 14:36:45 2017 +0200
@@ -27,7 +27,7 @@
 
 /*
  * @test
- * @bug 4310381
+ * @bug 4310381 8075918
  * @summary Text in multi-row/col JTabbedPane tabs can be truncated/clipped
  * @author Charles Lee
    @run applet/manual=yesno bug4310381.html
--- a/jdk/test/javax/swing/JTable/6937798/bug6937798.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JTable/6937798/bug6937798.java	Sat Sep 09 14:36:45 2017 +0200
@@ -25,13 +25,11 @@
    @bug 6937798
    @summary Nimbus: Issues with JTable grid
    @author Alexander Potochkin
-   @modules java.desktop/com.sun.java.swing.plaf.nimbus
    @run main bug6937798
 */
 
-import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
-
 import javax.swing.*;
+import javax.swing.plaf.nimbus.NimbusLookAndFeel;
 import javax.swing.table.AbstractTableModel;
 import javax.swing.table.TableModel;
 import java.awt.*;
--- a/jdk/test/javax/swing/JTextArea/4697612/bug4697612.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JTextArea/4697612/bug4697612.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 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
@@ -24,17 +24,23 @@
 /*
  * @test
  * @key headful
- * @bug 4697612 6244705
- * @author Peter Zhelezniakov
- * @library ../../regtesthelpers
- * @build Util
+ * @bug 4697612 6244705 7190581
  * @run main bug4697612
  */
-import java.io.*;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
+import java.awt.Rectangle;
+import java.awt.Dimension;
+import java.io.InputStream;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.LookAndFeel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.text.BadLocationException;
 
 public class bug4697612 {
@@ -47,94 +53,120 @@
     private static JFrame frame;
     private static JTextArea text;
     private static JScrollPane scroller;
+    private static Robot robot;
+
+    private static void setLookAndFeel(final UIManager.LookAndFeelInfo laf) {
+        try {
+            UIManager.setLookAndFeel(laf.getClassName());
+        } catch (ClassNotFoundException | InstantiationException |
+                 UnsupportedLookAndFeelException | IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
 
     public static void main(String[] args) throws Throwable {
-        Robot robot = new Robot();
+        robot = new Robot();
         robot.setAutoDelay(100);
-
-        SwingUtilities.invokeAndWait(new Runnable() {
-
-            @Override
-            public void run() {
-                createAndShowGUI();
-            }
-        });
-
-        robot.waitForIdle();
-
-        SwingUtilities.invokeAndWait(new Runnable() {
-
-            @Override
-            public void run() {
-                text.requestFocus();
+        for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
+            try {
+                SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
+                System.out.println("Test for LookAndFeel " + laf.getClassName());
+                new bug4697612();
+                System.out.println("Test passed for LookAndFeel " + laf.getClassName());
+            }  catch (Exception e) {
+                throw new RuntimeException(e);
             }
-        });
-
-        robot.waitForIdle();
-
-        // 4697612: pressing PgDn + PgUp should not alter caret position
-        Util.hitKeys(robot, KeyEvent.VK_HOME);
-        Util.hitKeys(robot, KeyEvent.VK_PAGE_DOWN);
-
+        }
+    }
 
-        int pos0 = getTextCaretPosition();
-        int caretHeight = getTextCaretHeight();
-        fontHeight = FONT_HEIGHT;
-
-        // iterate two times, for different (even and odd) font height
-        for (int i = 0; i < 2; i++) {
-
+    public bug4697612() throws Exception {
+        try {
             SwingUtilities.invokeAndWait(new Runnable() {
-
+                @Override
                 public void run() {
-                    text.setFont(text.getFont().deriveFont(fontHeight));
+                    createAndShowGUI();
+                }
+            });
+            robot.waitForIdle();
+            SwingUtilities.invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    text.requestFocus();
                 }
             });
+            robot.waitForIdle();
 
-            frameHeight = FRAME_HEIGHT;
+            // 4697612: pressing PgDn + PgUp should not alter caret position
+            robot.keyPress(KeyEvent.VK_HOME);
+            robot.keyRelease(KeyEvent.VK_HOME);
+            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+            robot.waitForIdle();
 
-            for (int j = 0; j < caretHeight; j++) {
-                SwingUtilities.invokeAndWait(new Runnable() {
+            int pos0 = getTextCaretPosition();
+            int caretHeight = getTextCaretHeight();
+            fontHeight = FONT_HEIGHT;
 
+            // iterate two times, for different (even and odd) font height
+            for (int i = 0; i < 2; i++) {
+
+                SwingUtilities.invokeAndWait(new Runnable() {
                     public void run() {
-                        frame.setSize(FRAME_WIDTH, frameHeight);
+                        text.setFont(text.getFont().deriveFont(fontHeight));
                     }
                 });
-
-                robot.waitForIdle();
+                frameHeight = FRAME_HEIGHT;
 
-                Util.hitKeys(robot, KeyEvent.VK_PAGE_DOWN);
-                Util.hitKeys(robot, KeyEvent.VK_PAGE_UP);
-                robot.waitForIdle();
+                for (int j = 0; j < caretHeight; j++) {
 
-                int pos = getTextCaretPosition();
-                if (pos0 != pos) {
-                    throw new RuntimeException("Failed 4697612: PgDn & PgUp keys scroll by different amounts");
+                    SwingUtilities.invokeAndWait(new Runnable() {
+                        public void run() {
+                            frame.setSize(FRAME_WIDTH, frameHeight);
+                        }
+                    });
+                    robot.waitForIdle();
+                    robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+                    robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+                    robot.keyPress(KeyEvent.VK_PAGE_UP);
+                    robot.keyRelease(KeyEvent.VK_PAGE_UP);
+                    robot.waitForIdle();
+
+                    int pos = getTextCaretPosition();
+                    if (pos0 != pos) {
+                        throw new RuntimeException("Failed 4697612: PgDn & PgUp keys scroll by different amounts");
+                    }
+                    frameHeight++;
                 }
-                frameHeight++;
+                fontHeight++;
             }
-            fontHeight++;
-        }
-
 
-        // 6244705: pressing PgDn at the very bottom should not scroll
-        LookAndFeel laf = UIManager.getLookAndFeel();
-        if (laf.getID().equals("Aqua")) {
-            Util.hitKeys(robot, KeyEvent.VK_END);
-        } else {
-            Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_END);
-        }
+            // 6244705: pressing PgDn at the very bottom should not scroll
+            LookAndFeel laf = UIManager.getLookAndFeel();
+            if (laf.getID().equals("Aqua")) {
+                robot.keyPress(KeyEvent.VK_END);
+                robot.keyRelease(KeyEvent.VK_END);
+            } else {
+                robot.keyPress(KeyEvent.VK_CONTROL);
+                robot.keyPress(KeyEvent.VK_END);
+                robot.keyRelease(KeyEvent.VK_END);
+                robot.keyRelease(KeyEvent.VK_CONTROL);
+            }
+            robot.waitForIdle();
+            robot.delay(1000);
 
-        robot.waitForIdle();
+            pos0 = getScrollerViewPosition();
+            robot.keyPress(KeyEvent.VK_PAGE_DOWN);
+            robot.keyRelease(KeyEvent.VK_PAGE_DOWN);
+            robot.waitForIdle();
+
+            int pos = getScrollerViewPosition();
 
-        pos0 = getScrollerViewPosition();
-        Util.hitKeys(robot, KeyEvent.VK_PAGE_DOWN);
-        robot.waitForIdle();
-
-        int pos = getScrollerViewPosition();
-
-        if (pos0 != pos) {
-            throw new RuntimeException("Failed 6244705: PgDn at the bottom causes scrolling");
+            if (pos0 != pos) {
+                System.out.println("pos0 " + pos0 + " pos " + pos);
+                throw new RuntimeException("Failed 6244705: PgDn at the bottom causes scrolling");
+            }
+        } finally {
+            SwingUtilities.invokeAndWait(() -> frame.dispose());
         }
     }
 
--- a/jdk/test/javax/swing/JTextArea/8148555/JTextAreaEmojiTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JTextArea/8148555/JTextAreaEmojiTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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
@@ -33,12 +33,15 @@
 import javax.swing.JTextArea;
 import javax.swing.SwingUtilities;
 import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 /* @test
- * @bug 8148555
+ * @key headful
+ * @bug 8148555 8181782
  * @summary verifies JTextArea emoji enter exception. Emoji is not supported.
  * @requires (os.family=="mac")
- * @run main JTextAreaEmojiTest
+ * @run main/manual JTextAreaEmojiTest
  */
 public class JTextAreaEmojiTest implements
         ActionListener {
@@ -55,10 +58,16 @@
     private static JButton failButton;
 
     private static JFrame mainFrame;
+    private static final CountDownLatch testRunLatch = new CountDownLatch(1);
 
     public static void main(String[] args) throws Exception {
 
         JTextAreaEmojiTest test = new JTextAreaEmojiTest();
+        boolean status = testRunLatch.await(5, TimeUnit.MINUTES);
+
+        if (!status) {
+            throw new RuntimeException("Test timed out");
+        }
     }
 
     public JTextAreaEmojiTest() throws Exception {
@@ -143,7 +152,6 @@
     public void actionPerformed(ActionEvent evt) {
         if (evt.getSource() instanceof JButton) {
             JButton btn = (JButton) evt.getSource();
-            cleanUp();
 
             switch (btn.getActionCommand()) {
                 case "Pass":
@@ -151,10 +159,13 @@
                 case "Fail":
                     throw new AssertionError("Test case has failed!");
             }
+
+            cleanUp();
         }
     }
 
     private static void cleanUp() {
         mainFrame.dispose();
+        testRunLatch.countDown();
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTextField/MissingCharsKorean/MissingCharsKorean.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,331 @@
+/*
+ * 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 8180370
+ * @summary Checks whether non-alpha chars are skipped while entering KoreanText
+ * @requires (os.family == "mac")
+ * @run main/manual MissingCharsKorean
+ */
+
+/**
+ * This test requires a manual intervention as the keyboard layout has to be
+ * changed to 2-set Korean. Once the keyboard layout has been selected, click on
+ * Start Test to start the automated tests. Along with testing for non-alpha
+ * chars, this test also ensures that the MarkedText property is not broken by
+ * running cases where different glyphs are combined and also cases where
+ * combined glyphs are broken.
+ */
+
+import java.awt.AWTException;
+import java.awt.Font;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Robot;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
+import java.awt.event.KeyEvent;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+
+public class MissingCharsKorean {
+    private static boolean testPassed = false;
+    private static boolean startTest = false;
+    private static int expectedResults[] = null;
+    private static int inKeyCodes[][] = null;
+
+    private static JFrame frame = null;
+    private static JLabel lblTestStatus = null;
+    private static JTextField textFieldMain = null;
+    private static String testResult;
+
+    private static final CountDownLatch testStartLatch = new CountDownLatch(1);
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            setupUI();
+        });
+
+        testStartLatch.await();
+
+        if (startTest) {
+            glyphTest();
+
+            frame.dispose();
+
+            if (testPassed) {
+                System.out.println(testResult);
+            } else {
+                throw new RuntimeException("Korean text missing characters : "
+                        + testResult);
+            }
+        } else {
+            throw new RuntimeException("User has not executed the test");
+        }
+    }
+
+    private static void setupUI() {
+        String description = " 1. Go to \"System Preferences -> Keyboard -> "
+                            + "Input Sources\" and add \"2-Set Korean\""
+                            + " from Korean language group \n"
+                            + " 2. Set current IM to \"2-Set Korean\" \n"
+                            + " 3. Try typing in the text field to ensure"
+                            + " that Korean keyboard has been successfully"
+                            + " selected \n"
+                            + " 4. Now click on \"Start Test\" button \n";
+        String title = "Missing Characters Korean Test (Mac OS)";
+
+        frame = new JFrame(title);
+
+        JPanel mainPanel = new JPanel(new BorderLayout());
+
+        JPanel textEditPanel = new JPanel(new FlowLayout());
+
+        textFieldMain = new JTextField(20);
+        Font font = new Font("Source Han Serif K", Font.BOLD,12);
+        textFieldMain.setFont(font);
+
+        textEditPanel.add(textFieldMain);
+
+        mainPanel.add(textEditPanel, BorderLayout.CENTER);
+
+        JTextArea textArea = new JTextArea(description);
+        textArea.setEditable(false);
+        final JButton btnStartTest = new JButton("Start Test");
+        final JButton btnCancelTest = new JButton("Cancel Test");
+
+        btnStartTest.addActionListener((e) -> {
+            btnStartTest.setEnabled(false);
+            btnCancelTest.setEnabled(false);
+            startTest = true;
+            testStartLatch.countDown();
+        });
+
+        btnCancelTest.addActionListener((e) -> {
+            frame.dispose();
+            testStartLatch.countDown();
+        });
+        mainPanel.add(textArea, BorderLayout.NORTH);
+
+        JPanel buttonPanel = new JPanel(new FlowLayout());
+        buttonPanel.add(btnStartTest);
+        buttonPanel.add(btnCancelTest);
+        mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+
+        lblTestStatus = new JLabel("");
+        lblTestStatus.setMinimumSize(new Dimension(150, 20));
+        lblTestStatus.setPreferredSize(new Dimension(150, 20));
+        lblTestStatus.setVisible(true);
+        textEditPanel.add(lblTestStatus);
+
+        frame.add(mainPanel);
+        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+        frame.pack();
+        frame.setLocationRelativeTo(null);
+
+        frame.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                testStartLatch.countDown();
+            }
+            @Override
+            public void windowOpened( WindowEvent e ){
+                textFieldMain.requestFocusInWindow();
+            }
+        });
+
+        frame.setVisible(true);
+    }
+
+    private static void glyphTest() {
+        try {
+            Robot robotKeySimulator = new Robot();
+            performTasks(robotKeySimulator);
+        } catch (AWTException e) {
+            System.err.print("Creation Of Robot Failed : " + e.getMessage());
+            testPassed = false;
+        }
+    }
+
+    public static void performTasks(Robot robotForKeyInput) {
+        int taskCount = 0;
+
+        lblTestStatus.setText("Running Tests..");
+        robotForKeyInput.setAutoDelay(500);
+
+        while (setKeyInput(taskCount)) {
+            textFieldMain.setText("");
+            textFieldMain.requestFocusInWindow();
+            enterInput(robotForKeyInput, inKeyCodes);
+            taskCount++;
+
+            try {
+                SwingUtilities.invokeAndWait(() -> {
+                    validateInput();
+                });
+            } catch (Exception e) {
+                System.err.print("validateInput Failed : " + e.getMessage());
+                testPassed = false;
+                break;
+            }
+
+            if (!testPassed) {
+                break;
+            }
+            setTaskStatus(false, taskCount);
+        }
+        setTaskStatus(true, taskCount);
+    }
+
+    private static boolean setKeyInput(int iCount) {
+        boolean inputSet = true;
+
+        switch(iCount) {
+            case 0:
+                // Input Korean q (#12610) /(#47)
+                expectedResults = new int[]{ 12610, 47 };
+                inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
+                                            {KeyEvent.VK_SLASH}
+                                        };
+                break;
+
+            case 1:
+                // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
+                expectedResults = new int[]{ 12610, 47, 54840, 92 };
+                inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
+                                            {KeyEvent.VK_SLASH},
+                                            {KeyEvent.VK_G},
+                                            {KeyEvent.VK_H},
+                                            {KeyEvent.VK_BACK_SLASH}
+                                        };
+                break;
+
+            case 2:
+                // Input Korean q (#12610) /(#47) ghq (#54857) \(#92)
+                expectedResults = new int[]{ 12610, 47, 54857, 92 };
+                inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
+                                            {KeyEvent.VK_SLASH},
+                                            {KeyEvent.VK_G},
+                                            {KeyEvent.VK_H},
+                                            {KeyEvent.VK_Q},
+                                            {KeyEvent.VK_BACK_SLASH}
+                                        };
+                break;
+
+            case 3:
+                // Input Korean q (#12610) /(#47) gh (#54840) \(#92)
+                expectedResults = new int[]{ 12610, 47, 54840, 92 };
+                inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
+                                            {KeyEvent.VK_SLASH},
+                                            {KeyEvent.VK_G},
+                                            {KeyEvent.VK_H},
+                                            {KeyEvent.VK_Q},
+                                            {KeyEvent.VK_BACK_SPACE},
+                                            {KeyEvent.VK_BACK_SLASH}
+                                        };
+                break;
+
+            case 4:
+                // Input Korean q (#12610) /(#47) g (#12622) \(#92)
+                expectedResults = new int[]{ 12610, 47, 12622, 92 };
+                inKeyCodes = new int[][] {  {KeyEvent.VK_Q},
+                                            {KeyEvent.VK_SLASH},
+                                            {KeyEvent.VK_G},
+                                            {KeyEvent.VK_H},
+                                            {KeyEvent.VK_Q},
+                                            {KeyEvent.VK_BACK_SPACE},
+                                            {KeyEvent.VK_BACK_SPACE},
+                                            {KeyEvent.VK_BACK_SLASH}
+                                        };
+                break;
+
+            default:
+                inputSet = false;
+                break;
+        }
+
+        return inputSet;
+    }
+
+    private static void enterInput(Robot robotKeyInput, int keyInputs[][]) {
+        for (int i = 0; i < keyInputs.length; i++) {
+            String strKeyInput = "KeyPress=>";
+            final int noOfKeyInputs = keyInputs[i].length;
+            for (int j = 0; j < noOfKeyInputs; j++) {
+                robotKeyInput.keyPress(keyInputs[i][j]);
+                strKeyInput += (Integer.toHexString(keyInputs[i][j])) + ":";
+            }
+
+            strKeyInput += "KeyRelease=>";
+            for (int j = noOfKeyInputs - 1; j >= 0; j--) {
+                robotKeyInput.keyRelease(keyInputs[i][j]);
+                strKeyInput += (Integer.toHexString(keyInputs[i][j])) + ":";
+            }
+            System.out.println(strKeyInput);
+        }
+    }
+
+    private static void validateInput() {
+        testPassed = false;
+
+        if (expectedResults != null) {
+            String strCurr = textFieldMain.getText();
+            if (expectedResults.length == strCurr.length()) {
+                testPassed = true;
+
+                for (int i = 0; i < strCurr.length(); i++) {
+                    final int charActual = strCurr.charAt(i);
+                    if (charActual != expectedResults[i]) {
+                        System.err.println("<" + i + "> Actual = " + charActual
+                                + " Expected = " + expectedResults[i]);
+                        testPassed = false;
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    public static void setTaskStatus(boolean allTasksPerformed, int taskCount) {
+        if (testPassed) {
+            if (allTasksPerformed) {
+                testResult = "All Tests Passed";
+            } else {
+                testResult = "Test " + Integer.toString(taskCount)
+                        + " Passed";
+            }
+        } else {
+            testResult = "Test " + Integer.toString(taskCount)
+                    + " Failed";
+        }
+        lblTestStatus.setText(testResult);
+    }
+}
--- a/jdk/test/javax/swing/JTree/4633594/JTreeFocusTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/JTree/4633594/JTreeFocusTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -21,6 +21,7 @@
  * questions.
  */
 /* @test
+   @key headful
    @bug 4633594 8172012
    @summary No way to pass focus from a JTree to a GUI placed inside the tree node
    @run main JTreeFocusTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/MultiUIDefaults/NPECheck/MultiUIDefaultsNPECheck.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,93 @@
+/*
+ * 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 6919529
+ * @summary Checks if there is a null pointer exception when the component UI
+ *   is null.
+ * @run main MultiUIDefaultsNPECheck
+ */
+import javax.swing.LookAndFeel;
+import javax.swing.JLabel;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.UIDefaults;
+import javax.swing.SwingUtilities;
+
+public class MultiUIDefaultsNPECheck {
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            Test();
+        });
+    }
+
+    public static void Test() {
+        JLabel label = new JLabel();
+
+        try {
+            UIManager.setLookAndFeel(new LookAndFeel() {
+                @Override
+                public String getName() {
+                    return null;
+                }
+
+                @Override
+                public String getID() {
+                    return null;
+                }
+
+                @Override
+                public String getDescription() {
+                    return null;
+                }
+
+                @Override
+                public boolean isNativeLookAndFeel() {
+                    return false;
+                }
+
+                @Override
+                public boolean isSupportedLookAndFeel() {
+                    return true;
+                }
+
+                @Override
+                public UIDefaults getDefaults() {
+                    return null;
+                }
+            });
+        }  catch (UnsupportedLookAndFeelException e) {
+            System.err.println("Warning: test not applicable because of " +
+                "unsupported look and feel");
+            return;
+        }
+
+        try {
+            UIManager.getDefaults().getUI(label);
+        } catch (NullPointerException e) {
+            throw new RuntimeException("Got null pointer exception. Hence " +
+                    "Test Failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Rectangle;
+import java.awt.event.InputEvent;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JFrame;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+import static javax.swing.UIManager.getInstalledLookAndFeels;
+
+/**
+ * @test
+ * @bug 8139050 8153871
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main/othervm/timeout=360 -Xcheck:jni NativeErrorsInTableDnD
+ */
+public final class NativeErrorsInTableDnD {
+
+    private static JFrame frame;
+
+    private static volatile Rectangle bounds;
+
+    public static void main(final String[] args) throws Exception {
+        if (args.length == 0) {
+            createChildProcess();
+            return;
+        }
+        for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) {
+            SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
+
+            SwingUtilities.invokeAndWait(() -> {
+                final JTable table = new JTable(10, 10);
+                frame = new JFrame();
+                frame.setUndecorated(true);
+                table.setDragEnabled(true);
+                table.selectAll();
+                frame.add(table);
+                frame.pack();
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+            });
+            final ExtendedRobot r = new ExtendedRobot();
+            r.waitForIdle();
+            SwingUtilities.invokeAndWait(() -> {
+                bounds = frame.getBounds();
+            });
+            for (int i = 0; i < 5; ++i) {
+                int x1 = bounds.x + bounds.width / 4;
+                int y1 = bounds.y + bounds.height / 4;
+                r.setAutoDelay(50);
+                // Special sequence of clicks which reproduce the problem
+                r.mouseMove(bounds.x + bounds.width / 7, y1);
+                r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+                r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+                r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+                r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+                r.mouseMove(x1, y1);
+                r.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+                r.setAutoDelay(0);
+                r.glide(x1, y1, x1 + bounds.width / 4, y1 + bounds.height / 4);
+                r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+            }
+            SwingUtilities.invokeAndWait(() -> {
+                frame.dispose();
+            });
+            r.waitForIdle();
+        }
+    }
+
+    static void createChildProcess() throws Exception {
+        final String javaPath = System.getProperty("java.home");
+        final String classPathDir = System.getProperty("java.class.path");
+        doExec(javaPath + File.separator + "bin" + File.separator + "java",
+               "-cp", classPathDir, "NativeErrorsInTableDnD", "start");
+    }
+
+    static void doExec(final String... cmds) throws Exception {
+        Process p;
+        final ProcessBuilder pb = new ProcessBuilder(cmds);
+        for (final String cmd : cmds) {
+            System.out.print(cmd + " ");
+        }
+        System.out.println();
+        BufferedReader rdr;
+        final List<String> errorList = new ArrayList<>();
+        final List<String> outputList = new ArrayList<>();
+        p = pb.start();
+        rdr = new BufferedReader(new InputStreamReader(p.getInputStream()));
+        String in = rdr.readLine();
+        while (in != null) {
+            outputList.add(in);
+            in = rdr.readLine();
+            System.out.println(in);
+        }
+        rdr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
+        in = rdr.readLine();
+        while (in != null) {
+            errorList.add(in);
+            in = rdr.readLine();
+            System.err.println(in);
+        }
+        p.waitFor();
+        p.destroy();
+
+        if (!errorList.isEmpty()) {
+            throw new RuntimeException("Error log is not empty");
+        }
+        final int exit = p.exitValue();
+        if (exit != 0) {
+            throw new RuntimeException("Exit status = " + exit);
+        }
+    }
+
+    private static void setLookAndFeel(final UIManager.LookAndFeelInfo laf) {
+        try {
+            UIManager.setLookAndFeel(laf.getClassName());
+            System.out.println("LookAndFeel: " + laf.getClassName());
+        } catch (ClassNotFoundException | InstantiationException |
+                UnsupportedLookAndFeelException | IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
--- a/jdk/test/javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation/JComboBoxPopupLocation.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation/JComboBoxPopupLocation.java	Sat Sep 09 14:36:45 2017 +0200
@@ -39,6 +39,7 @@
 
 /**
  * @test
+ * @key headful
  * @bug 8176448
  * @run main/timeout=600 JComboBoxPopupLocation
  */
--- a/jdk/test/javax/swing/plaf/metal/MetalGradient/8163193/ButtonGradientTest.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/plaf/metal/MetalGradient/8163193/ButtonGradientTest.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,13 +21,17 @@
  * questions.
  */
 
-import java.awt.BorderLayout;
+import java.awt.Image;
+import java.awt.Robot;
+import java.awt.Rectangle;
 import java.awt.Color;
+import java.awt.Point;
+import java.awt.Dimension;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
-import java.awt.Rectangle;
-import java.awt.Robot;
+import java.awt.BorderLayout;
 import java.awt.image.BufferedImage;
+import java.awt.image.MultiResolutionImage;
 import java.util.List;
 import javax.swing.JButton;
 import javax.swing.JFrame;
@@ -38,18 +42,20 @@
 
 /*
  * @test
- * @bug 8163193
+ * @bug 8163193 8165213
  * @key headful
  * @summary Metal L&F gradient is lighter on HiDPI display
  * @run main/othervm -Dsun.java2d.uiScale=2 ButtonGradientTest
  */
 public class ButtonGradientTest {
-
     private static JFrame frame;
     private static JButton button;
+    private static List<Image> images;
+    private static Robot robot;
 
     public static void main(String[] args) throws Exception {
         try {
+            robot = new Robot();
             testGradient();
         } finally {
             SwingUtilities.invokeAndWait(() -> {
@@ -61,11 +67,10 @@
     }
 
     private static void testGradient() throws Exception {
-        Robot robot = new Robot();
-        robot.setAutoDelay(50);
-
+        // Create and show the GUI
         SwingUtilities.invokeAndWait(ButtonGradientTest::createAndShowGUI);
         robot.waitForIdle();
+        robot.delay(500);
 
         Rectangle rect = getButtonBounds();
         List<?> gradient = (List) UIManager.get("Button.gradient");
@@ -73,11 +78,15 @@
         Color c1 = (Color) gradient.get(2);
         Color c2 = (Color) gradient.get(3);
         int mid = (int) (ratio * rect.height);
+        // Get the expected gradient color
+        Color gradientColor = getGradientColor(rect.width, mid, c1, c2);
 
-        Color gradientColor = getGradientColor(rect.width, mid, c1, c2);
+        // Get color from robot captured hidpi image of the button
+        getImageFromRobot();
         int x = rect.x + rect.width / 2;
         int y = rect.y + mid / 2;
-        Color buttonColor = robot.getPixelColor(x, y);
+        Color buttonColor = new Color(((BufferedImage)(images.get(1))).getRGB(
+                (int)(x), (int)(y)));
 
         if (!similarColors(buttonColor, gradientColor)) {
             throw new RuntimeException("Button gradient is changed!");
@@ -103,6 +112,26 @@
         frame.setVisible(true);
     }
 
+    private static void getImageFromRobot() {
+        try {
+            Point butLoc = button.getLocationOnScreen();
+            Dimension butSize = button.getSize();
+            MultiResolutionImage multiResolutionImage =
+                    robot.createMultiResolutionScreenCapture(
+                            new Rectangle((int)butLoc.getX(),
+                                    (int)butLoc.getY(), (int)butSize.getWidth(),
+                                    (int)butSize.getHeight()));
+            images = multiResolutionImage.getResolutionVariants();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+        if(images.size() < 2) {
+            throw new RuntimeException("HiDpi Image not captured - " +
+                    "Check is this HiDpi display system?");
+        }
+    }
+
     private static Rectangle getButtonBounds() throws Exception {
         Rectangle[] rectangles = new Rectangle[1];
         SwingUtilities.invokeAndWait(() -> {
@@ -113,7 +142,8 @@
     }
 
     private static Color getGradientColor(int w, int h, Color c1, Color c2) {
-        GradientPaint gradient = new GradientPaint(0, 0, c1, 0, h, c2, true);
+        GradientPaint gradient = new GradientPaint(0, 0, c1, 0, h, c2,
+                true);
         BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
         Graphics2D g = img.createGraphics();
         g.setPaint(gradient);
@@ -129,6 +159,6 @@
     }
 
     private static boolean similar(int i1, int i2) {
-        return Math.abs(i2 - i1) < 7;
+        return Math.abs(i2 - i1) < 6;
     }
-}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/nimbus/AbstractRegionPainter/PaintContextScaleValidation.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+
+import javax.swing.JComponent;
+import javax.swing.plaf.nimbus.AbstractRegionPainter;
+
+/**
+ * @test
+ * @bug 8134256
+ */
+public final class PaintContextScaleValidation extends AbstractRegionPainter {
+
+    public static void main(final String[] args) {
+        final PaintContextScaleValidation t = new PaintContextScaleValidation();
+        t.test(0, 0);
+        t.test(0, 1);
+        t.test(1, 0);
+    }
+
+    private void test(final double maxH, final double maxV) {
+        try {
+            new PaintContext(new Insets(1, 1, 1, 1), new Dimension(1, 1), false,
+                             null, maxH, maxV);
+        } catch (final IllegalArgumentException ignored) {
+            return; // expected exception
+        }
+        throw new RuntimeException("IllegalArgumentException was not thrown");
+    }
+
+    @Override
+    protected PaintContext getPaintContext() {
+        return null;
+    }
+
+    @Override
+    protected void doPaint(final Graphics2D g, final JComponent c,
+                           final int width, final int height,
+                           final Object[] extendedCacheKeys) {
+    }
+}
--- a/jdk/test/javax/swing/plaf/nimbus/Test6741426.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/plaf/nimbus/Test6741426.java	Sat Sep 09 14:36:45 2017 +0200
@@ -25,12 +25,12 @@
    @bug 6741426
    @summary Tests reusing Nimbus borders across different components (JComboBox border set on a JTextField)
    @author Peter Zhelezniakov
-   @modules java.desktop/com.sun.java.swing.plaf.nimbus
    @run main Test6741426
 */
 
-import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;
 import javax.swing.*;
+import javax.swing.plaf.nimbus.NimbusLookAndFeel;
+
 import java.awt.image.BufferedImage;
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/nimbus/TestDisabledToolTipBorder.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,196 @@
+/*
+ * 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 8058785
+ * @summary Displaying border around the disabled component's tool tip text
+ * @run main/manual TestDisabledToolTipBorder
+ */
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import java.awt.Insets;
+
+public class TestDisabledToolTipBorder {
+    private static TestUI test;
+    public static void main(String args[]) throws Exception {
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        test = new TestUI(latch);
+        SwingUtilities.invokeAndWait(() -> {
+            try {
+                test.createUI();
+            } catch (Exception ex) {
+                throw new RuntimeException("Exception while creating UI");
+            }
+        });
+
+        boolean status = latch.await(2, TimeUnit.MINUTES);
+        if (!status) {
+            System.out.println("Test timed out.");
+        }
+
+        if (test.testResult == false) {
+            disposeUI();
+            throw new RuntimeException("Test Failed.");
+        }
+    }
+
+    public static void disposeUI() throws Exception {
+        SwingUtilities.invokeAndWait(() -> {
+            try {
+                if(test != null) {
+                    test.disposeUI();
+                }
+            } catch (Exception ex) {
+                throw new RuntimeException("Exception while disposing UI");
+            }
+        });
+    }
+}
+
+class TestUI {
+
+    private static JFrame mainFrame;
+    private static JPanel mainControlPanel;
+
+    private static JTextArea instructionTextArea;
+
+    private static JPanel resultButtonPanel;
+    private static JButton passButton;
+    private static JButton failButton;
+
+    private GridBagConstraints gbc;
+    private static GridBagLayout layout;
+    private final CountDownLatch latch;
+    public boolean testResult = false;
+
+    public final void initialize() throws Exception {
+        // Apply nimbus look and feel
+        UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
+    }
+
+    public TestUI(CountDownLatch latch) throws Exception {
+        this.latch = latch;
+
+        // initialize the UI
+        initialize();
+    }
+
+    public final void createUI() throws Exception {
+        mainFrame = new JFrame();
+
+        layout = new GridBagLayout();
+        mainControlPanel = new JPanel(layout);
+        resultButtonPanel = new JPanel(layout);
+
+        gbc = new GridBagConstraints();
+        // Create Test instructions
+        String instructions
+                = "Move cursor over disabled button.\n"
+                + "Check if there is a border around the tooltip text \n"
+                + "If yes, click on 'pass' else click on 'fail'\n";
+
+        instructionTextArea = new JTextArea();
+        instructionTextArea.setText(instructions);
+        instructionTextArea.setEditable(false);
+        instructionTextArea.setBorder(BorderFactory.
+                createTitledBorder("Test Instructions"));
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        mainControlPanel.add(instructionTextArea, gbc);
+
+        // Add customization to this test ui
+        customize();
+
+        // Create resultButtonPanel with Pass, Fail buttons
+        passButton = new JButton("Pass");
+        passButton.setActionCommand("Pass");
+        passButton.addActionListener((ActionEvent e) -> {
+            System.out.println("Pass Button pressed!");
+            testResult = true;
+            latch.countDown();
+            disposeUI();
+        });
+
+        failButton = new JButton("Fail");
+        failButton.setActionCommand("Fail");
+        failButton.addActionListener((ActionEvent e) -> {
+            System.out.println("Fail Button pressed!");
+            testResult = false;
+            latch.countDown();
+            disposeUI();
+        });
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        resultButtonPanel.add(passButton, gbc);
+
+        gbc.gridx = 1;
+        gbc.gridy = 0;
+        resultButtonPanel.add(failButton, gbc);
+
+        gbc.gridx = 0;
+        gbc.gridy = 2;
+        mainControlPanel.add(resultButtonPanel, gbc);
+
+        mainFrame.add(mainControlPanel);
+        mainFrame.pack();
+        mainFrame.setVisible(true);
+    }
+
+    public void disposeUI() {
+        mainFrame.dispose();
+    }
+
+    private void customize() throws Exception {
+        // Add custom panel for the main control panel
+        JPanel customButtonPanel = new JPanel(layout);
+
+        // Customize the test UI title
+        mainFrame.setTitle("TestDisabledToolTipBorder");
+
+        // Adding the disabled button along with tool tip text
+        JButton disabledButton = new JButton("Disabled Button");
+        disabledButton.setToolTipText("TooltipText");
+        disabledButton.setMargin(new Insets(30, 30, 30, 30));
+        disabledButton.setEnabled(false);
+
+        gbc.gridx = 0;
+        gbc.gridy = 0;
+        customButtonPanel.add(disabledButton, gbc);
+
+        gbc.gridx = 0;
+        gbc.gridy = 1;
+        mainControlPanel.add(customButtonPanel, gbc);
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/nimbus/TestNimbusOverride.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,112 @@
+/*
+ * 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 8043315
+ * @summary  Verifies if setting Nimbus.Overrides property affects
+ *           keymap installation
+ * @run main TestNimbusOverride
+ */
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.event.ActionEvent;
+import java.awt.Robot;
+import java.awt.event.KeyEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JEditorPane;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.KeyStroke;
+import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.text.Keymap;
+
+
+public class TestNimbusOverride extends JFrame
+{
+    private static TestNimbusOverride tf;
+    private static boolean passed = false;
+
+    public static void main(String [] args) throws Exception {
+        Robot robot = new Robot();
+        SwingUtilities.invokeAndWait(() -> {
+            try {
+                UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            tf = new TestNimbusOverride();
+            tf.pack();
+            tf.setVisible(true);
+        });
+        robot.setAutoDelay(100);
+        robot.waitForIdle();
+        robot.keyPress(KeyEvent.VK_SPACE);
+        robot.keyRelease(KeyEvent.VK_SPACE);
+        robot.waitForIdle();
+        SwingUtilities.invokeAndWait(() -> tf.dispose());
+        if (!passed) {
+                throw new RuntimeException(
+                        "Setting Nimbus.Overrides property affects custom keymap installation");
+            }
+    }
+
+    public TestNimbusOverride()
+    {
+        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+
+        /*
+         * Create a frame containing a JEditorPane, and override the action for the space bar to show
+         * a dialog.
+         */
+        JEditorPane pp = new JEditorPane();
+        UIDefaults defaults = new UIDefaults();
+
+        pp.putClientProperty("Nimbus.Overrides", defaults);
+
+        JPanel contentPanel = new JPanel();
+        contentPanel.setLayout(new BorderLayout());
+        setContentPane(contentPanel);
+
+        contentPanel.setPreferredSize(new Dimension(400, 300));
+        contentPanel.add(pp, BorderLayout.CENTER);
+
+        Keymap origKeymap = pp.getKeymap();
+        Keymap km = JEditorPane.addKeymap("Test keymap", origKeymap);
+
+        km.addActionForKeyStroke(KeyStroke.getKeyStroke(' '), new AbstractAction("SHOW_SPACE") {
+            @Override
+            public void actionPerformed(ActionEvent e)
+            {
+                passed = true;
+            }
+        });
+
+        pp.setKeymap(km);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/text/html/StyleSheet/BackgroundImage/BackgroundImagePosition.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.EventQueue;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import javax.imageio.ImageIO;
+import javax.swing.JEditorPane;
+import javax.swing.text.html.HTMLEditorKit;
+
+/**
+ * @test
+ * @bug 8134256
+ * @summary Different "background-position" should produce different pages
+ */
+public final class BackgroundImagePosition {
+
+    static final List<String> pos = List.of("", "-2", "-1", "1px", "2px", "3px",
+                                            "1em", "2em", "3em", "10%", "55%",
+                                            "-1em", "-2em", "-3em", "-10%");
+    static final int SIZE = 300;
+
+    public static void main(final String[] args) throws Exception {
+        // The image which we will place on the page
+        final BufferedImage bi = new BufferedImage(50, 50,
+                                                   BufferedImage.TYPE_INT_ARGB);
+        final Graphics2D g = bi.createGraphics();
+        g.setColor(Color.GREEN);
+        g.fillRect(0, 0, 50, 50);
+        g.dispose();
+        final File file = new File("file.png");
+        ImageIO.write(bi, "png", file);
+        for (final String x : pos) {
+            final BufferedImage img1 = test(x, x);
+            for (final String y : pos) {
+                // Different positions should produce different pages
+                if (!x.equals(y)) {
+                    compareImages(img1, test(x, y));
+                    compareImages(img1, test(y, x));
+                }
+            }
+        }
+    }
+
+    /**
+     * Throws an exception if the images are the same.
+     */
+    static void compareImages(final BufferedImage img1,
+                              final BufferedImage img2) throws IOException {
+        for (int imgX = 0; imgX < SIZE; ++imgX) {
+            for (int imgY = 0; imgY < SIZE; ++imgY) {
+                if (img1.getRGB(imgX, imgY) != img2.getRGB(imgX, imgY)) {
+                    return;
+                }
+            }
+        }
+        ImageIO.write(img1, "png", new File("img1.png"));
+        ImageIO.write(img2, "png", new File("img2.png"));
+        throw new RuntimeException("Same images for different size");
+    }
+
+    static BufferedImage test(final String x, final String y) throws Exception {
+        final BufferedImage bi = new BufferedImage(SIZE, SIZE,
+                                                   BufferedImage.TYPE_INT_ARGB);
+        EventQueue.invokeAndWait(() -> {
+            try {
+                final JEditorPane jep = new JEditorPane();
+
+                final HTMLEditorKit kit = new HTMLEditorKit();
+                jep.setEditorKit(kit);
+                jep.setText(
+                        "<style>body {"
+                                + "background-image: url(file:./file.png);"
+                                + "background-repeat: no-repeat;"
+                                + "background-position: " + x + " " + y + ";"
+                                + "background-color: #FF0000;"
+                                + "}</style><body></body>");
+                jep.setSize(SIZE, SIZE);
+
+                final Graphics2D graphics = bi.createGraphics();
+                jep.paint(graphics);
+                graphics.dispose();
+            } catch (final Exception e) {
+                throw new RuntimeException(e);
+            }
+        });
+        return bi;
+    }
+}
--- a/jdk/test/javax/swing/text/html/StyleSheet/bug4936917.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/javax/swing/text/html/StyleSheet/bug4936917.java	Sat Sep 09 14:36:45 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,6 +21,7 @@
  * questions.
  */
 /* @test
+   @key headful
    @bug 4936917 7190578 8174717
    @summary  Tests if background is correctly painted when <BODY> has css margins
    @author Denis Sharypov
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/applet/TEST.properties	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,2 @@
+modules=java.desktop
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/awt/shell/FileSystemViewMemoryLeak.java	Sat Sep 09 14:36:45 2017 +0200
@@ -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 8175015
+ * @summary FileSystemView.isDrive(File) memory leak on "C:\" file reference
+ * @modules java.desktop/sun.awt.shell
+ * @requires (os.family == "windows")
+ * @run main/othervm  -Xmx8m FileSystemViewMemoryLeak
+ */
+import java.io.File;
+import java.text.NumberFormat;
+import javax.swing.filechooser.FileSystemView;
+
+public class FileSystemViewMemoryLeak {
+
+    public static void main(String[] args) {
+        test();
+    }
+
+    private static void test() {
+
+        File root = new File("C:\\");
+        System.out.println("Root Exists: " + root.exists());
+        System.out.println("Root Absolute Path: " + root.getAbsolutePath());
+        System.out.println("Root Is Directory?: " + root.isDirectory());
+
+        FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+        NumberFormat nf = NumberFormat.getNumberInstance();
+
+        int iMax = 50000;
+        long lastPercentFinished = 0L;
+        for (int i = 0; i < iMax; i++) {
+
+            long percentFinished = Math.round(((i * 1000d) / (double) iMax));
+
+            if (lastPercentFinished != percentFinished) {
+                double pf = ((double) percentFinished) / 10d;
+                String pfMessage = String.valueOf(pf) + " % (" + i + "/" + iMax + ")";
+
+                long totalMemory = Runtime.getRuntime().totalMemory() / 1024;
+                long freeMemory = Runtime.getRuntime().freeMemory() / 1024;
+                long maxMemory = Runtime.getRuntime().maxMemory() / 1024;
+                String memMessage = "[Memory Used: " + nf.format(totalMemory) +
+                                    " kb Free=" + nf.format(freeMemory) +
+                                    " kb Max: " + nf.format(maxMemory) + " kb]";
+
+                System.out.println(pfMessage + " " + memMessage);
+                lastPercentFinished = percentFinished;
+            }
+
+            boolean floppyDrive = fileSystemView.isFloppyDrive(root);
+            boolean computerNode = fileSystemView.isComputerNode(root);
+
+            // "isDrive()" seems to be the painful method...
+            boolean drive = fileSystemView.isDrive(root);
+        }
+    }
+}
+
--- a/jdk/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/sun/java2d/X11SurfaceData/SharedMemoryPixmapsTest/SharedMemoryPixmapsTest.sh	Sat Sep 09 14:36:45 2017 +0200
@@ -38,9 +38,8 @@
 ${TESTJAVA}/bin/javac -d ${TESTCLASSES} SharedMemoryPixmapsTest.java
 cd ${TESTCLASSES}
 
-NO_J2D_DGA=true
 J2D_PIXMAPS=shared
-export NO_J2D_DGA J2D_PIXMAPS
+export J2D_PIXMAPS
 
 ${TESTJAVA}/bin/java ${TESTVMOPTS} SharedMemoryPixmapsTest
 
--- a/jdk/test/sun/nio/cs/TestCharsetMapping.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/jdk/test/sun/nio/cs/TestCharsetMapping.java	Sat Sep 09 14:36:45 2017 +0200
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 8186801
+ * @bug 8186801 8186751
  * @summary Test the charset mappings
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Config/ReadConfInUTF16Env.java	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.Provider;
+import java.security.Security;
+
+public class ReadConfInUTF16Env {
+    public static void main(String argv[]) {
+        Provider p = Security.getProvider("SunPKCS11");
+        if (p == null) {
+            p = Security.getProvider("SunPKCS11-Solaris");
+            if (p == null) {
+                System.out.println("Skipping test - no PKCS11 provider available");
+                return;
+            }
+        }
+
+        System.out.println(p.getName());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Config/ReadConfInUTF16Env.sh	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# @test
+# @bug 8187023
+# @summary Pkcs11 config file should be assumed in ISO-8859-1
+# @build ReadConfInUTF16Env
+# @run shell ReadConfInUTF16Env.sh
+
+# jtreg does not like -Dfile.encoding=UTF-16 inside a @run main line,
+# testlibrary.ProcessTools.createJavaProcessBuilder() also had troubles
+# executing a subprocess with -Dfile.encoding=UTF-16 option added,
+# therefore a shell test is written.
+
+$TESTJAVA/bin/java $TESTVMOPTS -cp $TESTCLASSES \
+  -Dfile.encoding=UTF-16 \
+  ReadConfInUTF16Env
+
--- a/make/CompileJavaModules.gmk	Fri Sep 01 14:13:40 2017 +0000
+++ b/make/CompileJavaModules.gmk	Sat Sep 09 14:36:45 2017 +0200
@@ -42,9 +42,9 @@
 
 ################################################################################
 
-java.base_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline
-java.base_COPY := .icu .dat .spp content-types.properties hijrah-config-islamic-umalqura.properties
-java.base_CLEAN := intrinsic.properties
+java.base_ADD_JAVAC_FLAGS += -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*' -XDstringConcat=inline
+java.base_COPY += .icu .dat .spp content-types.properties hijrah-config-islamic-umalqura.properties
+java.base_CLEAN += intrinsic.properties
 
 java.base_EXCLUDE_FILES += \
   $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java
@@ -85,20 +85,20 @@
 
 ################################################################################
 
-java.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.compiler_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 
 ################################################################################
 
-java.datatransfer_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
-java.datatransfer_COPY := flavormap.properties
+java.datatransfer_ADD_JAVAC_FLAGS += -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
+java.datatransfer_COPY += flavormap.properties
 
 ################################################################################
 
-java.desktop_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference \
+java.desktop_ADD_JAVAC_FLAGS += -Xdoclint:all/protected,-reference \
     '-Xdoclint/package:java.*,javax.*' -Xlint:exports \
     --doclint-format html4
-java.desktop_COPY := .gif .png .wav .txt .xml .css .pf
-java.desktop_CLEAN := iio-plugin.properties cursors.properties
+java.desktop_COPY += .gif .png .wav .txt .xml .css .pf
+java.desktop_CLEAN += iio-plugin.properties cursors.properties
 
 java.desktop_EXCLUDES += \
     java/awt/doc-files \
@@ -230,50 +230,50 @@
 
 ################################################################################
 
-java.scripting_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
-java.scripting_COPY := .js
-java.scripting_CLEAN := .properties
+java.scripting_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.scripting_COPY += .js
+java.scripting_CLEAN += .properties
 
 ################################################################################
 
-java.instrument_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.instrument_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 
 ################################################################################
 
-java.logging_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
+java.logging_ADD_JAVAC_FLAGS += -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
 
 ################################################################################
 
-java.management_ADD_JAVAC_FLAGS := -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
+java.management_ADD_JAVAC_FLAGS += -Xdoclint:all/protected,-reference '-Xdoclint/package:java.*,javax.*'
 
 ################################################################################
 
-java.management.rmi_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:javax.*'
+java.management.rmi_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:javax.*'
 
 ################################################################################
 
-java.prefs_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.prefs_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 
 ################################################################################
 
-java.transaction_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.transaction_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 
 ################################################################################
 
-java.sql_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.sql_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 java.sql_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
 
 ################################################################################
 
-java.sql.rowset_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
-java.sql.rowset_CLEAN_FILES := $(wildcard \
+java.sql.rowset_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.sql.rowset_CLEAN_FILES += $(wildcard \
     $(JDK_TOPDIR)/src/java.sql.rowset/share/classes/com/sun/rowset/*.properties \
     $(JDK_TOPDIR)/src/java.sql.rowset/share/classes/javax/sql/rowset/*.properties)
 
 ################################################################################
 
-java.rmi_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
-java.rmi_CLEAN_FILES := $(wildcard \
+java.rmi_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.rmi_CLEAN_FILES += $(wildcard \
     $(JDK_TOPDIR)/src/java.rmi/share/classes/sun/rmi/registry/resources/*.properties \
     $(JDK_TOPDIR)/src/java.rmi/share/classes/sun/rmi/server/resources/*.properties)
 
@@ -281,8 +281,8 @@
 
 java.corba_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
 
-java.corba_COPY := .prp
-java.corba_CLEAN := .properties
+java.corba_COPY += .prp
+java.corba_CLEAN += .properties
 
 java.corba_EXCLUDES += \
     com/sun/corba/se/PortableActivationIDL \
@@ -301,99 +301,99 @@
 ################################################################################
 
 java.xml_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
-java.xml_CLEAN := .properties
+java.xml_CLEAN += .properties
 
 ################################################################################
 
 java.xml.bind_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
-java.xml.bind_CLEAN := .properties
+java.xml.bind_CLEAN += .properties
 
 ################################################################################
 
 java.xml.soap_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
-java.xml.soap_CLEAN := .properties
+java.xml.soap_CLEAN += .properties
 
 ################################################################################
 
 java.xml.ws_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
-java.xml.ws_COPY := .xml
-java.xml.ws_CLEAN := .properties
+java.xml.ws_COPY += .xml
+java.xml.ws_CLEAN += .properties
 
 ################################################################################
 
-java.naming_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*' -Xlint:-exports
-java.naming_CLEAN := jndiprovider.properties
+java.naming_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*' -Xlint:-exports
+java.naming_CLEAN += jndiprovider.properties
 
 ################################################################################
 
-java.security.saaj_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
-java.security.saaj_CLEAN := .properties
+java.security.saaj_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.security.saaj_CLEAN += .properties
 
 ################################################################################
 
-java.security.jgss_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.security.jgss_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 
 ################################################################################
 
-java.smartcardio_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.smartcardio_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
 
 ################################################################################
 
-java.xml.crypto_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
-java.xml.crypto_COPY := .dtd .xml
-java.xml.crypto_CLEAN := .properties
+java.xml.crypto_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:java.*,javax.*'
+java.xml.crypto_COPY += .dtd .xml
+java.xml.crypto_CLEAN += .properties
 
 ################################################################################
 
-jdk.charsets_COPY := .dat
+jdk.charsets_COPY += .dat
 
 ################################################################################
 
 ################################################################################
 
-jdk.compiler_ADD_JAVAC_FLAGS := -Xdoclint:all/protected '-Xdoclint/package:-com.sun.tools.*,-jdk.internal.*' \
+jdk.compiler_ADD_JAVAC_FLAGS += -Xdoclint:all/protected '-Xdoclint/package:-com.sun.tools.*,-jdk.internal.*' \
     -XDstringConcat=inline
-jdk.compiler_CLEAN_FILES := $(wildcard \
+jdk.compiler_CLEAN_FILES += $(wildcard \
     $(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
         sun/tools/serialver/resources))
 
 ################################################################################
 
-jdk.hotspot.agent_ADD_JAVAC_FLAGS := $(DISABLE_WARNINGS),-overrides
-jdk.hotspot.agent_COPY := .gif .png sa.js .properties
+jdk.hotspot.agent_ADD_JAVAC_FLAGS += $(DISABLE_WARNINGS),-overrides
+jdk.hotspot.agent_COPY += .gif .png sa.js .properties
 
 ################################################################################
 
-jdk.editpad_COPY := .properties
+jdk.editpad_COPY += .properties
 
 ################################################################################
 
-jdk.jshell_COPY := .jsh .properties
+jdk.jshell_COPY += .jsh .properties
 
 ################################################################################
 
-jdk.internal.le_COPY := .properties
+jdk.internal.le_COPY += .properties
 
 ################################################################################
 
-jdk.jcmd_COPY := _options
+jdk.jcmd_COPY += _options
 
 ################################################################################
 
-jdk.dynalink_CLEAN := .properties
+jdk.dynalink_CLEAN += .properties
 
 ################################################################################
 
-jdk.javadoc_COPY := .xml .css .js .png
+jdk.javadoc_COPY += .xml .css .js .png
 
 ################################################################################
 
-jdk.jartool_ADD_JAVAC_FLAGS := -XDstringConcat=inline
+jdk.jartool_ADD_JAVAC_FLAGS += -XDstringConcat=inline
 
 ################################################################################
 
 jdk.rmic_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
-jdk.rmic_CLEAN := .properties
+jdk.rmic_CLEAN += .properties
 
 ################################################################################
 
@@ -421,16 +421,16 @@
 
 ################################################################################
 
-jdk.jconsole_COPY := .gif .png
+jdk.jconsole_COPY += .gif .png
 
-jdk.jconsole_CLEAN_FILES := $(wildcard \
+jdk.jconsole_CLEAN_FILES += $(wildcard \
     $(JDK_TOPDIR)/src/jdk.jconsole/share/classes/sun/tools/jconsole/resources/*.properties)
 
 ################################################################################
 
-jdk.jdeps_COPY := .txt
+jdk.jdeps_COPY += .txt
 
-jdk.jdeps_CLEAN_FILES := $(wildcard \
+jdk.jdeps_CLEAN_FILES += $(wildcard \
     $(JDK_TOPDIR)/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/resources/*.properties \
     $(JDK_TOPDIR)/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/*.properties)
 
@@ -447,15 +447,15 @@
 
 ################################################################################
 
-jdk.dev_CLEAN_FILES := $(wildcard \
+jdk.dev_CLEAN_FILES += $(wildcard \
     $(patsubst %, $(JDK_TOPDIR)/src/jdk.dev/share/classes/%/*.properties, \
         com/sun/tools/script/shell))
 
-jdk.dev_COPY := .js oqlhelp.html .txt
+jdk.dev_COPY += .js oqlhelp.html .txt
 
 ################################################################################
 
-jdk.internal.jvmstat_COPY := aliasmap
+jdk.internal.jvmstat_COPY += aliasmap
 
 ################################################################################
 
@@ -465,11 +465,11 @@
 # The exports are needed since JVMCI is dynamically exported (see
 # jdk.vm.ci.services.internal.ReflectionAccessJDK::openJVMCITo).
 
-jdk.internal.vm.ci_ADD_JAVAC_FLAGS := -parameters -Xlint:-exports -XDstringConcat=inline
+jdk.internal.vm.ci_ADD_JAVAC_FLAGS += -parameters -Xlint:-exports -XDstringConcat=inline
 
 ################################################################################
 
-jdk.internal.vm.compiler_ADD_JAVAC_FLAGS := -parameters -XDstringConcat=inline \
+jdk.internal.vm.compiler_ADD_JAVAC_FLAGS += -parameters -XDstringConcat=inline \
     --add-exports jdk.internal.vm.ci/jdk.vm.ci.aarch64=jdk.internal.vm.compiler \
     --add-exports jdk.internal.vm.ci/jdk.vm.ci.amd64=jdk.internal.vm.compiler \
     --add-exports jdk.internal.vm.ci/jdk.vm.ci.code=jdk.internal.vm.compiler \
@@ -528,7 +528,7 @@
 # The exports are needed since JVMCI is dynamically exported (see
 # jdk.vm.ci.services.internal.ReflectionAccessJDK::openJVMCITo).
 
-jdk.aot_ADD_JAVAC_FLAGS := -parameters -XDstringConcat=inline \
+jdk.aot_ADD_JAVAC_FLAGS += -parameters -XDstringConcat=inline \
     --add-exports jdk.internal.vm.ci/jdk.vm.ci.aarch64=jdk.internal.vm.compiler,jdk.aot \
     --add-exports jdk.internal.vm.ci/jdk.vm.ci.amd64=jdk.internal.vm.compiler,jdk.aot \
     --add-exports jdk.internal.vm.ci/jdk.vm.ci.code=jdk.internal.vm.compiler,jdk.aot \
@@ -547,21 +547,21 @@
 ################################################################################
 
 jdk.xml.bind_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
-jdk.xml.bind_CLEAN := .properties
-jdk.xml.bind_COPY := .xsd JAXBContextFactory.java ZeroOneBooleanAdapter.java
+jdk.xml.bind_CLEAN += .properties
+jdk.xml.bind_COPY += .xsd JAXBContextFactory.java ZeroOneBooleanAdapter.java
 
 ################################################################################
 
 jdk.xml.ws_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
-jdk.xml.ws_CLEAN := .properties
+jdk.xml.ws_CLEAN += .properties
 
 ################################################################################
 
-sun.charsets_COPY := .dat
+sun.charsets_COPY += .dat
 
 ################################################################################
 
-jdk.localedata_COPY := _dict _th
+jdk.localedata_COPY += _dict _th
 # Exclude BreakIterator classes that are just used in compile process to generate
 # data files and shouldn't go in the product
 jdk.localedata_EXCLUDE_FILES += sun/text/resources/ext/BreakIteratorRules_th.java
--- a/make/RunTests.gmk	Fri Sep 01 14:13:40 2017 +0000
+++ b/make/RunTests.gmk	Sat Sep 09 14:36:45 2017 +0200
@@ -328,9 +328,9 @@
     $1_JTREG_JOBS := 50
   endif
 
-  # Make sure MaxRAMFraction is high enough to not cause OOM or swapping since
+  # Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since
   # we may end up with a lot of JVM's
-  $1_JTREG_MAX_RAM_FRACTION := $$(shell $$(EXPR) $$($1_JTREG_JOBS) \* 4)
+  $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS))
 
   JTREG_TIMEOUT ?= 4
   JTREG_VERBOSE ?= fail,error,summary
@@ -344,7 +344,7 @@
   $1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
       -verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
       -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT) \
-      -vmoption:-XX:MaxRAMFraction=$$($1_JTREG_MAX_RAM_FRACTION)
+      -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
 
   $1_JTREG_BASIC_OPTIONS += -automatic -keywords:\!ignore -ignore:quiet
 
--- a/nashorn/.hgtags	Fri Sep 01 14:13:40 2017 +0000
+++ b/nashorn/.hgtags	Sat Sep 09 14:36:45 2017 +0200
@@ -437,3 +437,4 @@
 47f8d75b8765ff8410ebc89619e537321cc10c32 jdk-9+181
 9133969febb50ec683bfd79fc506771fb4f7de6c jdk-10+20
 03d3d3c6bc5a06c1c763ef4615bb43672efe6b3f jdk-10+21
+bd933afd9e2ea9b3ce0ebf8deee5a7f9c7dda76c jdk-10+22
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LengthNotWritableFilter.java	Fri Sep 01 14:13:40 2017 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LengthNotWritableFilter.java	Sat Sep 09 14:36:45 2017 +0200
@@ -143,7 +143,7 @@
 
     @Override
     public ArrayData delete(final int index) {
-        extraElements.remove(index);
+        extraElements.remove(ArrayIndex.toLongIndex(index));
         underlying = underlying.delete(index);
         return this;
     }
--- a/nashorn/test/script/basic/JDK-8035312.js.EXPECTED	Fri Sep 01 14:13:40 2017 +0000
+++ b/nashorn/test/script/basic/JDK-8035312.js.EXPECTED	Sat Sep 09 14:36:45 2017 +0200
@@ -58,37 +58,37 @@
 
 >>> Pop test
 Popping from 1,2,3
-	array is now [1,2,3] length is = 3
+	array is now [1,2,] length is = 3
 
 class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
-Popping from 1,2,3
-	array is now [1,2,3] length is = 3
+Popping from 1,2,
+	array is now [1,2,] length is = 3
 
 class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
 x.length === 3 (should be 3)
-x === 1,2,3
-Popping from 1,2,3
-	array is now [1,2,3] length is = 3
+x === 1,2,
+Popping from 1,2,
+	array is now [1,2,] length is = 3
 
 class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
-Popping from 1,2,3
-	array is now [1,2,3] length is = 3
+Popping from 1,2,
+	array is now [1,2,] length is = 3
 
 class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
-Popping from 1,2,3
-	array is now [1,2,3] length is = 3
+Popping from 1,2,
+	array is now [1,2,] length is = 3
 
 class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
-Popping from 1,2,3
-	array is now [1,2,3] length is = 3
+Popping from 1,2,
+	array is now [1,2,] length is = 3
 
 class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
-Popping from 1,2,3
-	array is now [1,2,3] length is = 3
+Popping from 1,2,
+	array is now [1,2,] length is = 3
 
 class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
 x.length === 3 (should be 3)
-x === 1,2,3
+x === 1,2,
 class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
 Writing 0
 class jdk.nashorn.internal.runtime.arrays.LengthNotWritableFilter
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8169233.js	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8169233 : LengthNotWritableFilter: extraElements.remove(index) has no effect
+ *
+ * @test
+ * @run
+ */
+
+var array = ['a', 'b', 'c', 'd'];
+Object.defineProperty(array, "length", {writable: false});
+try {
+    array.push('e');
+} catch (e) {
+}
+print("array : "+array);
+print("length : " + array.length);
+delete array[0];
+print("array : "+array);
+print("length : " + array.length);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8169233.js.EXPECTED	Sat Sep 09 14:36:45 2017 +0200
@@ -0,0 +1,4 @@
+array : a,b,c,d
+length : 4
+array : ,b,c,d
+length : 4