Merge jdk9-b23
authorduke
Wed, 05 Jul 2017 19:50:06 +0200
changeset 25456 39cfdc2dcaf3
parent 25455 acabdf6da9db (diff)
parent 25314 ad598848b091 (current diff)
child 25457 63b695684dc7
child 25458 cf7bdeab1f2c
child 25460 e479cd2b829d
child 25463 cd49b8f3aff1
child 25502 92dc8bd62c69
child 25512 50fce29ede72
child 25513 296740f55f9b
child 25582 4efd3f7a2c81
child 25584 cd30f3e163d4
child 25585 0968d8ab046a
child 25589 8f7fca66dc12
child 25590 fe5f84c49b8e
child 25595 ea2da7ec3c62
child 25596 684514439dc6
child 25599 55e5bb3ef9d0
child 25600 7f93cb0536fd
Merge
--- a/.hgtags-top-repo	Wed Jul 05 19:48:51 2017 +0200
+++ b/.hgtags-top-repo	Wed Jul 05 19:50:06 2017 +0200
@@ -264,3 +264,4 @@
 75a08df650eb3126bab0c4d15241f5886162393c jdk9-b19
 ee4fd72b2ec3d92497f37163352f294aa695c6fb jdk9-b20
 9052803f4d01feda28b3d65f2b64dd457d21c7b6 jdk9-b21
+8e4bdab4c362aadde2d321f968cd503a2f779e2f jdk9-b22
--- a/common/autoconf/hotspot-spec.gmk.in	Wed Jul 05 19:48:51 2017 +0200
+++ b/common/autoconf/hotspot-spec.gmk.in	Wed Jul 05 19:50:06 2017 +0200
@@ -69,8 +69,8 @@
 # Yet another name for arch used for an extra subdir below the jvm lib.
 # Uses i386 and amd64, instead of x86 and x86_64.
 LIBARCH=$(OPENJDK_TARGET_CPU_LEGACY_LIB)
-# Old name for OPENJDK_TARGET_CPU, uses i586 and amd64, instead of x86 and x86_64.
-ARCH=$(OPENJDK_TARGET_CPU_LEGACY)
+# Set the cpu architecture
+ARCH=$(OPENJDK_TARGET_CPU_ARCH)
 # Legacy setting for building for a 64 bit machine.
 # If yes then this expands to _LP64:=1
 @LP64@
--- a/corba/.hgtags	Wed Jul 05 19:48:51 2017 +0200
+++ b/corba/.hgtags	Wed Jul 05 19:50:06 2017 +0200
@@ -264,3 +264,4 @@
 eecc1b6adc7e193d00a0641eb0963add5a4c06e8 jdk9-b19
 87f36eecb1665012d01c5cf102494e591c943ea6 jdk9-b20
 3615a4e7f0542ca7552ad6454b742c73ee211d8e jdk9-b21
+ddc07abf4307855c0dc904cc5c96cc764023a930 jdk9-b22
--- a/get_source.sh	Wed Jul 05 19:48:51 2017 +0200
+++ b/get_source.sh	Wed Jul 05 19:50:06 2017 +0200
@@ -25,11 +25,34 @@
 # questions.
 #
 
+to_stderr() {
+    echo "$@" >&2
+}
+
+error() {
+    to_stderr "ERROR: $1"
+    exit ${2:-126}
+}
+
+warning() {
+    to_stderr "WARNING: $1"
+}
+
+version_field() {
+  # rev is typically omitted for minor and major releases
+  field=`echo ${1}.0 | cut -f ${2} -d .`
+  if expr 1 + $field >/dev/null 2> /dev/null; then
+    echo $field
+  else
+    echo -1
+  fi
+}
+
 # Version check
 
 # required
 reqdmajor=1
-reqdminor=5
+reqdminor=4
 reqdrev=0
 
 # requested
@@ -37,34 +60,39 @@
 rqstminor=6
 rqstrev=3
 
+
 # installed
-hgwhere="`which hg 2> /dev/null | grep -v '^no hg in '`"
+hgwhere="`command -v hg`"
 if [ "x$hgwhere" = "x" ]; then
-  echo "ERROR: Could not locate Mercurial command" >&2
-  exit 126
+  error "Could not locate Mercurial command"
 fi
 
-hgversion="`hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \(.*\))\$@\1@p'`"
+hgversion="`hg --version 2> /dev/null | sed -n -e 's@^Mercurial Distributed SCM (version \([^+]*\).*)\$@\1@p'`"
 if [ "x${hgversion}" = "x" ] ; then
-  echo "ERROR: Could not determine Mercurial version" >&2
-  exit 126
+  error "Could not determine Mercurial version of $hgwhere"
 fi
 
-hgmajor="`echo $hgversion | cut -f 1 -d .`"
-hgminor="`echo $hgversion | cut -f 2 -d .`"
-hgrev="`echo $hgversion.0 | cut -f 3 -d .`" # rev is omitted for minor and major releases
+hgmajor="`version_field $hgversion 1`"
+hgminor="`version_field $hgversion 2`"
+hgrev="`version_field $hgversion 3`"
+
+if [ $hgmajor -eq -1 -o $hgminor -eq -1 -o $hgrev -eq -1 ] ; then
+  error "Could not determine Mercurial version of $hgwhere from \"$hgversion\""
+fi
+
 
 # Require
 if [ $hgmajor -lt $reqdmajor -o \( $hgmajor -eq $reqdmajor -a $hgminor -lt $reqdminor \) -o \( $hgmajor -eq $reqdmajor -a $hgminor -eq $reqdminor -a $hgrev -lt $reqdrev \) ] ; then
-  echo "ERROR: Mercurial version $reqdmajor.$reqdminor.$reqdrev or later is required. $hgwhere is version $hgversion" >&2
-  exit 126
+  error "Mercurial version $reqdmajor.$reqdminor.$reqdrev or later is required. $hgwhere is version $hgversion"
 fi
 
+
 # Request
 if [ $hgmajor -lt $rqstmajor -o \( $hgmajor -eq $rqstmajor -a $hgminor -lt $rqstminor \) -o \( $hgmajor -eq $rqstmajor -a $hgminor -eq $rqstminor -a $hgrev -lt $rqstrev \) ] ; then
-  echo "WARNING: Mercurial version $rqstmajor.$rqstminor.$rqstrev or later is recommended. $hgwhere is version $hgversion" >&2
+  warning "Mercurial version $rqstmajor.$rqstminor.$rqstrev or later is recommended. $hgwhere is version $hgversion"
 fi
 
+
 # Get clones of all absent nested repositories (harmless if already exist)
 sh ./common/bin/hgforest.sh clone "$@" || exit $?
 
--- a/hotspot/.hgtags	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/.hgtags	Wed Jul 05 19:50:06 2017 +0200
@@ -424,3 +424,4 @@
 d4cffb3ae6213c66c7522ebffe0349360a45f0ef jdk9-b19
 c1af79d122ec9f715fa29312b5e91763f3a4dfc4 jdk9-b20
 17b4a5e831b398738feedb0afe75245744510153 jdk9-b21
+518d1fcc0799494f013e00e0a94a91b6f212d54f jdk9-b22
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_interface/G1YCType.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.gc_interface;
+
+//These definitions should be kept in sync with the definitions in the HotSpot
+//code.
+
+public enum G1YCType {
+  Normal ("Normal"),
+  InitialMark ("Initial Mark"),
+  DuringMark ("During Mark"),
+  Mixed ("Mixed"),
+  G1YCTypeEndSentinel ("Unknown");
+
+  private final String value;
+
+  G1YCType(String val) {
+    this.value = val;
+  }
+  public String value() {
+    return value;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_interface/GCCause.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.gc_interface;
+
+//These definitions should be kept in sync with the definitions in the HotSpot code.
+
+public enum GCCause {
+  _java_lang_system_gc ("System.gc()"),
+  _full_gc_alot ("FullGCAlot"),
+  _scavenge_alot ("ScavengeAlot"),
+  _allocation_profiler ("Allocation Profiler"),
+  _jvmti_force_gc ("JvmtiEnv ForceGarbageCollection"),
+  _gc_locker ("GCLocker Initiated GC"),
+  _heap_inspection ("Heap Inspection Initiated GC"),
+  _heap_dump ("Heap Dump Initiated GC"),
+
+  _no_gc ("No GC"),
+  _no_cause_specified ("Unknown GCCause"),
+  _allocation_failure ("Allocation Failure"),
+
+  _tenured_generation_full ("Tenured Generation Full"),
+  _metadata_GC_threshold ("Metadata GC Threshold"),
+
+  _cms_generation_full ("CMS Generation Full"),
+  _cms_initial_mark ("CMS Initial Mark"),
+  _cms_final_remark ("CMS Final Remark"),
+  _cms_concurrent_mark ("CMS Concurrent Mark"),
+
+  _old_generation_expanded_on_last_scavenge ("Old Generation Expanded On Last Scavenge"),
+  _old_generation_too_full_to_scavenge ("Old Generation Too Full To Scavenge"),
+  _adaptive_size_policy ("Ergonomics"),
+
+  _g1_inc_collection_pause ("G1 Evacuation Pause"),
+  _g1_humongous_allocation ("G1 Humongous Allocation"),
+
+  _last_ditch_collection ("Last ditch collection"),
+  _last_gc_cause ("ILLEGAL VALUE - last gc cause - ILLEGAL VALUE");
+
+  private final String value;
+
+  GCCause(String val) {
+    this.value = val;
+  }
+  public String value() {
+    return value;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_interface/GCName.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.gc_interface;
+
+//These definitions should be kept in sync with the definitions in the HotSpot code.
+
+public enum GCName {
+  ParallelOld ("ParallelOld"),
+  SerialOld ("SerialOld"),
+  PSMarkSweep ("PSMarkSweep"),
+  ParallelScavenge ("ParallelScavenge"),
+  DefNew ("DefNew"),
+  ParNew ("ParNew"),
+  G1New ("G1New"),
+  ConcurrentMarkSweep ("ConcurrentMarkSweep"),
+  G1Old ("G1Old"),
+  GCNameEndSentinel ("GCNameEndSentinel");
+
+  private final String value;
+
+  GCName(String val) {
+    this.value = val;
+  }
+  public String value() {
+    return value;
+  }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_interface/GCWhen.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.gc_interface;
+
+//These definitions should be kept in sync with the definitions in the HotSpot code.
+
+public enum GCWhen {
+  BeforeGC ("Before GC"),
+  AfterGC ("After GC"),
+  GCWhenEndSentinel ("GCWhenEndSentinel");
+
+  private final String value;
+
+  GCWhen(String val) {
+    this.value = val;
+  }
+  public String value() {
+    return value;
+  }
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_interface/ReferenceType.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.gc_interface;
+
+//These definitions should be kept in sync with the definitions in the HotSpot code.
+
+public enum ReferenceType {
+  REF_NONE ("None reference"),       // Regular class
+  REF_OTHER ("Other reference"),     // Subclass of java/lang/ref/Reference, but not subclass of one of the classes below
+  REF_SOFT ("Soft reference"),       // Subclass of java/lang/ref/SoftReference
+  REF_WEAK ("Weak reference"),       // Subclass of java/lang/ref/WeakReference
+  REF_FINAL ("Final reference"),     // Subclass of java/lang/ref/FinalReference
+  REF_PHANTOM ("Phantom reference"); // Subclass of java/lang/ref/PhantomReference
+
+  private final String value;
+
+  ReferenceType(String val) {
+    this.value = val;
+  }
+  public String value() {
+    return value;
+  }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java	Wed Jul 05 19:50:06 2017 +0200
@@ -56,6 +56,12 @@
   private static AddressField narrowKlassBaseField;
   private static CIntegerField narrowKlassShiftField;
 
+  public enum NARROW_OOP_MODE {
+    UnscaledNarrowOop,
+    ZeroBasedNarrowOop,
+    HeapBasedNarrowOop
+  }
+
   static {
     VM.registerVMInitializedObserver(new Observer() {
         public void update(Observable o, Object data) {
@@ -94,7 +100,17 @@
 
   public Universe() {
   }
-
+  public static String narrowOopModeToString(NARROW_OOP_MODE mode) {
+    switch (mode) {
+    case UnscaledNarrowOop:
+      return "32-bits Oops";
+    case ZeroBasedNarrowOop:
+      return "zero based Compressed Oops";
+    case HeapBasedNarrowOop:
+      return "Compressed Oops with base";
+    }
+    return "";
+  }
   public CollectedHeap heap() {
     try {
       return (CollectedHeap) heapConstructor.instantiateWrapperFor(collectedHeapField.getValue());
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java	Wed Jul 05 19:50:06 2017 +0200
@@ -55,6 +55,7 @@
     layoutHelper = new IntField(type.getJIntField("_layout_helper"), 0);
     name         = type.getAddressField("_name");
     accessFlags  = new CIntField(type.getCIntegerField("_access_flags"), 0);
+    traceIDField  = type.getField("_trace_id");
     subklass     = new MetadataField(type.getAddressField("_subklass"), 0);
     nextSibling  = new MetadataField(type.getAddressField("_next_sibling"), 0);
 
@@ -86,6 +87,7 @@
   private static CIntField accessFlags;
   private static MetadataField  subklass;
   private static MetadataField  nextSibling;
+  private static sun.jvm.hotspot.types.Field traceIDField;
 
   private Address getValue(AddressField field) {
     return addr.getAddressAt(field.getOffset());
@@ -106,6 +108,7 @@
   public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags());      }
   public Klass    getSubklassKlass()    { return (Klass)    subklass.getValue(this);     }
   public Klass    getNextSiblingKlass() { return (Klass)    nextSibling.getValue(this);  }
+  public long     traceID() { return traceIDField.getJLong(addr);  }
 
   // computed access flags - takes care of inner classes etc.
   // This is closer to actual source level than getAccessFlags() etc.
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java	Wed Jul 05 19:50:06 2017 +0200
@@ -54,6 +54,8 @@
   private static OopField threadNameField;
   private static OopField threadGroupField;
   private static LongField threadEETopField;
+  //tid field is new since 1.5
+  private static LongField threadTIDField;
   // threadStatus field is new since 1.5
   private static IntField threadStatusField;
   // parkBlocker field is new since 1.6
@@ -220,6 +222,7 @@
       threadNameField  = (OopField) k.findField("name", "[C");
       threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;");
       threadEETopField = (LongField) k.findField("eetop", "J");
+      threadTIDField = (LongField) k.findField("tid", "J");
       threadStatusField = (IntField) k.findField("threadStatus", "I");
       threadParkBlockerField = (OopField) k.findField("parkBlocker",
                                      "Ljava/lang/Object;");
@@ -268,6 +271,15 @@
     return VM.getVM().getThreads().createJavaThreadWrapper(addr);
   }
 
+  public static long threadOopGetTID(Oop threadOop) {
+    initThreadFields();
+    if (threadTIDField != null) {
+      return threadTIDField.getValue(threadOop);
+    } else {
+      return 0;
+    }
+  }
+
   /** returns value of java.lang.Thread.threadStatus field */
   public static int threadOopGetThreadStatus(Oop threadOop) {
     initThreadFields();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/opto/CompilerPhaseType.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.opto;
+
+//These definitions should be kept in sync with the definitions in the HotSpot code.
+
+public enum CompilerPhaseType {
+  PHASE_BEFORE_STRINGOPTS ("Before StringOpts"),
+  PHASE_AFTER_STRINGOPTS ("After StringOpts"),
+  PHASE_BEFORE_REMOVEUSELESS ("Before RemoveUseless"),
+  PHASE_AFTER_PARSING ("After Parsing"),
+  PHASE_ITER_GVN1 ("Iter GVN 1"),
+  PHASE_PHASEIDEAL_BEFORE_EA ("PhaseIdealLoop before EA"),
+  PHASE_ITER_GVN_AFTER_EA ("Iter GVN after EA"),
+  PHASE_ITER_GVN_AFTER_ELIMINATION ("Iter GVN after eliminating allocations and locks"),
+  PHASE_PHASEIDEALLOOP1 ("PhaseIdealLoop 1"),
+  PHASE_PHASEIDEALLOOP2 ("PhaseIdealLoop 2"),
+  PHASE_PHASEIDEALLOOP3 ("PhaseIdealLoop 3"),
+  PHASE_CPP1 ("PhaseCPP 1"),
+  PHASE_ITER_GVN2 ("Iter GVN 2"),
+  PHASE_PHASEIDEALLOOP_ITERATIONS ("PhaseIdealLoop iterations"),
+  PHASE_OPTIMIZE_FINISHED ("Optimize finished"),
+  PHASE_GLOBAL_CODE_MOTION ("Global code motion"),
+  PHASE_FINAL_CODE ("Final Code"),
+  PHASE_AFTER_EA ("After Escape Analysis"),
+  PHASE_BEFORE_CLOOPS ("Before CountedLoop"),
+  PHASE_AFTER_CLOOPS ("After CountedLoop"),
+  PHASE_BEFORE_BEAUTIFY_LOOPS ("Before beautify loops"),
+  PHASE_AFTER_BEAUTIFY_LOOPS ("After beautify loops"),
+  PHASE_BEFORE_MATCHING ("Before Matching"),
+  PHASE_INCREMENTAL_INLINE ("Incremental Inline"),
+  PHASE_INCREMENTAL_BOXING_INLINE ("Incremental Boxing Inline"),
+  PHASE_END ("End"),
+  PHASE_FAILURE ("Failure"),
+  PHASE_NUM_TYPES ("Number of Phase Types");
+
+  private final String value;
+
+  CompilerPhaseType(String val) {
+    this.value = val;
+  }
+  public String value() {
+    return value;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Flags.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.runtime;
+
+//These definitions should be kept in sync with the definitions in the HotSpot code.
+
+public enum Flags {
+  // value origin
+  DEFAULT ("Default"),
+  COMMAND_LINE ("Command line"),
+  ENVIRON_VAR ("Environment variable"),
+  CONFIG_FILE ("Config file"),
+  MANAGEMENT ("Management"),
+  ERGONOMIC ("Ergonomic"),
+  ATTACH_ON_DEMAND ("Attach on demand"),
+  INTERNAL ("Internal");
+
+  private final String value;
+
+  Flags(String val) {
+    this.value = val;
+  }
+  public String value() {
+    return value;
+  }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Thread.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Thread.java	Wed Jul 05 19:50:06 2017 +0200
@@ -41,6 +41,8 @@
   private static AddressField currentPendingMonitorField;
   private static AddressField currentWaitingMonitorField;
 
+  private static JLongField allocatedBytesField;
+
   static {
     VM.registerVMInitializedObserver(new Observer() {
         public void update(Observable o, Object data) {
@@ -61,6 +63,7 @@
     activeHandlesField = type.getAddressField("_active_handles");
     currentPendingMonitorField = type.getAddressField("_current_pending_monitor");
     currentWaitingMonitorField = type.getAddressField("_current_waiting_monitor");
+    allocatedBytesField = type.getJLongField("_allocated_bytes");
   }
 
   public Thread(Address addr) {
@@ -104,6 +107,10 @@
     return new JNIHandleBlock(a);
   }
 
+  public long allocatedBytes() {
+    return allocatedBytesField.getValue(addr);
+  }
+
   public boolean   isVMThread()                { return false; }
   public boolean   isJavaThread()              { return false; }
   public boolean   isCompilerThread()          { return false; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VMOps.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.runtime;
+
+//These definitions should be kept in sync with the definitions in the HotSpot code.
+
+public enum VMOps {
+  Dummy,
+  ThreadStop,
+  ThreadDump,
+  PrintThreads,
+  FindDeadlocks,
+  ForceSafepoint,
+  ForceAsyncSafepoint,
+  Deoptimize,
+  DeoptimizeFrame,
+  DeoptimizeAll,
+  ZombieAll,
+  UnlinkSymbols,
+  Verify,
+  PrintJNI,
+  HeapDumper,
+  DeoptimizeTheWorld,
+  CollectForMetadataAllocation,
+  GC_HeapInspection,
+  GenCollectFull,
+  GenCollectFullConcurrent,
+  GenCollectForAllocation,
+  ParallelGCFailedAllocation,
+  ParallelGCSystemGC,
+  CGC_Operation,
+  CMS_Initial_Mark,
+  CMS_Final_Remark,
+  G1CollectFull,
+  G1CollectForAllocation,
+  G1IncCollectionPause,
+  EnableBiasedLocking,
+  RevokeBias,
+  BulkRevokeBias,
+  PopulateDumpSharedSpace,
+  JNIFunctionTableCopier,
+  RedefineClasses,
+  GetOwnedMonitorInfo,
+  GetObjectMonitorUsage,
+  GetCurrentContendedMonitor,
+  GetStackTrace,
+  GetMultipleStackTraces,
+  GetAllStackTraces,
+  GetThreadListStackTraces,
+  GetFrameCount,
+  GetFrameLocation,
+  ChangeBreakpoints,
+  GetOrSetLocal,
+  GetCurrentLocation,
+  EnterInterpOnlyMode,
+  ChangeSingleStep,
+  HeapWalkOperation,
+  HeapIterateOperation,
+  ReportJavaOutOfMemory,
+  JFRCheckpoint,
+  Exit,
+  LinuxDllLoad,
+  Terminating
+}
--- a/hotspot/make/aix/makefiles/vm.make	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/aix/makefiles/vm.make	Wed Jul 05 19:50:06 2017 +0200
@@ -82,14 +82,12 @@
 		-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""  \
 		$(JDK_VER_DEFS)
 HS_LIB_ARCH   = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
-BUILD_TARGET  = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
 BUILD_USER    = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
 VM_DISTRO     = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
 
 CXXFLAGS =           \
   ${SYSDEFS}         \
   ${INCLUDES}        \
-  ${BUILD_TARGET}    \
   ${BUILD_USER}      \
   ${HS_LIB_ARCH}     \
   ${VM_DISTRO}
--- a/hotspot/make/bsd/makefiles/gcc.make	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/bsd/makefiles/gcc.make	Wed Jul 05 19:50:06 2017 +0200
@@ -280,7 +280,10 @@
 
 # optimization control flags (Used by fastdebug and release variants)
 OPT_CFLAGS/NOOPT=-O0
-ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
+ifeq ($(USE_CLANG), true)
+  # Clang does not support -Og
+  OPT_CFLAGS/DEBUG=-O0
+else ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
   # Allow basic optimizations which don't distrupt debugging. (Principally dead code elimination)
   OPT_CFLAGS/DEBUG=-Og
 else
@@ -319,9 +322,20 @@
 
 # Work around some compiler bugs.
 ifeq ($(USE_CLANG), true)
+  # Clang 4.2
   ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
     OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
     OPT_CFLAGS/unsafe.o += -O1
+  # Clang 5.0
+  else ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 0), 1)
+    OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
+    OPT_CFLAGS/unsafe.o += -O1
+  # Clang 5.1
+  else ifeq ($(shell expr $(CC_VER_MAJOR) = 5 \& $(CC_VER_MINOR) = 1), 1)
+    OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
+    OPT_CFLAGS/unsafe.o += -O1
+  else
+    $(error "Update compiler workarounds for Clang $(CC_VER_MAJOR).$(CC_VER_MINOR)")
   endif
 else
   # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
@@ -443,7 +457,10 @@
   CFLAGS += -flimit-debug-info
 endif
 
-ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
+ifeq ($(USE_CLANG), true)
+  # Clang does not support -Og
+  DEBUG_CFLAGS=-O0
+else ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1"
   # Allow basic optimizations which don't distrupt debugging. (Principally dead code elimination)
   DEBUG_CFLAGS=-Og
 else
--- a/hotspot/make/bsd/makefiles/vm.make	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/bsd/makefiles/vm.make	Wed Jul 05 19:50:06 2017 +0200
@@ -81,14 +81,12 @@
 		-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""  \
 		$(JDK_VER_DEFS)
 HS_LIB_ARCH   = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
-BUILD_TARGET  = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
 BUILD_USER    = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
 VM_DISTRO     = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
 
 CXXFLAGS =           \
   ${SYSDEFS}         \
   ${INCLUDES}        \
-  ${BUILD_TARGET}    \
   ${BUILD_USER}      \
   ${HS_LIB_ARCH}     \
   ${VM_DISTRO}
--- a/hotspot/make/defs.make	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/defs.make	Wed Jul 05 19:50:06 2017 +0200
@@ -135,8 +135,12 @@
 ifeq ($(JDK_MKTG_VERSION),)
   JDK_MKTG_VERSION=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
 endif
-ifeq ($(JDK_VERSION),)
-  JDK_VERSION=$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
+ifeq ($(JDK_VERSION),)  
+  ifeq ($(BUILD_FLAVOR), product)
+    JDK_VERSION=$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)
+  else
+    JDK_VERSION=$(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION)-$(BUILD_FLAVOR)
+  endif
 endif
 ifeq ($(FULL_VERSION),)
   FULL_VERSION="$(JDK_VERSION)"
--- a/hotspot/make/linux/makefiles/defs.make	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/linux/makefiles/defs.make	Wed Jul 05 19:50:06 2017 +0200
@@ -69,7 +69,7 @@
 endif
 
 # sparc
-ifeq ($(ARCH), sparc64)
+ifneq (,$(findstring $(ARCH), sparc))
   ifeq ($(ARCH_DATA_MODEL), 64)
     ARCH_DATA_MODEL  = 64
     MAKE_ARGS        += LP64=1
@@ -83,30 +83,20 @@
   HS_ARCH            = sparc
 endif
 
-# amd64/x86_64
-ifneq (,$(findstring $(ARCH), amd64 x86_64))
+# i686/i586 and amd64/x86_64
+ifneq (,$(findstring $(ARCH), amd64 x86_64 i686 i586))
   ifeq ($(ARCH_DATA_MODEL), 64)
     ARCH_DATA_MODEL = 64
     MAKE_ARGS       += LP64=1
     PLATFORM        = linux-amd64
     VM_PLATFORM     = linux_amd64
-    HS_ARCH         = x86
   else
     ARCH_DATA_MODEL = 32
     PLATFORM        = linux-i586
     VM_PLATFORM     = linux_i486
-    HS_ARCH         = x86
-    # We have to reset ARCH to i686 since SRCARCH relies on it
-    ARCH            = i686
   endif
-endif
 
-# i686/i586 ie 32-bit x86
-ifneq (,$(findstring $(ARCH), i686 i586))
-  ARCH_DATA_MODEL  = 32
-  PLATFORM         = linux-i586
-  VM_PLATFORM      = linux_i486
-  HS_ARCH          = x86
+  HS_ARCH           = x86
 endif
 
 # ARM
@@ -118,20 +108,18 @@
 endif
 
 # PPC
-ifeq ($(ARCH), ppc)
-  ARCH_DATA_MODEL  = 32
-  PLATFORM         = linux-ppc
-  VM_PLATFORM      = linux_ppc
-  HS_ARCH          = ppc
-endif
+ifneq (,$(findstring $(ARCH), ppc))
+  ifeq ($(ARCH_DATA_MODEL), 64)
+    MAKE_ARGS        += LP64=1
+    PLATFORM         = linux-ppc64
+    VM_PLATFORM      = linux_ppc64
+  else
+    ARCH_DATA_MODEL  = 32
+    PLATFORM         = linux-ppc
+    VM_PLATFORM      = linux_ppc
+  endif
 
-# PPC64
-ifeq ($(ARCH), ppc64)
-  ARCH_DATA_MODEL  = 64
-  MAKE_ARGS        += LP64=1
-  PLATFORM         = linux-ppc64
-  VM_PLATFORM      = linux_ppc64
-  HS_ARCH          = ppc
+  HS_ARCH = ppc
 endif
 
 # On 32 bit linux we build server and client, on 64 bit just server.
--- a/hotspot/make/linux/makefiles/vm.make	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/linux/makefiles/vm.make	Wed Jul 05 19:50:06 2017 +0200
@@ -82,14 +82,12 @@
 		-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""  \
 		$(JDK_VER_DEFS)
 HS_LIB_ARCH   = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
-BUILD_TARGET  = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
 BUILD_USER    = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
 VM_DISTRO     = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
 
 CXXFLAGS =           \
   ${SYSDEFS}         \
   ${INCLUDES}        \
-  ${BUILD_TARGET}    \
   ${BUILD_USER}      \
   ${HS_LIB_ARCH}     \
   ${VM_DISTRO}
--- a/hotspot/make/solaris/makefiles/sa.make	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/solaris/makefiles/sa.make	Wed Jul 05 19:50:06 2017 +0200
@@ -29,8 +29,12 @@
 # and generate JNI header file for native methods.
 
 include $(GAMMADIR)/make/solaris/makefiles/rules.make
+include $(GAMMADIR)/make/defs.make
 AGENT_DIR = $(GAMMADIR)/agent
 include $(GAMMADIR)/make/sa.files
+
+-include $(HS_ALT_MAKE)/solaris/makefiles/sa.make
+
 GENERATED = ../generated
 
 # tools.jar is needed by the JDI - SA binding
--- a/hotspot/make/solaris/makefiles/vm.make	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/solaris/makefiles/vm.make	Wed Jul 05 19:50:06 2017 +0200
@@ -77,14 +77,12 @@
 		-DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""  \
 		$(JDK_VER_DEFS)
 HS_LIB_ARCH   = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
-BUILD_TARGET  = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
 BUILD_USER    = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
 VM_DISTRO     = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
 
 CXXFLAGS =           \
   ${SYSDEFS}         \
   ${INCLUDES}        \
-  ${BUILD_TARGET}    \
   ${BUILD_USER}      \
   ${HS_LIB_ARCH}     \
   ${VM_DISTRO}
--- a/hotspot/make/windows/makefiles/sa.make	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/windows/makefiles/sa.make	Wed Jul 05 19:50:06 2017 +0200
@@ -38,6 +38,22 @@
 
 GENERATED = ../generated
 
+HS_COMMON_SRC_REL = src
+
+!if "$(OPENJDK)" != "true"
+HS_ALT_SRC_REL=src/closed
+HS_ALT_SRC = $(WorkSpace)/$(HS_ALT_SRC_REL)
+!ifndef HS_ALT_MAKE
+HS_ALT_MAKE=$(WorkSpace)/make/closed
+!endif
+!endif
+
+HS_COMMON_SRC = $(WorkSpace)/$(HS_COMMON_SRC_REL)
+
+!ifdef HS_ALT_MAKE
+!include $(HS_ALT_MAKE)/windows/makefiles/sa.make
+!endif
+
 # tools.jar is needed by the JDI - SA binding
 SA_CLASSPATH = $(BOOT_JAVA_HOME)/lib/tools.jar
 
--- a/hotspot/make/windows/projectfiles/common/Makefile	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/make/windows/projectfiles/common/Makefile	Wed Jul 05 19:50:06 2017 +0200
@@ -116,7 +116,7 @@
 JDK_MINOR_VERSION="\\\"$(JDK_MINOR_VER)\\\""
 JDK_MICRO_VERSION="\\\"$(JDK_MICRO_VER)\\\""
 
-ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -define JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION) -define JDK_MINOR_VERSION=$(JDK_MINOR_VERSION) -define JDK_MICRO_VERSION=$(JDK_MICRO_VERSION) -define JDK_BUILD_NUMBER=$(JDK_BUILD_NUMBER)
+ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -define JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION) -define JDK_MINOR_VERSION=$(JDK_MINOR_VERSION) -define JDK_MICRO_VERSION=$(JDK_MICRO_VERSION) -define JDK_BUILD_NUMBER=$(JDK_BUILD_NUMBER) -define VISUAL_STUDIO_BUILD=true
 ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions)
 
 $(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -693,7 +693,7 @@
   // PPC 1, section 4.6.7 Floating-Point Compare Instructions
   fcmpu( CCR7, F24, F25);
 
-  tty->print_cr("\ntest_asm disassembly (0x%lx 0x%lx):", code()->insts_begin(), code()->insts_end());
+  tty->print_cr("\ntest_asm disassembly (0x%lx 0x%lx):", p2i(code()->insts_begin()), p2i(code()->insts_end()));
   code()->decode();
 }
 
--- a/hotspot/src/cpu/ppc/vm/bytecodes_ppc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
- * 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 "interpreter/bytecodes.hpp"
-
-void Bytecodes::pd_initialize() {
-  // No ppc specific initialization.
-}
--- a/hotspot/src/cpu/ppc/vm/bytecodes_ppc.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
- * 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 CPU_PPC_VM_BYTECODES_PPC_HPP
-#define CPU_PPC_VM_BYTECODES_PPC_HPP
-
-// No ppc64 specific bytecodes
-
-#endif // CPU_PPC_VM_BYTECODES_PPC_HPP
--- a/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -50,34 +50,6 @@
   return is_icholder_entry(call->destination());
 }
 
-//-----------------------------------------------------------------------------
-// High-level access to an inline cache. Guaranteed to be MT-safe.
-
-CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
-  : _ic_call(call)
-{
-  address ic_call = call->instruction_address();
-
-  assert(ic_call != NULL, "ic_call address must be set");
-  assert(nm != NULL, "must pass nmethod");
-  assert(nm->contains(ic_call), "must be in nmethod");
-
-  // Search for the ic_call at the given address.
-  RelocIterator iter(nm, ic_call, ic_call+1);
-  bool ret = iter.next();
-  assert(ret == true, "relocInfo must exist at this address");
-  assert(iter.addr() == ic_call, "must find ic_call");
-  if (iter.type() == relocInfo::virtual_call_type) {
-    virtual_call_Relocation* r = iter.virtual_call_reloc();
-    _is_optimized = false;
-    _value = nativeMovConstReg_at(r->cached_value());
-  } else {
-    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
-    _is_optimized = true;
-    _value = NULL;
-  }
-}
-
 // ----------------------------------------------------------------------------
 
 // A PPC CompiledStaticCall looks like this:
@@ -203,7 +175,7 @@
   if (TraceICs) {
     ResourceMark rm;
     tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
-                  instruction_address(),
+                  p2i(instruction_address()),
                   callee->name_and_sig_as_C_string());
   }
 
--- a/hotspot/src/cpu/ppc/vm/frame_ppc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/frame_ppc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -140,7 +140,7 @@
 void frame::patch_pc(Thread* thread, address pc) {
   if (TracePcPatching) {
     tty->print_cr("patch_pc at address " PTR_FORMAT " [" PTR_FORMAT " -> " PTR_FORMAT "]",
-                  &((address*) _sp)[-1], ((address*) _sp)[-1], pc);
+                  p2i(&((address*) _sp)[-1]), p2i(((address*) _sp)[-1]), p2i(pc));
   }
   own_abi()->lr = (uint64_t)pc;
   _cb = CodeCache::find_blob(pc);
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -3099,7 +3099,7 @@
 };
 
 static void stop_on_request(int tp, const char* msg) {
-  tty->print("PPC assembly code requires stop: (%s) %s\n", (void *)stop_types[tp%/*stop_end*/4], msg);
+  tty->print("PPC assembly code requires stop: (%s) %s\n", stop_types[tp%/*stop_end*/4], msg);
   guarantee(false, err_msg("PPC assembly code requires stop: %s", msg));
 }
 
--- a/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/methodHandles_ppc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -464,7 +464,7 @@
                  strstr(adaptername, "linkTo") == NULL);    // static linkers don't have MH
   const char* mh_reg_name = has_mh ? "R23_method_handle" : "G23";
   tty->print_cr("MH %s %s="INTPTR_FORMAT " sp=" INTPTR_FORMAT,
-                adaptername, mh_reg_name, (intptr_t) mh, entry_sp);
+                adaptername, mh_reg_name, (intptr_t) mh, (intptr_t) entry_sp);
 
   if (Verbose) {
     tty->print_cr("Registers:");
--- a/hotspot/src/cpu/ppc/vm/nativeInst_ppc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/nativeInst_ppc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -147,9 +147,9 @@
   address addr = addr_at(0);
 
   if (!NativeCall::is_call_at(addr)) {
-    tty->print_cr("not a NativeCall at " PTR_FORMAT, addr);
+    tty->print_cr("not a NativeCall at " PTR_FORMAT, p2i(addr));
     // TODO: PPC port: Disassembler::decode(addr - 20, addr + 20, tty);
-    fatal(err_msg("not a NativeCall at " PTR_FORMAT, addr));
+    fatal(err_msg("not a NativeCall at " PTR_FORMAT, p2i(addr)));
   }
 }
 #endif // ASSERT
@@ -160,9 +160,9 @@
 
   NativeInstruction::verify();
   if (!NativeFarCall::is_far_call_at(addr)) {
-    tty->print_cr("not a NativeFarCall at " PTR_FORMAT, addr);
+    tty->print_cr("not a NativeFarCall at " PTR_FORMAT, p2i(addr));
     // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty);
-    fatal(err_msg("not a NativeFarCall at " PTR_FORMAT, addr));
+    fatal(err_msg("not a NativeFarCall at " PTR_FORMAT, p2i(addr)));
   }
 }
 #endif // ASSERT
@@ -306,9 +306,9 @@
     if (! (cb != NULL && MacroAssembler::is_calculate_address_from_global_toc_at(addr, cb->content_begin())) &&
         ! (cb != NULL && MacroAssembler::is_set_narrow_oop(addr, cb->content_begin())) &&
         ! MacroAssembler::is_bl(*((int*) addr))) {
-      tty->print_cr("not a NativeMovConstReg at " PTR_FORMAT, addr);
+      tty->print_cr("not a NativeMovConstReg at " PTR_FORMAT, p2i(addr));
       // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty);
-      fatal(err_msg("not a NativeMovConstReg at " PTR_FORMAT, addr));
+      fatal(err_msg("not a NativeMovConstReg at " PTR_FORMAT, p2i(addr)));
     }
   }
 }
@@ -344,9 +344,9 @@
 
   NativeInstruction::verify();
   if (!NativeJump::is_jump_at(addr)) {
-    tty->print_cr("not a NativeJump at " PTR_FORMAT, addr);
+    tty->print_cr("not a NativeJump at " PTR_FORMAT, p2i(addr));
     // TODO: PPC port: Disassembler::decode(addr, 20, 20, tty);
-    fatal(err_msg("not a NativeJump at " PTR_FORMAT, addr));
+    fatal(err_msg("not a NativeJump at " PTR_FORMAT, p2i(addr)));
   }
 }
 #endif // ASSERT
--- a/hotspot/src/cpu/ppc/vm/ppc.ad	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/ppc.ad	Wed Jul 05 19:50:06 2017 +0200
@@ -1329,7 +1329,7 @@
 
   if (!false /* TODO: PPC port C->is_frameless_method()*/) {
     st->print("save return pc\n\t");
-    st->print("push frame %d\n\t", -framesize);
+    st->print("push frame %ld\n\t", -framesize);
   }
 }
 #endif
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -352,7 +352,7 @@
 
   if (PrintAssembly) {
     ttyLocker ttyl;
-    tty->print_cr("Decoding section size detection stub at " INTPTR_FORMAT " before execution:", code);
+    tty->print_cr("Decoding section size detection stub at " INTPTR_FORMAT " before execution:", p2i(code));
     Disassembler::decode((u_char*)code, (u_char*)code_end, tty);
     tty->print_cr("Time loop1 :%f", loop1_seconds);
     tty->print_cr("Time loop2 :%f", loop2_seconds);
@@ -435,7 +435,7 @@
   // Print the detection code.
   if (PrintAssembly) {
     ttyLocker ttyl;
-    tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " before execution:", code);
+    tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " before execution:", p2i(code));
     Disassembler::decode((u_char*)code, (u_char*)code_end, tty);
   }
 
@@ -468,7 +468,7 @@
   // Print the detection code.
   if (PrintAssembly) {
     ttyLocker ttyl;
-    tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " after execution:", code);
+    tty->print_cr("Decoding cpu-feature detection stub at " INTPTR_FORMAT " after execution:", p2i(code));
     Disassembler::decode((u_char*)code, (u_char*)code_end, tty);
   }
 
--- a/hotspot/src/cpu/sparc/vm/bytecodes_sparc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 "interpreter/bytecodes.hpp"
-
-
-void Bytecodes::pd_initialize() {
-  // (nothing)
-}
-
-Bytecodes::Code Bytecodes::pd_base_code_for(Code code) {
-  return code;
-}
--- a/hotspot/src/cpu/sparc/vm/bytecodes_sparc.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 CPU_SPARC_VM_BYTECODES_SPARC_HPP
-#define CPU_SPARC_VM_BYTECODES_SPARC_HPP
-
-#ifdef SPARC
-#define NLOCALS_IN_REGS 6
-#endif
-
-
-// Sparc specific bytecodes
-
-// (none)
-
-#endif // CPU_SPARC_VM_BYTECODES_SPARC_HPP
--- a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -50,34 +50,6 @@
   return is_icholder_entry(call->destination());
 }
 
-//-----------------------------------------------------------------------------
-// High-level access to an inline cache. Guaranteed to be MT-safe.
-
-CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
-  : _ic_call(call)
-{
-  address ic_call = call->instruction_address();
-
-  assert(ic_call != NULL, "ic_call address must be set");
-  assert(nm != NULL, "must pass nmethod");
-  assert(nm->contains(ic_call), "must be in nmethod");
-
-  // Search for the ic_call at the given address.
-  RelocIterator iter(nm, ic_call, ic_call+1);
-  bool ret = iter.next();
-  assert(ret == true, "relocInfo must exist at this address");
-  assert(iter.addr() == ic_call, "must find ic_call");
-  if (iter.type() == relocInfo::virtual_call_type) {
-    virtual_call_Relocation* r = iter.virtual_call_reloc();
-    _is_optimized = false;
-    _value = nativeMovConstReg_at(r->cached_value());
-  } else {
-    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
-    _is_optimized = true;
-    _value = NULL;
-  }
-}
-
 // ----------------------------------------------------------------------------
 
 #define __ _masm.
--- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -436,32 +436,6 @@
 }
 #endif // CC_INTERP
 
-
-#ifdef ASSERT
-// Debugging aid
-static frame nth_sender(int n) {
-  frame f = JavaThread::current()->last_frame();
-
-  for(int i = 0; i < n; ++i)
-    f = f.sender((RegisterMap*)NULL);
-
-  printf("first frame %d\n",          f.is_first_frame()       ? 1 : 0);
-  printf("interpreted frame %d\n",    f.is_interpreted_frame() ? 1 : 0);
-  printf("java frame %d\n",           f.is_java_frame()        ? 1 : 0);
-  printf("entry frame %d\n",          f.is_entry_frame()       ? 1 : 0);
-  printf("native frame %d\n",         f.is_native_frame()      ? 1 : 0);
-  if (f.is_compiled_frame()) {
-    if (f.is_deoptimized_frame())
-      printf("deoptimized frame 1\n");
-    else
-      printf("compiled frame 1\n");
-  }
-
-  return f;
-}
-#endif
-
-
 frame frame::sender_for_entry_frame(RegisterMap *map) const {
   assert(map != NULL, "map must be set");
   // Java frame called from C; skip all C frames and return top C
--- a/hotspot/src/cpu/x86/vm/bytecodes_x86.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 "interpreter/bytecodes.hpp"
-
-
-void Bytecodes::pd_initialize() {
-  // No i486 specific initialization
-}
-
-
-Bytecodes::Code Bytecodes::pd_base_code_for(Code code) {
-  // No i486 specific bytecodes
-  return code;
-}
--- a/hotspot/src/cpu/x86/vm/bytecodes_x86.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 CPU_X86_VM_BYTECODES_X86_HPP
-#define CPU_X86_VM_BYTECODES_X86_HPP
-
-// No i486 specific bytecodes
-
-#endif // CPU_X86_VM_BYTECODES_X86_HPP
--- a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -47,34 +47,6 @@
   return is_icholder_entry(call->destination());
 }
 
-//-----------------------------------------------------------------------------
-// High-level access to an inline cache. Guaranteed to be MT-safe.
-
-CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
-  : _ic_call(call)
-{
-  address ic_call = call->instruction_address();
-
-  assert(ic_call != NULL, "ic_call address must be set");
-  assert(nm != NULL, "must pass nmethod");
-  assert(nm->contains(ic_call), "must be in nmethod");
-
-  // Search for the ic_call at the given address.
-  RelocIterator iter(nm, ic_call, ic_call+1);
-  bool ret = iter.next();
-  assert(ret == true, "relocInfo must exist at this address");
-  assert(iter.addr() == ic_call, "must find ic_call");
-  if (iter.type() == relocInfo::virtual_call_type) {
-    virtual_call_Relocation* r = iter.virtual_call_reloc();
-    _is_optimized = false;
-    _value = nativeMovConstReg_at(r->cached_value());
-  } else {
-    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
-    _is_optimized = true;
-    _value = NULL;
-  }
-}
-
 // ----------------------------------------------------------------------------
 
 #define __ _masm.
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -280,6 +280,8 @@
     case T_BYTE   : __ sign_extend_byte (rax); break;
     case T_SHORT  : __ sign_extend_short(rax); break;
     case T_INT    : /* nothing to do */        break;
+    case T_LONG   : /* nothing to do */        break;
+    case T_VOID   : /* nothing to do */        break;
     case T_DOUBLE :
     case T_FLOAT  :
       { const Register t = InterpreterRuntime::SignatureHandlerGenerator::temp();
--- a/hotspot/src/cpu/zero/vm/bytecodes_zero.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007 Red Hat, Inc.
- * 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 "interpreter/bytecodes.hpp"
-
-void Bytecodes::pd_initialize() {
-  // No zero specific initialization
-}
--- a/hotspot/src/cpu/zero/vm/bytecodes_zero.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2009 Red Hat, Inc.
- * 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 CPU_ZERO_VM_BYTECODES_ZERO_HPP
-#define CPU_ZERO_VM_BYTECODES_ZERO_HPP
-
-// This file is intentionally empty
-
-#endif // CPU_ZERO_VM_BYTECODES_ZERO_HPP
--- a/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -58,34 +58,6 @@
   return is_icholder_entry(call->destination());
 }
 
-//-----------------------------------------------------------------------------
-// High-level access to an inline cache. Guaranteed to be MT-safe.
-
-CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
-  : _ic_call(call)
-{
-  address ic_call = call->instruction_address();
-
-  assert(ic_call != NULL, "ic_call address must be set");
-  assert(nm != NULL, "must pass nmethod");
-  assert(nm->contains(ic_call), "must be in nmethod");
-
-  // Search for the ic_call at the given address.
-  RelocIterator iter(nm, ic_call, ic_call+1);
-  bool ret = iter.next();
-  assert(ret == true, "relocInfo must exist at this address");
-  assert(iter.addr() == ic_call, "must find ic_call");
-  if (iter.type() == relocInfo::virtual_call_type) {
-    virtual_call_Relocation* r = iter.virtual_call_reloc();
-    _is_optimized = false;
-    _value = nativeMovConstReg_at(r->cached_value());
-  } else {
-    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
-    _is_optimized = true;
-    _value = NULL;
-  }
-}
-
 // ----------------------------------------------------------------------------
 
 void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
--- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -37,6 +37,7 @@
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/os/aix/vm/osThread_aix.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/aix/vm/osThread_aix.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,17 +24,13 @@
  */
 
 // no precompiled headers
-#include "runtime/atomic.hpp"
+
 #include "runtime/handles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/os.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/vmThread.hpp"
-#ifdef TARGET_ARCH_ppc
-# include "assembler_ppc.inline.hpp"
-#endif
-
 
 void OSThread::pd_initialize() {
   assert(this != NULL, "check");
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -48,6 +48,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -2812,13 +2813,6 @@
 
 os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN; }
 
-void os::yield_all() {
-  // Yields to all threads, including threads with lower priorities
-  // Threads on Linux are all with same priority. The Solaris style
-  // os::yield_all() with nanosleep(1ms) is not necessary.
-  sched_yield();
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // thread priority support
 
@@ -3075,7 +3069,7 @@
 
   for (int n = 0; !osthread->sr.is_suspended(); n++) {
     for (int i = 0; i < RANDOMLY_LARGE_INTEGER2 && !osthread->sr.is_suspended(); i++) {
-      os::yield_all();
+      os::yield();
     }
 
     // timeout, try to cancel the request
@@ -3109,7 +3103,7 @@
     if (sr_notify(osthread) == 0) {
       for (int n = 0; n < RANDOMLY_LARGE_INTEGER && !osthread->sr.is_running(); n++) {
         for (int i = 0; i < 100 && !osthread->sr.is_running(); i++) {
-          os::yield_all();
+          os::yield();
         }
       }
     } else {
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -41,6 +41,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -2600,13 +2601,6 @@
 
 os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN; }
 
-void os::yield_all() {
-  // Yields to all threads, including threads with lower priorities
-  // Threads on Bsd are all with same priority. The Solaris style
-  // os::yield_all() with nanosleep(1ms) is not necessary.
-  sched_yield();
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // thread priority support
 
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -41,6 +41,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -3795,13 +3796,6 @@
 
 os::YieldResult os::NakedYield() { sched_yield(); return os::YIELD_UNKNOWN; }
 
-void os::yield_all() {
-  // Yields to all threads, including threads with lower priorities
-  // Threads on Linux are all with same priority. The Solaris style
-  // os::yield_all() with nanosleep(1ms) is not necessary.
-  sched_yield();
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // thread priority support
 
--- a/hotspot/src/os/solaris/vm/osThread_solaris.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/solaris/vm/osThread_solaris.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -23,7 +23,6 @@
  */
 
 // no precompiled headers
-#include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/os.hpp"
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -41,6 +41,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -3186,11 +3187,6 @@
 
 os::YieldResult os::NakedYield() { thr_yield(); return os::YIELD_UNKNOWN; }
 
-void os::yield_all() {
-  // Yields to all threads, including threads with lower priorities
-  os::sleep(Thread::current(), 1, false);
-}
-
 // Interface for setting lwp priorities.  If we are using T2 libthread,
 // which forces the use of BoundThreads or we manually set UseBoundThreads,
 // all of our threads will be assigned to real lwp's.  Using the thr_setprio
--- a/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -29,7 +29,6 @@
 #error "This file should only be included from thread.inline.hpp"
 #endif
 
-#include "runtime/atomic.inline.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
 
--- a/hotspot/src/os/windows/vm/osThread_windows.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/windows/vm/osThread_windows.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -23,7 +23,6 @@
  */
 
 // no precompiled headers
-#include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/os.hpp"
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -44,6 +44,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -3526,11 +3527,6 @@
 
 void os::yield() {  os::NakedYield(); }
 
-void os::yield_all() {
-  // Yields to all threads, including threads with lower priorities
-  Sleep(1);
-}
-
 // Win32 only gives you access to seven real priorities at a time,
 // so we compress Java's ten down to seven.  It would be better
 // if we dynamically adjusted relative priorities.
--- a/hotspot/src/os/windows/vm/threadCritical_windows.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os/windows/vm/threadCritical_windows.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
 
--- a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -307,7 +307,7 @@
                // doesn't work for us. We use:
                ((NativeInstruction*)pc)->is_safepoint_poll()) {
         if (TraceTraps) {
-          tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", pc);
+          tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc));
         }
         stub = SharedRuntime::get_poll_stub(pc);
       }
@@ -316,7 +316,7 @@
       else if (sig == SIGTRAP && TrapBasedICMissChecks &&
                nativeInstruction_at(pc)->is_sigtrap_ic_miss_check()) {
         if (TraceTraps) {
-          tty->print_cr("trap: ic_miss_check at " INTPTR_FORMAT " (SIGTRAP)", pc);
+          tty->print_cr("trap: ic_miss_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc));
         }
         stub = SharedRuntime::get_ic_miss_stub();
       }
@@ -325,7 +325,7 @@
       else if (sig == SIGTRAP && TrapBasedNullChecks &&
                nativeInstruction_at(pc)->is_sigtrap_null_check()) {
         if (TraceTraps) {
-          tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGTRAP)", pc);
+          tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc));
         }
         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
       }
@@ -335,7 +335,7 @@
                CodeCache::contains((void*) pc) &&
                !MacroAssembler::needs_explicit_null_check((intptr_t) info->si_addr)) {
         if (TraceTraps) {
-          tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", pc);
+          tty->print_cr("trap: null_check at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc));
         }
         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
       }
@@ -345,7 +345,7 @@
       else if (sig == SIGTRAP && TrapBasedRangeChecks &&
                nativeInstruction_at(pc)->is_sigtrap_range_check()) {
         if (TraceTraps) {
-          tty->print_cr("trap: range_check at " INTPTR_FORMAT " (SIGTRAP)", pc);
+          tty->print_cr("trap: range_check at " INTPTR_FORMAT " (SIGTRAP)", p2i(pc));
         }
         stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
       }
@@ -572,7 +572,7 @@
   st->cr();
 
   intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
-  st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", sp);
+  st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
   print_hex_dump(st, (address)sp, (address)(sp + 128), sizeof(intptr_t));
   st->cr();
 
@@ -580,7 +580,7 @@
   // point to garbage if entry point in an nmethod is corrupted. Leave
   // this at the end, and hope for the best.
   address pc = os::Linux::ucontext_get_pc(uc);
-  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", pc);
+  st->print_cr("Instructions: (pc=" PTR_FORMAT ")", p2i(pc));
   print_hex_dump(st, pc - 64, pc + 64, /*instrsize=*/4);
   st->cr();
 }
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -38,6 +38,7 @@
 #include "prims/jvm.h"
 #include "prims/jvm_misc.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/share/vm/asm/assembler.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/asm/assembler.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,7 +26,6 @@
 #include "asm/macroAssembler.hpp"
 #include "asm/macroAssembler.inline.hpp"
 #include "asm/codeBuffer.hpp"
-#include "runtime/atomic.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/icache.hpp"
 #include "runtime/os.hpp"
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -47,6 +47,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/share/vm/ci/ciConstantPoolCache.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciConstantPoolCache.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -38,7 +38,7 @@
                                  int expected_size) {
   _elements =
     new (arena) GrowableArray<void*>(arena, expected_size, 0, 0);
-  _keys = new (arena) GrowableArray<intptr_t>(arena, expected_size, 0, 0);
+  _keys = new (arena) GrowableArray<int>(arena, expected_size, 0, 0);
 }
 
 // ------------------------------------------------------------------
--- a/hotspot/src/share/vm/ci/ciConstantPoolCache.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciConstantPoolCache.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -35,7 +35,7 @@
 // Usage note: this klass has nothing to do with ConstantPoolCache*.
 class ciConstantPoolCache : public ResourceObj {
 private:
-  GrowableArray<intptr_t>*   _keys;
+  GrowableArray<int>*   _keys;
   GrowableArray<void*>* _elements;
 
   int find(int index);
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -512,24 +512,9 @@
   } else {
     // Check if it's resolved if it's not a symbol constant pool entry.
     klass = KlassHandle(THREAD, ConstantPool::klass_at_if_loaded(cpool, index));
-
+    // Try to look it up by name.
   if (klass.is_null()) {
-    // The klass has not been inserted into the constant pool.
-    // Try to look it up by name.
-    {
-      // We have to lock the cpool to keep the oop from being resolved
-      // while we are accessing it.
-        MonitorLockerEx ml(cpool->lock());
-      constantTag tag = cpool->tag_at(index);
-      if (tag.is_klass()) {
-        // The klass has been inserted into the constant pool
-        // very recently.
-        klass = KlassHandle(THREAD, cpool->resolved_klass_at(index));
-      } else {
-        assert(cpool->tag_at(index).is_unresolved_klass(), "wrong tag");
-        klass_name = cpool->unresolved_klass_at(index);
-      }
-    }
+      klass_name = cpool->klass_name_at(index);
   }
   }
 
--- a/hotspot/src/share/vm/ci/ciReplay.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2013, 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
@@ -686,7 +686,7 @@
       switch (cp->tag_at(i).value()) {
         case JVM_CONSTANT_UnresolvedClass: {
           if (tag == JVM_CONSTANT_Class) {
-            tty->print_cr("Resolving klass %s at %d", cp->unresolved_klass_at(i)->as_utf8(), i);
+            tty->print_cr("Resolving klass %s at %d", cp->klass_name_at(i)->as_utf8(), i);
             Klass* k = cp->klass_at(i, CHECK);
           }
           break;
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -510,7 +510,7 @@
     jbyte tag = cp->tag_at(index).value();
     switch (tag) {
       case JVM_CONSTANT_UnresolvedClass: {
-        Symbol*  class_name = cp->unresolved_klass_at(index);
+        Symbol*  class_name = cp->klass_name_at(index);
         // check the name, even if _cp_patches will overwrite it
         verify_legal_class_name(class_name, CHECK_(nullHandle));
         break;
@@ -3161,7 +3161,7 @@
       if (_need_verify)
         is_array = super_klass->oop_is_array();
     } else if (_need_verify) {
-      is_array = (_cp->unresolved_klass_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY);
+      is_array = (_cp->klass_name_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY);
     }
     if (_need_verify) {
       guarantee_property(!is_array,
@@ -3855,7 +3855,7 @@
     "Invalid this class index %u in constant pool in class file %s",
     this_class_index, CHECK_(nullHandle));
 
-  Symbol*  class_name  = cp->unresolved_klass_at(this_class_index);
+  Symbol*  class_name  = cp->klass_name_at(this_class_index);
   assert(class_name != NULL, "class_name can't be null");
 
   // It's important to set parsed_name *before* resolving the super class.
@@ -4139,8 +4139,8 @@
     }
 
     // Allocate mirror and initialize static fields
-    java_lang_Class::create_mirror(this_klass, protection_domain, CHECK_(nullHandle));
-
+    java_lang_Class::create_mirror(this_klass, class_loader, protection_domain,
+                                   CHECK_(nullHandle));
 
     // Generate any default methods - default methods are interface methods
     // that have a default implementation.  This is new with Lambda project.
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -57,6 +57,7 @@
 #include "memory/metadataFactory.hpp"
 #include "memory/metaspaceShared.hpp"
 #include "memory/oopFactory.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/jniHandles.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/safepoint.hpp"
@@ -549,6 +550,7 @@
 // GC root of class loader data created.
 ClassLoaderData* ClassLoaderDataGraph::_head = NULL;
 ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
+ClassLoaderData* ClassLoaderDataGraph::_saved_unloading = NULL;
 ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
 
 bool ClassLoaderDataGraph::_should_purge = false;
@@ -656,7 +658,9 @@
 
 void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
   assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
-  for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
+  // Only walk the head until any clds not purged from prior unloading
+  // (CMS doesn't purge right away).
+  for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
     cld->classes_do(f);
   }
 }
@@ -704,6 +708,11 @@
   ClassLoaderData* data = _head;
   ClassLoaderData* prev = NULL;
   bool seen_dead_loader = false;
+
+  // Save previous _unloading pointer for CMS which may add to unloading list before
+  // purging and we don't want to rewalk the previously unloaded class loader data.
+  _saved_unloading = _unloading;
+
   // mark metadata seen on the stack and code cache so we can delete
   // unneeded entries.
   bool has_redefined_a_class = JvmtiExport::has_redefined_a_class();
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -66,6 +66,7 @@
   static ClassLoaderData* _unloading;
   // CMS support.
   static ClassLoaderData* _saved_head;
+  static ClassLoaderData* _saved_unloading;
   static bool _should_purge;
 
   static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
@@ -187,8 +188,6 @@
   JNIHandleBlock* handles() const;
   void set_handles(JNIHandleBlock* handles);
 
-  Mutex* metaspace_lock() const { return _metaspace_lock; }
-
   // GC interface.
   void clear_claimed()          { _claimed = 0; }
   bool claimed() const          { return _claimed == 1; }
@@ -216,6 +215,8 @@
     return _the_null_class_loader_data;
   }
 
+  Mutex* metaspace_lock() const { return _metaspace_lock; }
+
   bool is_anonymous() const { return _is_anonymous; }
 
   static void init_null_class_loader_data() {
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -558,7 +558,7 @@
       }
     }
   }
-  create_mirror(k, Handle(NULL), CHECK);
+  create_mirror(k, Handle(NULL), Handle(NULL), CHECK);
 }
 
 void java_lang_Class::initialize_mirror_fields(KlassHandle k,
@@ -578,7 +578,8 @@
   InstanceKlass::cast(k())->do_local_static_fields(&initialize_static_field, mirror, CHECK);
 }
 
-void java_lang_Class::create_mirror(KlassHandle k, Handle protection_domain, TRAPS) {
+void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader,
+                                    Handle protection_domain, TRAPS) {
   assert(k->java_mirror() == NULL, "should only assign mirror once");
   // Use this moment of initialization to cache modifier_flags also,
   // to support Class.getModifiers().  Instance classes recalculate
@@ -633,6 +634,9 @@
       }
     }
 
+    // set the classLoader field in the java_lang_Class instance
+    set_class_loader(mirror(), class_loader());
+
     // Setup indirection from klass->mirror last
     // after any exceptions can happen during allocations.
     if (!k.is_null()) {
@@ -694,6 +698,18 @@
 }
 
 
+void java_lang_Class::set_class_loader(oop java_class, oop loader) {
+  // jdk7 runs Queens in bootstrapping and jdk8-9 has no coordinated pushes yet.
+  if (_class_loader_offset != 0) {
+    java_class->obj_field_put(_class_loader_offset, loader);
+  }
+}
+
+oop java_lang_Class::class_loader(oop java_class) {
+  assert(_class_loader_offset != 0, "must be set");
+  return java_class->obj_field(_class_loader_offset);
+}
+
 oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) {
   // This should be improved by adding a field at the Java level or by
   // introducing a new VM klass (see comment in ClassFileParser)
@@ -853,6 +869,12 @@
   compute_optional_offset(classRedefinedCount_offset,
                           klass_oop, vmSymbols::classRedefinedCount_name(), vmSymbols::int_signature());
 
+  // Needs to be optional because the old build runs Queens during bootstrapping
+  // and jdk8-9 doesn't have coordinated pushes yet.
+  compute_optional_offset(_class_loader_offset,
+                 klass_oop, vmSymbols::classLoader_name(),
+                 vmSymbols::classloader_signature());
+
   CLASS_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET);
 }
 
@@ -3073,6 +3095,7 @@
 int java_lang_Class::_array_klass_offset;
 int java_lang_Class::_oop_size_offset;
 int java_lang_Class::_static_oop_field_count_offset;
+int java_lang_Class::_class_loader_offset;
 int java_lang_Class::_protection_domain_offset;
 int java_lang_Class::_init_lock_offset;
 int java_lang_Class::_signers_offset;
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -240,19 +240,23 @@
   static int _protection_domain_offset;
   static int _init_lock_offset;
   static int _signers_offset;
+  static int _class_loader_offset;
 
   static bool offsets_computed;
   static int classRedefinedCount_offset;
+
   static GrowableArray<Klass*>* _fixup_mirror_list;
 
   static void set_init_lock(oop java_class, oop init_lock);
   static void set_protection_domain(oop java_class, oop protection_domain);
+  static void set_class_loader(oop java_class, oop class_loader);
   static void initialize_mirror_fields(KlassHandle k, Handle mirror, Handle protection_domain, TRAPS);
  public:
   static void compute_offsets();
 
   // Instance creation
-  static void create_mirror(KlassHandle k, Handle protection_domain, TRAPS);
+  static void create_mirror(KlassHandle k, Handle class_loader,
+                            Handle protection_domain, TRAPS);
   static void fixup_mirror(KlassHandle k, TRAPS);
   static oop  create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS);
   // Conversion
@@ -290,6 +294,8 @@
   static objArrayOop  signers(oop java_class);
   static void set_signers(oop java_class, objArrayOop signers);
 
+  static oop class_loader(oop java_class);
+
   static int oop_size(oop java_class);
   static void set_oop_size(oop java_class, int size);
   static int static_oop_field_count(oop java_class);
--- a/hotspot/src/share/vm/classfile/stringTable.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -33,6 +33,7 @@
 #include "memory/gcLocker.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.inline2.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/hashtable.inline.hpp"
 #if INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -33,6 +33,7 @@
 #include "memory/gcLocker.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.inline2.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/hashtable.inline.hpp"
 
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -572,6 +572,7 @@
   template(serializePropertiesToByteArray_signature,   "()[B")                                                    \
   template(serializeAgentPropertiesToByteArray_name,   "serializeAgentPropertiesToByteArray")                     \
   template(classRedefinedCount_name,                   "classRedefinedCount")                                     \
+  template(classLoader_name,                           "classLoader")                                             \
                                                                                                                   \
   /* trace signatures */                                                                                          \
   TRACE_TEMPLATES(template)                                                                                       \
--- a/hotspot/src/share/vm/code/compiledIC.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/code/compiledIC.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -159,6 +159,30 @@
 //-----------------------------------------------------------------------------
 // High-level access to an inline cache. Guaranteed to be MT-safe.
 
+CompiledIC::CompiledIC(nmethod* nm, NativeCall* call)
+  : _ic_call(call)
+{
+  address ic_call = call->instruction_address();
+
+  assert(ic_call != NULL, "ic_call address must be set");
+  assert(nm != NULL, "must pass nmethod");
+  assert(nm->contains(ic_call), "must be in nmethod");
+
+  // Search for the ic_call at the given address.
+  RelocIterator iter(nm, ic_call, ic_call+1);
+  bool ret = iter.next();
+  assert(ret == true, "relocInfo must exist at this address");
+  assert(iter.addr() == ic_call, "must find ic_call");
+  if (iter.type() == relocInfo::virtual_call_type) {
+    virtual_call_Relocation* r = iter.virtual_call_reloc();
+    _is_optimized = false;
+    _value = nativeMovConstReg_at(r->cached_value());
+  } else {
+    assert(iter.type() == relocInfo::opt_virtual_call_type, "must be a virtual call");
+    _is_optimized = true;
+    _value = NULL;
+  }
+}
 
 bool CompiledIC::set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS) {
   assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
--- a/hotspot/src/share/vm/code/nmethod.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -37,6 +37,7 @@
 #include "oops/methodData.hpp"
 #include "prims/jvmtiRedefineClassesTrace.hpp"
 #include "prims/jvmtiImpl.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/sweeper.hpp"
@@ -363,27 +364,30 @@
   set_exception_cache(new_entry);
 }
 
-void nmethod::remove_from_exception_cache(ExceptionCache* ec) {
+void nmethod::clean_exception_cache(BoolObjectClosure* is_alive) {
   ExceptionCache* prev = NULL;
   ExceptionCache* curr = exception_cache();
-  assert(curr != NULL, "nothing to remove");
-  // find the previous and next entry of ec
-  while (curr != ec) {
-    prev = curr;
-    curr = curr->next();
-    assert(curr != NULL, "ExceptionCache not found");
+
+  while (curr != NULL) {
+    ExceptionCache* next = curr->next();
+
+    Klass* ex_klass = curr->exception_type();
+    if (ex_klass != NULL && !ex_klass->is_loader_alive(is_alive)) {
+      if (prev == NULL) {
+        set_exception_cache(next);
+      } else {
+        prev->set_next(next);
+      }
+      delete curr;
+      // prev stays the same.
+    } else {
+      prev = curr;
+    }
+
+    curr = next;
   }
-  // now: curr == ec
-  ExceptionCache* next = curr->next();
-  if (prev == NULL) {
-    set_exception_cache(next);
-  } else {
-    prev->set_next(next);
-  }
-  delete curr;
 }
 
-
 // public method for accessing the exception cache
 // These are the public access methods.
 address nmethod::handler_for_exception_and_pc(Handle exception, address pc) {
@@ -668,8 +672,10 @@
     _hotness_counter         = NMethodSweeper::hotness_counter_reset_val();
 
     code_buffer->copy_values_to(this);
-    if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
-      CodeCache::add_scavenge_root_nmethod(this);
+    if (ScavengeRootsInCode) {
+      if (detect_scavenge_root_oops()) {
+        CodeCache::add_scavenge_root_nmethod(this);
+      }
       Universe::heap()->register_nmethod(this);
     }
     debug_only(verify_scavenge_root_oops());
@@ -753,8 +759,10 @@
     _hotness_counter         = NMethodSweeper::hotness_counter_reset_val();
 
     code_buffer->copy_values_to(this);
-    if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
-      CodeCache::add_scavenge_root_nmethod(this);
+    if (ScavengeRootsInCode) {
+      if (detect_scavenge_root_oops()) {
+        CodeCache::add_scavenge_root_nmethod(this);
+      }
       Universe::heap()->register_nmethod(this);
     }
     DEBUG_ONLY(verify_scavenge_root_oops();)
@@ -869,8 +877,10 @@
     code_buffer->copy_values_to(this);
     debug_info->copy_to(this);
     dependencies->copy_to(this);
-    if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
-      CodeCache::add_scavenge_root_nmethod(this);
+    if (ScavengeRootsInCode) {
+      if (detect_scavenge_root_oops()) {
+        CodeCache::add_scavenge_root_nmethod(this);
+      }
       Universe::heap()->register_nmethod(this);
     }
     debug_only(verify_scavenge_root_oops());
@@ -1612,15 +1622,7 @@
   }
 
   // Exception cache
-  ExceptionCache* ec = exception_cache();
-  while (ec != NULL) {
-    Klass* ex_klass = ec->exception_type();
-    ExceptionCache* next_ec = ec->next();
-    if (ex_klass != NULL && !ex_klass->is_loader_alive(is_alive)) {
-      remove_from_exception_cache(ec);
-    }
-    ec = next_ec;
-  }
+  clean_exception_cache(is_alive);
 
   // If class unloading occurred we first iterate over all inline caches and
   // clear ICs where the cached oop is referring to an unloaded klass or method.
--- a/hotspot/src/share/vm/code/nmethod.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -529,7 +529,7 @@
   void set_exception_cache(ExceptionCache *ec)    { _exception_cache = ec; }
   address handler_for_exception_and_pc(Handle exception, address pc);
   void add_handler_for_exception_and_pc(Handle exception, address pc, address handler);
-  void remove_from_exception_cache(ExceptionCache* ec);
+  void clean_exception_cache(BoolObjectClosure* is_alive);
 
   // implicit exceptions support
   address continuation_for_implicit_exception(address pc);
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -36,6 +36,7 @@
 #include "oops/oop.inline.hpp"
 #include "prims/nativeLookup.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -589,11 +590,10 @@
 
 
 /**
- * Add a CompileTask to a CompileQueue
+ * Add a CompileTask to a CompileQueue.
  */
 void CompileQueue::add(CompileTask* task) {
   assert(lock()->owned_by_self(), "must own lock");
-  assert(!CompileBroker::is_compilation_disabled_forever(), "Do not add task if compilation is turned off forever");
 
   task->set_next(NULL);
   task->set_prev(NULL);
@@ -639,8 +639,11 @@
   while (next != NULL) {
     CompileTask* current = next;
     next = current->next();
-    // Wake up thread that blocks on the compile task.
-    current->lock()->notify();
+    {
+      // Wake up thread that blocks on the compile task.
+      MutexLocker ct_lock(current->lock());
+      current->lock()->notify();
+    }
     // Put the task back on the freelist.
     CompileTask::free(current);
   }
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP
 
 #include "memory/genOopClosures.hpp"
+#include "memory/iterator.hpp"
 
 /////////////////////////////////////////////////////////////////
 // Closures used by ConcurrentMarkSweepGeneration's collector
@@ -48,33 +49,13 @@
     }                                                     \
   }
 
-// Applies the given oop closure to all oops in all klasses visited.
-class CMKlassClosure : public KlassClosure {
-  friend class CMSOopClosure;
-  friend class CMSOopsInGenClosure;
-
-  OopClosure* _oop_closure;
-
-  // Used when _oop_closure couldn't be set in an initialization list.
-  void initialize(OopClosure* oop_closure) {
-    assert(_oop_closure == NULL, "Should only be called once");
-    _oop_closure = oop_closure;
-  }
+// TODO: This duplication of the MetadataAwareOopClosure class is only needed
+//       because some CMS OopClosures derive from OopsInGenClosure. It would be
+//       good to get rid of them completely.
+class MetadataAwareOopsInGenClosure: public OopsInGenClosure {
+  KlassToOopClosure _klass_closure;
  public:
-  CMKlassClosure(OopClosure* oop_closure = NULL) : _oop_closure(oop_closure) { }
-
-  void do_klass(Klass* k);
-};
-
-// The base class for all CMS marking closures.
-// It's used to proxy through the metadata to the oops defined in them.
-class CMSOopClosure: public ExtendedOopClosure {
-  CMKlassClosure      _klass_closure;
- public:
-  CMSOopClosure() : ExtendedOopClosure() {
-    _klass_closure.initialize(this);
-  }
-  CMSOopClosure(ReferenceProcessor* rp) : ExtendedOopClosure(rp) {
+  MetadataAwareOopsInGenClosure() {
     _klass_closure.initialize(this);
   }
 
@@ -87,26 +68,7 @@
   virtual void do_class_loader_data(ClassLoaderData* cld);
 };
 
-// TODO: This duplication of the CMSOopClosure class is only needed because
-//       some CMS OopClosures derive from OopsInGenClosure. It would be good
-//       to get rid of them completely.
-class CMSOopsInGenClosure: public OopsInGenClosure {
-  CMKlassClosure _klass_closure;
- public:
-  CMSOopsInGenClosure() {
-    _klass_closure.initialize(this);
-  }
-
-  virtual bool do_metadata()    { return do_metadata_nv(); }
-  inline  bool do_metadata_nv() { return true; }
-
-  virtual void do_klass(Klass* k);
-  void do_klass_nv(Klass* k);
-
-  virtual void do_class_loader_data(ClassLoaderData* cld);
-};
-
-class MarkRefsIntoClosure: public CMSOopsInGenClosure {
+class MarkRefsIntoClosure: public MetadataAwareOopsInGenClosure {
  private:
   const MemRegion _span;
   CMSBitMap*      _bitMap;
@@ -118,7 +80,7 @@
   virtual void do_oop(narrowOop* p);
 };
 
-class Par_MarkRefsIntoClosure: public CMSOopsInGenClosure {
+class Par_MarkRefsIntoClosure: public MetadataAwareOopsInGenClosure {
  private:
   const MemRegion _span;
   CMSBitMap*      _bitMap;
@@ -132,7 +94,7 @@
 
 // A variant of the above used in certain kinds of CMS
 // marking verification.
-class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure {
+class MarkRefsIntoVerifyClosure: public MetadataAwareOopsInGenClosure {
  private:
   const MemRegion _span;
   CMSBitMap*      _verification_bm;
@@ -147,7 +109,7 @@
 };
 
 // The non-parallel version (the parallel version appears further below).
-class PushAndMarkClosure: public CMSOopClosure {
+class PushAndMarkClosure: public MetadataAwareOopClosure {
  private:
   CMSCollector* _collector;
   MemRegion     _span;
@@ -177,7 +139,7 @@
 // synchronization (for instance, via CAS). The marking stack
 // used in the non-parallel case above is here replaced with
 // an OopTaskQueue structure to allow efficient work stealing.
-class Par_PushAndMarkClosure: public CMSOopClosure {
+class Par_PushAndMarkClosure: public MetadataAwareOopClosure {
  private:
   CMSCollector* _collector;
   MemRegion     _span;
@@ -198,7 +160,7 @@
 };
 
 // The non-parallel version (the parallel version appears further below).
-class MarkRefsIntoAndScanClosure: public CMSOopsInGenClosure {
+class MarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure {
  private:
   MemRegion          _span;
   CMSBitMap*         _bit_map;
@@ -239,7 +201,7 @@
 // stack and the bitMap are shared, so access needs to be suitably
 // synchronized. An OopTaskQueue structure, supporting efficient
 // work stealing, replaces a CMSMarkStack for storing grey objects.
-class Par_MarkRefsIntoAndScanClosure: public CMSOopsInGenClosure {
+class Par_MarkRefsIntoAndScanClosure: public MetadataAwareOopsInGenClosure {
  private:
   MemRegion              _span;
   CMSBitMap*             _bit_map;
@@ -265,7 +227,7 @@
 // This closure is used during the concurrent marking phase
 // following the first checkpoint. Its use is buried in
 // the closure MarkFromRootsClosure.
-class PushOrMarkClosure: public CMSOopClosure {
+class PushOrMarkClosure: public MetadataAwareOopClosure {
  private:
   CMSCollector*   _collector;
   MemRegion       _span;
@@ -298,7 +260,7 @@
 // This closure is used during the concurrent marking phase
 // following the first checkpoint. Its use is buried in
 // the closure Par_MarkFromRootsClosure.
-class Par_PushOrMarkClosure: public CMSOopClosure {
+class Par_PushOrMarkClosure: public MetadataAwareOopClosure {
  private:
   CMSCollector*    _collector;
   MemRegion        _whole_span;
@@ -338,7 +300,7 @@
 // processing phase of the CMS final checkpoint step, as
 // well as during the concurrent precleaning of the discovered
 // reference lists.
-class CMSKeepAliveClosure: public CMSOopClosure {
+class CMSKeepAliveClosure: public MetadataAwareOopClosure {
  private:
   CMSCollector* _collector;
   const MemRegion _span;
@@ -358,7 +320,7 @@
   inline void do_oop_nv(narrowOop* p) { CMSKeepAliveClosure::do_oop_work(p); }
 };
 
-class CMSInnerParMarkAndPushClosure: public CMSOopClosure {
+class CMSInnerParMarkAndPushClosure: public MetadataAwareOopClosure {
  private:
   CMSCollector* _collector;
   MemRegion     _span;
@@ -379,7 +341,7 @@
 // A parallel (MT) version of the above, used when
 // reference processing is parallel; the only difference
 // is in the do_oop method.
-class CMSParKeepAliveClosure: public CMSOopClosure {
+class CMSParKeepAliveClosure: public MetadataAwareOopClosure {
  private:
   MemRegion     _span;
   OopTaskQueue* _work_queue;
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -44,33 +44,20 @@
   }
 }
 
-// CMSOopClosure and CMSoopsInGenClosure are duplicated,
+// MetadataAwareOopClosure and MetadataAwareOopsInGenClosure are duplicated,
 // until we get rid of OopsInGenClosure.
 
-inline void CMSOopClosure::do_klass(Klass* k)       { do_klass_nv(k); }
-inline void CMSOopsInGenClosure::do_klass(Klass* k) { do_klass_nv(k); }
-
-inline void CMSOopClosure::do_klass_nv(Klass* k) {
+inline void MetadataAwareOopsInGenClosure::do_klass_nv(Klass* k) {
   ClassLoaderData* cld = k->class_loader_data();
   do_class_loader_data(cld);
 }
-inline void CMSOopsInGenClosure::do_klass_nv(Klass* k) {
-  ClassLoaderData* cld = k->class_loader_data();
-  do_class_loader_data(cld);
-}
+inline void MetadataAwareOopsInGenClosure::do_klass(Klass* k) { do_klass_nv(k); }
 
-inline void CMSOopClosure::do_class_loader_data(ClassLoaderData* cld) {
-  assert(_klass_closure._oop_closure == this, "Must be");
-
-  bool claim = true;  // Must claim the class loader data before processing.
-  cld->oops_do(_klass_closure._oop_closure, &_klass_closure, claim);
-}
-inline void CMSOopsInGenClosure::do_class_loader_data(ClassLoaderData* cld) {
+inline void MetadataAwareOopsInGenClosure::do_class_loader_data(ClassLoaderData* cld) {
   assert(_klass_closure._oop_closure == this, "Must be");
 
   bool claim = true;  // Must claim the class loader data before processing.
   cld->oops_do(_klass_closure._oop_closure, &_klass_closure, claim);
 }
 
-
 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_INLINE_HPP
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -49,13 +49,14 @@
 #include "memory/genCollectedHeap.hpp"
 #include "memory/genMarkSweep.hpp"
 #include "memory/genOopClosures.inline.hpp"
-#include "memory/iterator.hpp"
+#include "memory/iterator.inline.hpp"
 #include "memory/padded.hpp"
 #include "memory/referencePolicy.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/tenuredGeneration.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/globals_extension.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
@@ -2024,7 +2025,7 @@
   SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
   gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
 
-  GCTraceTime t("CMS:MSC ", PrintGCDetails && Verbose, true, NULL);
+  GCTraceTime t("CMS:MSC ", PrintGCDetails && Verbose, true, NULL, gc_tracer->gc_id());
   if (PrintGC && Verbose && !(GCCause::is_user_requested_gc(gch->gc_cause()))) {
     gclog_or_tty->print_cr("Compact ConcurrentMarkSweepGeneration after %d "
       "collections passed to foreground collector", _full_gcs_since_conc_gc);
@@ -2534,8 +2535,10 @@
   assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(),
          "VM thread should have CMS token");
 
+  // The gc id is created in register_foreground_gc_start if this collection is synchronous
+  const GCId gc_id = _collectorState == InitialMarking ? GCId::peek() : _gc_tracer_cm->gc_id();
   NOT_PRODUCT(GCTraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose,
-    true, NULL);)
+    true, NULL, gc_id);)
   if (UseAdaptiveSizePolicy) {
     size_policy()->ms_collection_begin();
   }
@@ -3120,7 +3123,7 @@
   // Mark from roots one level into CMS
   MarkRefsIntoVerifyClosure notOlder(_span, verification_mark_bm(),
                                      markBitMap());
-  CMKlassClosure klass_closure(&notOlder);
+  KlassToOopClosure klass_closure(&notOlder);
 
   gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
   gch->gen_process_strong_roots(_cmsGen->level(),
@@ -3538,6 +3541,7 @@
  public:
   CMSPhaseAccounting(CMSCollector *collector,
                      const char *phase,
+                     const GCId gc_id,
                      bool print_cr = true);
   ~CMSPhaseAccounting();
 
@@ -3546,6 +3550,7 @@
   const char *_phase;
   elapsedTimer _wallclock;
   bool _print_cr;
+  const GCId _gc_id;
 
  public:
   // Not MT-safe; so do not pass around these StackObj's
@@ -3561,15 +3566,15 @@
 
 CMSPhaseAccounting::CMSPhaseAccounting(CMSCollector *collector,
                                        const char *phase,
+                                       const GCId gc_id,
                                        bool print_cr) :
-  _collector(collector), _phase(phase), _print_cr(print_cr) {
+  _collector(collector), _phase(phase), _print_cr(print_cr), _gc_id(gc_id) {
 
   if (PrintCMSStatistics != 0) {
     _collector->resetYields();
   }
   if (PrintGCDetails) {
-    gclog_or_tty->date_stamp(PrintGCDateStamps);
-    gclog_or_tty->stamp(PrintGCTimeStamps);
+    gclog_or_tty->gclog_stamp(_gc_id);
     gclog_or_tty->print_cr("[%s-concurrent-%s-start]",
       _collector->cmsGen()->short_name(), _phase);
   }
@@ -3583,8 +3588,7 @@
   _collector->stopTimer();
   _wallclock.stop();
   if (PrintGCDetails) {
-    gclog_or_tty->date_stamp(PrintGCDateStamps);
-    gclog_or_tty->stamp(PrintGCTimeStamps);
+    gclog_or_tty->gclog_stamp(_gc_id);
     gclog_or_tty->print("[%s-concurrent-%s: %3.3f/%3.3f secs]",
                  _collector->cmsGen()->short_name(),
                  _phase, _collector->timerValue(), _wallclock.seconds());
@@ -3682,7 +3686,7 @@
   setup_cms_unloading_and_verification_state();
 
   NOT_PRODUCT(GCTraceTime t("\ncheckpointRootsInitialWork",
-    PrintGCDetails && Verbose, true, _gc_timer_cm);)
+    PrintGCDetails && Verbose, true, _gc_timer_cm, _gc_tracer_cm->gc_id());)
   if (UseAdaptiveSizePolicy) {
     size_policy()->checkpoint_roots_initial_begin();
   }
@@ -3740,7 +3744,7 @@
       gch->set_par_threads(0);
     } else {
       // The serial version.
-      CMKlassClosure klass_closure(&notOlder);
+      KlassToOopClosure klass_closure(&notOlder);
       gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
       gch->gen_process_strong_roots(_cmsGen->level(),
                                     true,   // younger gens are roots
@@ -3799,7 +3803,7 @@
 
     CMSTokenSyncWithLocks ts(true, bitMapLock());
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    CMSPhaseAccounting pa(this, "mark", !PrintGCDetails);
+    CMSPhaseAccounting pa(this, "mark", _gc_tracer_cm->gc_id(), !PrintGCDetails);
     res = markFromRootsWork(asynch);
     if (res) {
       _collectorState = Precleaning;
@@ -4202,7 +4206,7 @@
   pst->all_tasks_completed();
 }
 
-class Par_ConcMarkingClosure: public CMSOopClosure {
+class Par_ConcMarkingClosure: public MetadataAwareOopClosure {
  private:
   CMSCollector* _collector;
   CMSConcMarkingTask* _task;
@@ -4215,7 +4219,7 @@
  public:
   Par_ConcMarkingClosure(CMSCollector* collector, CMSConcMarkingTask* task, OopTaskQueue* work_queue,
                          CMSBitMap* bit_map, CMSMarkStack* overflow_stack):
-    CMSOopClosure(collector->ref_processor()),
+    MetadataAwareOopClosure(collector->ref_processor()),
     _collector(collector),
     _task(task),
     _span(collector->_span),
@@ -4522,7 +4526,7 @@
       _start_sampling = false;
     }
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    CMSPhaseAccounting pa(this, "preclean", !PrintGCDetails);
+    CMSPhaseAccounting pa(this, "preclean", _gc_tracer_cm->gc_id(), !PrintGCDetails);
     preclean_work(CMSPrecleanRefLists1, CMSPrecleanSurvivors1);
   }
   CMSTokenSync x(true); // is cms thread
@@ -4551,7 +4555,7 @@
   // we will never do an actual abortable preclean cycle.
   if (get_eden_used() > CMSScheduleRemarkEdenSizeThreshold) {
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    CMSPhaseAccounting pa(this, "abortable-preclean", !PrintGCDetails);
+    CMSPhaseAccounting pa(this, "abortable-preclean", _gc_tracer_cm->gc_id(), !PrintGCDetails);
     // We need more smarts in the abortable preclean
     // loop below to deal with cases where allocation
     // in young gen is very very slow, and our precleaning
@@ -4696,7 +4700,7 @@
     GCTimer *gc_timer = NULL; // Currently not tracing concurrent phases
     rp->preclean_discovered_references(
           rp->is_alive_non_header(), &keep_alive, &complete_trace, &yield_cl,
-          gc_timer);
+          gc_timer, _gc_tracer_cm->gc_id());
   }
 
   if (clean_survivor) {  // preclean the active survivor space(s)
@@ -4986,7 +4990,7 @@
 }
 
 class PrecleanKlassClosure : public KlassClosure {
-  CMKlassClosure _cm_klass_closure;
+  KlassToOopClosure _cm_klass_closure;
  public:
   PrecleanKlassClosure(OopClosure* oop_closure) : _cm_klass_closure(oop_closure) {}
   void do_klass(Klass* k) {
@@ -5039,7 +5043,7 @@
       // expect it to be false and set to true
       FlagSetting fl(gch->_is_gc_active, false);
       NOT_PRODUCT(GCTraceTime t("Scavenge-Before-Remark",
-        PrintGCDetails && Verbose, true, _gc_timer_cm);)
+        PrintGCDetails && Verbose, true, _gc_timer_cm, _gc_tracer_cm->gc_id());)
       int level = _cmsGen->level() - 1;
       if (level >= 0) {
         gch->do_collection(true,        // full (i.e. force, see below)
@@ -5068,7 +5072,7 @@
 void CMSCollector::checkpointRootsFinalWork(bool asynch,
   bool clear_all_soft_refs, bool init_mark_was_synchronous) {
 
-  NOT_PRODUCT(GCTraceTime tr("checkpointRootsFinalWork", PrintGCDetails, false, _gc_timer_cm);)
+  NOT_PRODUCT(GCTraceTime tr("checkpointRootsFinalWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());)
 
   assert(haveFreelistLocks(), "must have free list locks");
   assert_lock_strong(bitMapLock());
@@ -5123,11 +5127,11 @@
       // the most recent young generation GC, minus those cleaned up by the
       // concurrent precleaning.
       if (CMSParallelRemarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
-        GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm);
+        GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
         do_remark_parallel();
       } else {
         GCTraceTime t("Rescan (non-parallel) ", PrintGCDetails, false,
-                    _gc_timer_cm);
+                    _gc_timer_cm, _gc_tracer_cm->gc_id());
         do_remark_non_parallel();
       }
     }
@@ -5140,7 +5144,7 @@
   verify_overflow_empty();
 
   {
-    NOT_PRODUCT(GCTraceTime ts("refProcessingWork", PrintGCDetails, false, _gc_timer_cm);)
+    NOT_PRODUCT(GCTraceTime ts("refProcessingWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());)
     refProcessingWork(asynch, clear_all_soft_refs);
   }
   verify_work_stacks_empty();
@@ -5224,7 +5228,7 @@
   _timer.start();
   GenCollectedHeap* gch = GenCollectedHeap::heap();
   Par_MarkRefsIntoClosure par_mri_cl(_collector->_span, &(_collector->_markBitMap));
-  CMKlassClosure klass_closure(&par_mri_cl);
+  KlassToOopClosure klass_closure(&par_mri_cl);
 
   // ---------- young gen roots --------------
   {
@@ -5298,7 +5302,7 @@
 };
 
 class RemarkKlassClosure : public KlassClosure {
-  CMKlassClosure _cm_klass_closure;
+  KlassToOopClosure _cm_klass_closure;
  public:
   RemarkKlassClosure(OopClosure* oop_closure) : _cm_klass_closure(oop_closure) {}
   void do_klass(Klass* k) {
@@ -5921,7 +5925,7 @@
                               NULL,  // space is set further below
                               &_markBitMap, &_markStack, &mrias_cl);
   {
-    GCTraceTime t("grey object rescan", PrintGCDetails, false, _gc_timer_cm);
+    GCTraceTime t("grey object rescan", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
     // Iterate over the dirty cards, setting the corresponding bits in the
     // mod union table.
     {
@@ -5958,7 +5962,7 @@
     Universe::verify();
   }
   {
-    GCTraceTime t("root rescan", PrintGCDetails, false, _gc_timer_cm);
+    GCTraceTime t("root rescan", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
 
     verify_work_stacks_empty();
 
@@ -5978,7 +5982,7 @@
   }
 
   {
-    GCTraceTime t("visit unhandled CLDs", PrintGCDetails, false, _gc_timer_cm);
+    GCTraceTime t("visit unhandled CLDs", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
 
     verify_work_stacks_empty();
 
@@ -5997,7 +6001,7 @@
   }
 
   {
-    GCTraceTime t("dirty klass scan", PrintGCDetails, false, _gc_timer_cm);
+    GCTraceTime t("dirty klass scan", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
 
     verify_work_stacks_empty();
 
@@ -6199,7 +6203,7 @@
                                 _span, &_markBitMap, &_markStack,
                                 &cmsKeepAliveClosure, false /* !preclean */);
   {
-    GCTraceTime t("weak refs processing", PrintGCDetails, false, _gc_timer_cm);
+    GCTraceTime t("weak refs processing", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
 
     ReferenceProcessorStats stats;
     if (rp->processing_is_mt()) {
@@ -6224,13 +6228,15 @@
                                         &cmsKeepAliveClosure,
                                         &cmsDrainMarkingStackClosure,
                                         &task_executor,
-                                        _gc_timer_cm);
+                                        _gc_timer_cm,
+                                        _gc_tracer_cm->gc_id());
     } else {
       stats = rp->process_discovered_references(&_is_alive_closure,
                                         &cmsKeepAliveClosure,
                                         &cmsDrainMarkingStackClosure,
                                         NULL,
-                                        _gc_timer_cm);
+                                        _gc_timer_cm,
+                                        _gc_tracer_cm->gc_id());
     }
     _gc_tracer_cm->report_gc_reference_stats(stats);
 
@@ -6241,7 +6247,7 @@
 
   if (should_unload_classes()) {
     {
-      GCTraceTime t("class unloading", PrintGCDetails, false, _gc_timer_cm);
+      GCTraceTime t("class unloading", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
 
       // Unload classes and purge the SystemDictionary.
       bool purged_class = SystemDictionary::do_unloading(&_is_alive_closure);
@@ -6254,7 +6260,7 @@
     }
 
     {
-      GCTraceTime t("scrub symbol table", PrintGCDetails, false, _gc_timer_cm);
+      GCTraceTime t("scrub symbol table", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
       // Clean up unreferenced symbols in symbol table.
       SymbolTable::unlink();
     }
@@ -6263,7 +6269,7 @@
   // CMS doesn't use the StringTable as hard roots when class unloading is turned off.
   // Need to check if we really scanned the StringTable.
   if ((roots_scanning_options() & SharedHeap::SO_Strings) == 0) {
-    GCTraceTime t("scrub string table", PrintGCDetails, false, _gc_timer_cm);
+    GCTraceTime t("scrub string table", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
     // Delete entries for dead interned strings.
     StringTable::unlink(&_is_alive_closure);
   }
@@ -6330,7 +6336,7 @@
   _intra_sweep_timer.start();
   if (asynch) {
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    CMSPhaseAccounting pa(this, "sweep", !PrintGCDetails);
+    CMSPhaseAccounting pa(this, "sweep", _gc_tracer_cm->gc_id(), !PrintGCDetails);
     // First sweep the old gen
     {
       CMSTokenSyncWithLocks ts(true, _cmsGen->freelistLock(),
@@ -6551,7 +6557,7 @@
     // Clear the mark bitmap (no grey objects to start with)
     // for the next cycle.
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    CMSPhaseAccounting cmspa(this, "reset", !PrintGCDetails);
+    CMSPhaseAccounting cmspa(this, "reset", _gc_tracer_cm->gc_id(), !PrintGCDetails);
 
     HeapWord* curAddr = _markBitMap.startWord();
     while (curAddr < _markBitMap.endWord()) {
@@ -6617,7 +6623,7 @@
 void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
   gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
   TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-  GCTraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL);
+  GCTraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer_cm->gc_id());
   TraceCollectorStats tcs(counters());
 
   switch (op) {
@@ -7735,7 +7741,7 @@
   CMSCollector* collector, MemRegion span,
   CMSBitMap* verification_bm, CMSBitMap* cms_bm,
   CMSMarkStack*  mark_stack):
-  CMSOopClosure(collector->ref_processor()),
+  MetadataAwareOopClosure(collector->ref_processor()),
   _collector(collector),
   _span(span),
   _verification_bm(verification_bm),
@@ -7788,7 +7794,7 @@
                      MemRegion span,
                      CMSBitMap* bitMap, CMSMarkStack*  markStack,
                      HeapWord* finger, MarkFromRootsClosure* parent) :
-  CMSOopClosure(collector->ref_processor()),
+  MetadataAwareOopClosure(collector->ref_processor()),
   _collector(collector),
   _span(span),
   _bitMap(bitMap),
@@ -7805,7 +7811,7 @@
                      HeapWord* finger,
                      HeapWord** global_finger_addr,
                      Par_MarkFromRootsClosure* parent) :
-  CMSOopClosure(collector->ref_processor()),
+  MetadataAwareOopClosure(collector->ref_processor()),
   _collector(collector),
   _whole_span(collector->_span),
   _span(span),
@@ -7854,11 +7860,6 @@
   _overflow_stack->expand(); // expand the stack if possible
 }
 
-void CMKlassClosure::do_klass(Klass* k) {
-  assert(_oop_closure != NULL, "Not initialized?");
-  k->oops_do(_oop_closure);
-}
-
 void PushOrMarkClosure::do_oop(oop obj) {
   // Ignore mark word because we are running concurrent with mutators.
   assert(obj->is_oop_or_null(true), "expected an oop or NULL");
@@ -7956,7 +7957,7 @@
                                        CMSBitMap* mod_union_table,
                                        CMSMarkStack*  mark_stack,
                                        bool           concurrent_precleaning):
-  CMSOopClosure(rp),
+  MetadataAwareOopClosure(rp),
   _collector(collector),
   _span(span),
   _bit_map(bit_map),
@@ -8029,7 +8030,7 @@
                                                ReferenceProcessor* rp,
                                                CMSBitMap* bit_map,
                                                OopTaskQueue* work_queue):
-  CMSOopClosure(rp),
+  MetadataAwareOopClosure(rp),
   _collector(collector),
   _span(span),
   _bit_map(bit_map),
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1444,7 +1444,7 @@
 
 // The following closures are used to do certain kinds of verification of
 // CMS marking.
-class PushAndMarkVerifyClosure: public CMSOopClosure {
+class PushAndMarkVerifyClosure: public MetadataAwareOopClosure {
   CMSCollector*    _collector;
   MemRegion        _span;
   CMSBitMap*       _verification_bm;
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -56,7 +56,7 @@
 void VM_CMS_Operation::verify_before_gc() {
   if (VerifyBeforeGC &&
       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-    GCTraceTime tm("Verify Before", false, false, _collector->_gc_timer_cm);
+    GCTraceTime tm("Verify Before", false, false, _collector->_gc_timer_cm, _collector->_gc_tracer_cm->gc_id());
     HandleMark hm;
     FreelistLocker x(_collector);
     MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
@@ -68,7 +68,7 @@
 void VM_CMS_Operation::verify_after_gc() {
   if (VerifyAfterGC &&
       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-    GCTraceTime tm("Verify After", false, false, _collector->_gc_timer_cm);
+    GCTraceTime tm("Verify After", false, false, _collector->_gc_timer_cm, _collector->_gc_tracer_cm->gc_id());
     HandleMark hm;
     FreelistLocker x(_collector);
     MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
--- a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
 #include "memory/space.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 
 // Even though we don't use the GC efficiency in our heuristics as
 // much as we used to, we still order according to GC efficiency. This
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -45,6 +45,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/prefetch.inline.hpp"
 #include "services/memTracker.hpp"
 
@@ -511,6 +512,7 @@
   _has_overflown(false),
   _concurrent(false),
   _has_aborted(false),
+  _aborted_gc_id(GCId::undefined()),
   _restart_for_overflow(false),
   _concurrent_marking_in_progress(false),
 
@@ -1020,8 +1022,7 @@
       force_overflow()->update();
 
       if (G1Log::fine()) {
-        gclog_or_tty->date_stamp(PrintGCDateStamps);
-        gclog_or_tty->stamp(PrintGCTimeStamps);
+        gclog_or_tty->gclog_stamp(concurrent_gc_id());
         gclog_or_tty->print_cr("[GC concurrent-mark-reset-for-overflow]");
       }
     }
@@ -2469,7 +2470,7 @@
     if (G1Log::finer()) {
       gclog_or_tty->put(' ');
     }
-    GCTraceTime t("GC ref-proc", G1Log::finer(), false, g1h->gc_timer_cm());
+    GCTraceTime t("GC ref-proc", G1Log::finer(), false, g1h->gc_timer_cm(), concurrent_gc_id());
 
     ReferenceProcessor* rp = g1h->ref_processor_cm();
 
@@ -2526,7 +2527,8 @@
                                           &g1_keep_alive,
                                           &g1_drain_mark_stack,
                                           executor,
-                                          g1h->gc_timer_cm());
+                                          g1h->gc_timer_cm(),
+                                          concurrent_gc_id());
     g1h->gc_tracer_cm()->report_gc_reference_stats(stats);
 
     // The do_oop work routines of the keep_alive and drain_marking_stack
@@ -3261,6 +3263,12 @@
   }
   _first_overflow_barrier_sync.abort();
   _second_overflow_barrier_sync.abort();
+  const GCId& gc_id = _g1h->gc_tracer_cm()->gc_id();
+  if (!gc_id.is_undefined()) {
+    // We can do multiple full GCs before ConcurrentMarkThread::run() gets a chance
+    // to detect that it was aborted. Only keep track of the first GC id that we aborted.
+    _aborted_gc_id = gc_id;
+   }
   _has_aborted = true;
 
   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
@@ -3275,6 +3283,13 @@
   _g1h->register_concurrent_cycle_end();
 }
 
+const GCId& ConcurrentMark::concurrent_gc_id() {
+  if (has_aborted()) {
+    return _aborted_gc_id;
+  }
+  return _g1h->gc_tracer_cm()->gc_id();
+}
+
 static void print_ms_time_info(const char* prefix, const char* name,
                                NumberSeq& ns) {
   gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).",
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_HPP
 
 #include "gc_implementation/g1/heapRegionSet.hpp"
+#include "gc_implementation/shared/gcId.hpp"
 #include "utilities/taskqueue.hpp"
 
 class G1CollectedHeap;
@@ -444,6 +445,7 @@
   volatile bool           _concurrent;
   // Set at the end of a Full GC so that marking aborts
   volatile bool           _has_aborted;
+  GCId                    _aborted_gc_id;
 
   // Used when remark aborts due to an overflow to indicate that
   // another concurrent marking phase should start
@@ -824,6 +826,8 @@
 
   bool has_aborted()      { return _has_aborted; }
 
+  const GCId& concurrent_gc_id();
+
   // This prints the global/local fingers. It is used for debugging.
   NOT_PRODUCT(void print_finger();)
 
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,4 +1,4 @@
-/*
+ /*
  * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,6 +29,7 @@
 #include "gc_implementation/g1/g1Log.hpp"
 #include "gc_implementation/g1/g1MMUTracker.hpp"
 #include "gc_implementation/g1/vm_operations_g1.hpp"
+#include "gc_implementation/shared/gcTrace.hpp"
 #include "memory/resourceArea.hpp"
 #include "runtime/vmThread.hpp"
 
@@ -111,8 +112,7 @@
       double scan_start = os::elapsedTime();
       if (!cm()->has_aborted()) {
         if (G1Log::fine()) {
-          gclog_or_tty->date_stamp(PrintGCDateStamps);
-          gclog_or_tty->stamp(PrintGCTimeStamps);
+          gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
           gclog_or_tty->print_cr("[GC concurrent-root-region-scan-start]");
         }
 
@@ -120,8 +120,7 @@
 
         double scan_end = os::elapsedTime();
         if (G1Log::fine()) {
-          gclog_or_tty->date_stamp(PrintGCDateStamps);
-          gclog_or_tty->stamp(PrintGCTimeStamps);
+          gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
           gclog_or_tty->print_cr("[GC concurrent-root-region-scan-end, %1.7lf secs]",
                                  scan_end - scan_start);
         }
@@ -129,8 +128,7 @@
 
       double mark_start_sec = os::elapsedTime();
       if (G1Log::fine()) {
-        gclog_or_tty->date_stamp(PrintGCDateStamps);
-        gclog_or_tty->stamp(PrintGCTimeStamps);
+        gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
         gclog_or_tty->print_cr("[GC concurrent-mark-start]");
       }
 
@@ -153,8 +151,7 @@
           }
 
           if (G1Log::fine()) {
-            gclog_or_tty->date_stamp(PrintGCDateStamps);
-            gclog_or_tty->stamp(PrintGCTimeStamps);
+            gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
             gclog_or_tty->print_cr("[GC concurrent-mark-end, %1.7lf secs]",
                                       mark_end_sec - mark_start_sec);
           }
@@ -169,8 +166,7 @@
                                    "in remark (restart #%d).", iter);
           }
           if (G1Log::fine()) {
-            gclog_or_tty->date_stamp(PrintGCDateStamps);
-            gclog_or_tty->stamp(PrintGCTimeStamps);
+            gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
             gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]");
           }
         }
@@ -213,8 +209,7 @@
 
         double cleanup_start_sec = os::elapsedTime();
         if (G1Log::fine()) {
-          gclog_or_tty->date_stamp(PrintGCDateStamps);
-          gclog_or_tty->stamp(PrintGCTimeStamps);
+          gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
           gclog_or_tty->print_cr("[GC concurrent-cleanup-start]");
         }
 
@@ -234,8 +229,7 @@
 
         double cleanup_end_sec = os::elapsedTime();
         if (G1Log::fine()) {
-          gclog_or_tty->date_stamp(PrintGCDateStamps);
-          gclog_or_tty->stamp(PrintGCTimeStamps);
+          gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
           gclog_or_tty->print_cr("[GC concurrent-cleanup-end, %1.7lf secs]",
                                  cleanup_end_sec - cleanup_start_sec);
         }
@@ -276,8 +270,7 @@
 
       if (cm()->has_aborted()) {
         if (G1Log::fine()) {
-          gclog_or_tty->date_stamp(PrintGCDateStamps);
-          gclog_or_tty->stamp(PrintGCTimeStamps);
+          gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
           gclog_or_tty->print_cr("[GC concurrent-mark-abort]");
         }
       }
--- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,7 +26,7 @@
 #include "gc_implementation/g1/dirtyCardQueue.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.inline.hpp"
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
+#include "gc_implementation/g1/heapRegion.hpp"
 #include "memory/space.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
@@ -98,6 +99,20 @@
   return (delta & right_n_bits(LogN_words)) == (size_t)NoBits;
 }
 
+void G1BlockOffsetSharedArray::set_offset_array(HeapWord* left, HeapWord* right, u_char offset) {
+  check_index(index_for(right - 1), "right address out of range");
+  assert(left  < right, "Heap addresses out of order");
+  size_t num_cards = pointer_delta(right, left) >> LogN_words;
+  if (UseMemSetInBOT) {
+    memset(&_offset_array[index_for(left)], offset, num_cards);
+  } else {
+    size_t i = index_for(left);
+    const size_t end = i + num_cards;
+    for (; i < end; i++) {
+      _offset_array[i] = offset;
+    }
+  }
+}
 
 //////////////////////////////////////////////////////////////////////
 // G1BlockOffsetArray
@@ -107,7 +122,7 @@
                                        MemRegion mr, bool init_to_zero) :
   G1BlockOffsetTable(mr.start(), mr.end()),
   _unallocated_block(_bottom),
-  _array(array), _csp(NULL),
+  _array(array), _gsp(NULL),
   _init_to_zero(init_to_zero) {
   assert(_bottom <= _end, "arguments out of order");
   if (!_init_to_zero) {
@@ -117,9 +132,8 @@
   }
 }
 
-void G1BlockOffsetArray::set_space(Space* sp) {
-  _sp = sp;
-  _csp = sp->toContiguousSpace();
+void G1BlockOffsetArray::set_space(G1OffsetTableContigSpace* sp) {
+  _gsp = sp;
 }
 
 // The arguments follow the normal convention of denoting
@@ -378,7 +392,7 @@
   }
   // Otherwise, find the block start using the table.
   HeapWord* q = block_at_or_preceding(addr, false, 0);
-  HeapWord* n = q + _sp->block_size(q);
+  HeapWord* n = q + block_size(q);
   return forward_to_block_containing_addr_const(q, n, addr);
 }
 
@@ -406,31 +420,17 @@
          err_msg("next_boundary is beyond the end of the covered region "
                  " next_boundary " PTR_FORMAT " _array->_end " PTR_FORMAT,
                  next_boundary, _array->_end));
-  if (csp() != NULL) {
-    if (addr >= csp()->top()) return csp()->top();
-    while (next_boundary < addr) {
-      while (n <= next_boundary) {
-        q = n;
-        oop obj = oop(q);
-        if (obj->klass_or_null() == NULL) return q;
-        n += obj->size();
-      }
-      assert(q <= next_boundary && n > next_boundary, "Consequence of loop");
-      // [q, n) is the block that crosses the boundary.
-      alloc_block_work2(&next_boundary, &next_index, q, n);
+  if (addr >= gsp()->top()) return gsp()->top();
+  while (next_boundary < addr) {
+    while (n <= next_boundary) {
+      q = n;
+      oop obj = oop(q);
+      if (obj->klass_or_null() == NULL) return q;
+      n += obj->size();
     }
-  } else {
-    while (next_boundary < addr) {
-      while (n <= next_boundary) {
-        q = n;
-        oop obj = oop(q);
-        if (obj->klass_or_null() == NULL) return q;
-        n += _sp->block_size(q);
-      }
-      assert(q <= next_boundary && n > next_boundary, "Consequence of loop");
-      // [q, n) is the block that crosses the boundary.
-      alloc_block_work2(&next_boundary, &next_index, q, n);
-    }
+    assert(q <= next_boundary && n > next_boundary, "Consequence of loop");
+    // [q, n) is the block that crosses the boundary.
+    alloc_block_work2(&next_boundary, &next_index, q, n);
   }
   return forward_to_block_containing_addr_const(q, n, addr);
 }
@@ -637,7 +637,7 @@
   assert(_bottom <= addr && addr < _end,
          "addr must be covered by this Array");
   HeapWord* q = block_at_or_preceding(addr, true, _next_offset_index-1);
-  HeapWord* n = q + _sp->block_size(q);
+  HeapWord* n = q + block_size(q);
   return forward_to_block_containing_addr_const(q, n, addr);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -52,8 +52,8 @@
 // consolidation.
 
 // Forward declarations
-class ContiguousSpace;
 class G1BlockOffsetSharedArray;
+class G1OffsetTableContigSpace;
 
 class G1BlockOffsetTable VALUE_OBJ_CLASS_SPEC {
   friend class VMStructs;
@@ -157,6 +157,8 @@
     return _offset_array[index];
   }
 
+  void set_offset_array(HeapWord* left, HeapWord* right, u_char offset);
+
   void set_offset_array(size_t index, u_char offset) {
     check_index(index, "index out of range");
     check_offset(offset, "offset too large");
@@ -170,21 +172,6 @@
     _offset_array[index] = (u_char) pointer_delta(high, low);
   }
 
-  void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) {
-    check_index(index_for(right - 1), "right address out of range");
-    assert(left  < right, "Heap addresses out of order");
-    size_t num_cards = pointer_delta(right, left) >> LogN_words;
-    if (UseMemSetInBOT) {
-      memset(&_offset_array[index_for(left)], offset, num_cards);
-    } else {
-      size_t i = index_for(left);
-      const size_t end = i + num_cards;
-      for (; i < end; i++) {
-        _offset_array[i] = offset;
-      }
-    }
-  }
-
   void set_offset_array(size_t left, size_t right, u_char offset) {
     check_index(right, "right index out of range");
     assert(left <= right, "indexes out of order");
@@ -281,11 +268,7 @@
   G1BlockOffsetSharedArray* _array;
 
   // The space that owns this subregion.
-  Space* _sp;
-
-  // If "_sp" is a contiguous space, the field below is the view of "_sp"
-  // as a contiguous space, else NULL.
-  ContiguousSpace* _csp;
+  G1OffsetTableContigSpace* _gsp;
 
   // If true, array entries are initialized to 0; otherwise, they are
   // initialized to point backwards to the beginning of the covered region.
@@ -310,7 +293,9 @@
 
 protected:
 
-  ContiguousSpace* csp() const { return _csp; }
+  G1OffsetTableContigSpace* gsp() const { return _gsp; }
+
+  inline size_t block_size(const HeapWord* p) const;
 
   // Returns the address of a block whose start is at most "addr".
   // If "has_max_index" is true, "assumes "max_index" is the last valid one
@@ -363,7 +348,7 @@
   // "this" to be passed as a parameter to a member constructor for
   // the containing concrete subtype of Space.
   // This would be legal C++, but MS VC++ doesn't allow it.
-  void set_space(Space* sp);
+  void set_space(G1OffsetTableContigSpace* sp);
 
   // Resets the covered region to the given "mr".
   void set_region(MemRegion mr);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1BLOCKOFFSETTABLE_INLINE_HPP
 
 #include "gc_implementation/g1/g1BlockOffsetTable.hpp"
+#include "gc_implementation/g1/heapRegion.hpp"
 #include "memory/space.hpp"
 
 inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) {
@@ -69,6 +70,11 @@
   return result;
 }
 
+inline size_t
+G1BlockOffsetArray::block_size(const HeapWord* p) const {
+  return gsp()->block_size(p);
+}
+
 inline HeapWord*
 G1BlockOffsetArray::block_at_or_preceding(const void* addr,
                                           bool has_max_index,
@@ -88,7 +94,7 @@
     // to go back by.
     size_t n_cards_back = BlockOffsetArray::entry_to_cards_back(offset);
     q -= (N_words * n_cards_back);
-    assert(q >= _sp->bottom(), "Went below bottom!");
+    assert(q >= gsp()->bottom(), "Went below bottom!");
     index -= n_cards_back;
     offset = _array->offset_array(index);
   }
@@ -101,21 +107,12 @@
 G1BlockOffsetArray::
 forward_to_block_containing_addr_const(HeapWord* q, HeapWord* n,
                                        const void* addr) const {
-  if (csp() != NULL) {
-    if (addr >= csp()->top()) return csp()->top();
-    while (n <= addr) {
-      q = n;
-      oop obj = oop(q);
-      if (obj->klass_or_null() == NULL) return q;
-      n += obj->size();
-    }
-  } else {
-    while (n <= addr) {
-      q = n;
-      oop obj = oop(q);
-      if (obj->klass_or_null() == NULL) return q;
-      n += _sp->block_size(q);
-    }
+  if (addr >= gsp()->top()) return gsp()->top();
+  while (n <= addr) {
+    q = n;
+    oop obj = oop(q);
+    if (obj->klass_or_null() == NULL) return q;
+    n += obj->size();
   }
   assert(q <= n, "wrong order for q and addr");
   assert(addr < n, "wrong order for addr and n");
@@ -126,7 +123,7 @@
 G1BlockOffsetArray::forward_to_block_containing_addr(HeapWord* q,
                                                      const void* addr) {
   if (oop(q)->klass_or_null() == NULL) return q;
-  HeapWord* n = q + _sp->block_size(q);
+  HeapWord* n = q + block_size(q);
   // In the normal case, where the query "addr" is a card boundary, and the
   // offset table chunks are the same size as cards, the block starting at
   // "q" will contain addr, so the test below will fail, and we'll fall
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -62,6 +62,7 @@
 #include "memory/referenceProcessor.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.pcgc.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/prefetch.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/vmThread.hpp"
@@ -1298,7 +1299,7 @@
     TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
 
     {
-      GCTraceTime t(GCCauseString("Full GC", gc_cause()), G1Log::fine(), true, NULL);
+      GCTraceTime t(GCCauseString("Full GC", gc_cause()), G1Log::fine(), true, NULL, gc_tracer->gc_id());
       TraceCollectorStats tcs(g1mm()->full_collection_counters());
       TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
 
@@ -3858,8 +3859,7 @@
     return;
   }
 
-  gclog_or_tty->date_stamp(PrintGCDateStamps);
-  gclog_or_tty->stamp(PrintGCTimeStamps);
+  gclog_or_tty->gclog_stamp(_gc_tracer_stw->gc_id());
 
   GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause())
     .append(g1_policy()->gcs_are_young() ? "(young)" : "(mixed)")
@@ -5340,17 +5340,14 @@
 class G1CopyingKeepAliveClosure: public OopClosure {
   G1CollectedHeap*         _g1h;
   OopClosure*              _copy_non_heap_obj_cl;
-  OopsInHeapRegionClosure* _copy_metadata_obj_cl;
   G1ParScanThreadState*    _par_scan_state;
 
 public:
   G1CopyingKeepAliveClosure(G1CollectedHeap* g1h,
                             OopClosure* non_heap_obj_cl,
-                            OopsInHeapRegionClosure* metadata_obj_cl,
                             G1ParScanThreadState* pss):
     _g1h(g1h),
     _copy_non_heap_obj_cl(non_heap_obj_cl),
-    _copy_metadata_obj_cl(metadata_obj_cl),
     _par_scan_state(pss)
   {}
 
@@ -5383,7 +5380,7 @@
         _par_scan_state->push_on_queue(p);
       } else {
         assert(!Metaspace::contains((const void*)p),
-               err_msg("Otherwise need to call _copy_metadata_obj_cl->do_oop(p) "
+               err_msg("Unexpectedly found a pointer from metadata: "
                               PTR_FORMAT, p));
           _copy_non_heap_obj_cl->do_oop(p);
         }
@@ -5478,22 +5475,18 @@
     pss.set_evac_failure_closure(&evac_failure_cl);
 
     G1ParScanExtRootClosure        only_copy_non_heap_cl(_g1h, &pss, NULL);
-    G1ParScanMetadataClosure       only_copy_metadata_cl(_g1h, &pss, NULL);
 
     G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, &pss, NULL);
-    G1ParScanAndMarkMetadataClosure copy_mark_metadata_cl(_g1h, &pss, NULL);
 
     OopClosure*                    copy_non_heap_cl = &only_copy_non_heap_cl;
-    OopsInHeapRegionClosure*       copy_metadata_cl = &only_copy_metadata_cl;
 
     if (_g1h->g1_policy()->during_initial_mark_pause()) {
       // We also need to mark copied objects.
       copy_non_heap_cl = &copy_mark_non_heap_cl;
-      copy_metadata_cl = &copy_mark_metadata_cl;
     }
 
     // Keep alive closure.
-    G1CopyingKeepAliveClosure keep_alive(_g1h, copy_non_heap_cl, copy_metadata_cl, &pss);
+    G1CopyingKeepAliveClosure keep_alive(_g1h, copy_non_heap_cl, &pss);
 
     // Complete GC closure
     G1ParEvacuateFollowersClosure drain_queue(_g1h, &pss, _task_queues, _terminator);
@@ -5588,18 +5581,14 @@
 
 
     G1ParScanExtRootClosure        only_copy_non_heap_cl(_g1h, &pss, NULL);
-    G1ParScanMetadataClosure       only_copy_metadata_cl(_g1h, &pss, NULL);
 
     G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(_g1h, &pss, NULL);
-    G1ParScanAndMarkMetadataClosure copy_mark_metadata_cl(_g1h, &pss, NULL);
 
     OopClosure*                    copy_non_heap_cl = &only_copy_non_heap_cl;
-    OopsInHeapRegionClosure*       copy_metadata_cl = &only_copy_metadata_cl;
 
     if (_g1h->g1_policy()->during_initial_mark_pause()) {
       // We also need to mark copied objects.
       copy_non_heap_cl = &copy_mark_non_heap_cl;
-      copy_metadata_cl = &copy_mark_metadata_cl;
     }
 
     // Is alive closure
@@ -5607,7 +5596,7 @@
 
     // Copying keep alive closure. Applied to referent objects that need
     // to be copied.
-    G1CopyingKeepAliveClosure keep_alive(_g1h, copy_non_heap_cl, copy_metadata_cl, &pss);
+    G1CopyingKeepAliveClosure keep_alive(_g1h, copy_non_heap_cl, &pss);
 
     ReferenceProcessor* rp = _g1h->ref_processor_cm();
 
@@ -5713,22 +5702,18 @@
   assert(pss.refs()->is_empty(), "pre-condition");
 
   G1ParScanExtRootClosure        only_copy_non_heap_cl(this, &pss, NULL);
-  G1ParScanMetadataClosure       only_copy_metadata_cl(this, &pss, NULL);
 
   G1ParScanAndMarkExtRootClosure copy_mark_non_heap_cl(this, &pss, NULL);
-  G1ParScanAndMarkMetadataClosure copy_mark_metadata_cl(this, &pss, NULL);
 
   OopClosure*                    copy_non_heap_cl = &only_copy_non_heap_cl;
-  OopsInHeapRegionClosure*       copy_metadata_cl = &only_copy_metadata_cl;
 
   if (_g1h->g1_policy()->during_initial_mark_pause()) {
     // We also need to mark copied objects.
     copy_non_heap_cl = &copy_mark_non_heap_cl;
-    copy_metadata_cl = &copy_mark_metadata_cl;
   }
 
   // Keep alive closure.
-  G1CopyingKeepAliveClosure keep_alive(this, copy_non_heap_cl, copy_metadata_cl, &pss);
+  G1CopyingKeepAliveClosure keep_alive(this, copy_non_heap_cl, &pss);
 
   // Serial Complete GC closure
   G1STWDrainQueueClosure drain_queue(this, &pss);
@@ -5743,7 +5728,8 @@
                                               &keep_alive,
                                               &drain_queue,
                                               NULL,
-                                              _gc_timer_stw);
+                                              _gc_timer_stw,
+                                              _gc_tracer_stw->gc_id());
   } else {
     // Parallel reference processing
     assert(rp->num_q() == no_of_gc_workers, "sanity");
@@ -5754,7 +5740,8 @@
                                               &keep_alive,
                                               &drain_queue,
                                               &par_task_executor,
-                                              _gc_timer_stw);
+                                              _gc_timer_stw,
+                                              _gc_tracer_stw->gc_id());
   }
 
   _gc_tracer_stw->report_gc_reference_stats(stats);
@@ -6993,7 +6980,7 @@
       return;
     }
 
-    if (ScavengeRootsInCode && nm->detect_scavenge_root_oops()) {
+    if (ScavengeRootsInCode) {
       _g1h->register_nmethod(nm);
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
 #include "gc_implementation/g1/g1Log.hpp"
 #include "gc_implementation/g1/g1StringDedup.hpp"
+#include "runtime/atomic.inline.hpp"
 
 // Helper class for avoiding interleaved logging
 class LineBuffer: public StackObj {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,7 +28,7 @@
 #include "gc_implementation/g1/g1HotCardCache.hpp"
 #include "gc_implementation/g1/g1RemSet.hpp"
 #include "gc_implementation/g1/heapRegion.hpp"
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
 
 G1HotCardCache::G1HotCardCache(G1CollectedHeap *g1h):
   _g1h(g1h), _hot_cache(NULL), _use_cache(false), _card_counts(g1h) {}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -44,6 +44,7 @@
 #include "oops/instanceRefKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/synchronizer.hpp"
@@ -123,7 +124,7 @@
 void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading,
                                     bool clear_all_softrefs) {
   // Recursively traverse all live objects and mark them
-  GCTraceTime tm("phase 1", G1Log::fine() && Verbose, true, gc_timer());
+  GCTraceTime tm("phase 1", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id());
   GenMarkSweep::trace(" 1");
 
   SharedHeap* sh = SharedHeap::heap();
@@ -146,7 +147,8 @@
                                       &GenMarkSweep::keep_alive,
                                       &GenMarkSweep::follow_stack_closure,
                                       NULL,
-                                      gc_timer());
+                                      gc_timer(),
+                                      gc_tracer()->gc_id());
   gc_tracer()->report_gc_reference_stats(stats);
 
 
@@ -260,7 +262,7 @@
 
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
-  GCTraceTime tm("phase 2", G1Log::fine() && Verbose, true, gc_timer());
+  GCTraceTime tm("phase 2", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id());
   GenMarkSweep::trace("2");
 
   // find the first region
@@ -297,7 +299,7 @@
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
   // Adjust the pointers to reflect the new locations
-  GCTraceTime tm("phase 3", G1Log::fine() && Verbose, true, gc_timer());
+  GCTraceTime tm("phase 3", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id());
   GenMarkSweep::trace("3");
 
   SharedHeap* sh = SharedHeap::heap();
@@ -358,7 +360,7 @@
   // to use a higher index (saved from phase2) when verifying perm_gen.
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
-  GCTraceTime tm("phase 4", G1Log::fine() && Verbose, true, gc_timer());
+  GCTraceTime tm("phase 4", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id());
   GenMarkSweep::trace("4");
 
   G1SpaceCompactClosure blk;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #include "gc_implementation/g1/heapRegion.hpp"
 #include "gc_implementation/g1/satbQueue.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/thread.inline.hpp"
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -31,6 +31,7 @@
 #include "gc_implementation/g1/g1StringDedupStat.hpp"
 #include "gc_implementation/g1/g1StringDedupTable.hpp"
 #include "gc_implementation/g1/g1StringDedupThread.hpp"
+#include "runtime/atomic.inline.hpp"
 
 bool G1StringDedup::_enabled = false;
 
@@ -211,3 +212,16 @@
     G1StringDedupTable::finish_rehash(_rehashed_table);
   }
 }
+
+// Atomically claims the next available queue for exclusive access by
+// the current thread. Returns the queue number of the claimed queue.
+size_t G1StringDedupUnlinkOrOopsDoClosure::claim_queue() {
+  return (size_t)Atomic::add_ptr(1, &_next_queue) - 1;
+}
+
+// Atomically claims the next available table partition for exclusive
+// access by the current thread. Returns the table bucket number where
+// the claimed partition starts.
+size_t G1StringDedupUnlinkOrOopsDoClosure::claim_table_partition(size_t partition_size) {
+  return (size_t)Atomic::add_ptr(partition_size, &_next_bucket) - partition_size;
+}
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -84,6 +84,7 @@
 
 #include "memory/allocation.hpp"
 #include "oops/oop.hpp"
+#include "runtime/atomic.hpp"
 
 class OopClosure;
 class BoolObjectClosure;
@@ -174,16 +175,12 @@
 
   // Atomically claims the next available queue for exclusive access by
   // the current thread. Returns the queue number of the claimed queue.
-  size_t claim_queue() {
-    return (size_t)Atomic::add_ptr(1, &_next_queue) - 1;
-  }
+  size_t claim_queue();
 
   // Atomically claims the next available table partition for exclusive
   // access by the current thread. Returns the table bucket number where
   // the claimed partition starts.
-  size_t claim_table_partition(size_t partition_size) {
-    return (size_t)Atomic::add_ptr(partition_size, &_next_bucket) - partition_size;
-  }
+  size_t claim_table_partition(size_t partition_size);
 
   // Applies and returns the result from the is_alive closure, or
   // returns true if no such closure was provided.
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #include "classfile/javaClasses.hpp"
 #include "gc_implementation/g1/g1StringDedupQueue.hpp"
 #include "memory/gcLocker.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/stack.inline.hpp"
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "gc_implementation/g1/g1StringDedupTable.hpp"
 #include "gc_implementation/g1/g1StringDedupThread.hpp"
 #include "gc_implementation/g1/g1StringDedupQueue.hpp"
+#include "runtime/atomic.inline.hpp"
 
 G1StringDedupThread* G1StringDedupThread::_thread = NULL;
 
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -34,6 +34,7 @@
 #include "memory/iterator.hpp"
 #include "memory/space.inline.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
@@ -48,7 +49,7 @@
                                  HeapRegion* hr, ExtendedOopClosure* cl,
                                  CardTableModRefBS::PrecisionStyle precision,
                                  FilterKind fk) :
-  ContiguousSpaceDCTOC(hr, cl, precision, NULL),
+  DirtyCardToOopClosure(hr, cl, precision, NULL),
   _hr(hr), _fk(fk), _g1(g1) { }
 
 FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r,
@@ -77,19 +78,18 @@
   return cur;
 }
 
-void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr,
-                                              HeapWord* bottom,
-                                              HeapWord* top,
-                                              ExtendedOopClosure* cl) {
+void HeapRegionDCTOC::walk_mem_region(MemRegion mr,
+                                      HeapWord* bottom,
+                                      HeapWord* top) {
   G1CollectedHeap* g1h = _g1;
   int oop_size;
   ExtendedOopClosure* cl2 = NULL;
 
-  FilterIntoCSClosure intoCSFilt(this, g1h, cl);
-  FilterOutOfRegionClosure outOfRegionFilt(_hr, cl);
+  FilterIntoCSClosure intoCSFilt(this, g1h, _cl);
+  FilterOutOfRegionClosure outOfRegionFilt(_hr, _cl);
 
   switch (_fk) {
-  case NoFilterKind:          cl2 = cl; break;
+  case NoFilterKind:          cl2 = _cl; break;
   case IntoCSFilterKind:      cl2 = &intoCSFilt; break;
   case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break;
   default:                    ShouldNotReachHere();
@@ -111,17 +111,17 @@
     // We replicate the loop below for several kinds of possible filters.
     switch (_fk) {
     case NoFilterKind:
-      bottom = walk_mem_region_loop(cl, g1h, _hr, bottom, top);
+      bottom = walk_mem_region_loop(_cl, g1h, _hr, bottom, top);
       break;
 
     case IntoCSFilterKind: {
-      FilterIntoCSClosure filt(this, g1h, cl);
+      FilterIntoCSClosure filt(this, g1h, _cl);
       bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
       break;
     }
 
     case OutOfRegionFilterKind: {
-      FilterOutOfRegionClosure filt(_hr, cl);
+      FilterOutOfRegionClosure filt(_hr, _cl);
       bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
       break;
     }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,7 +25,7 @@
 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_HPP
 
-#include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
+#include "gc_implementation/g1/g1BlockOffsetTable.hpp"
 #include "gc_implementation/g1/g1_specialized_oop_closures.hpp"
 #include "gc_implementation/g1/survRateGroup.hpp"
 #include "gc_implementation/shared/ageTable.hpp"
@@ -71,7 +71,7 @@
 // in the concurrent marker used by G1 to filter remembered
 // sets.
 
-class HeapRegionDCTOC : public ContiguousSpaceDCTOC {
+class HeapRegionDCTOC : public DirtyCardToOopClosure {
 public:
   // Specification of possible DirtyCardToOopClosure filtering.
   enum FilterKind {
@@ -85,39 +85,13 @@
   FilterKind _fk;
   G1CollectedHeap* _g1;
 
-  void walk_mem_region_with_cl(MemRegion mr,
-                               HeapWord* bottom, HeapWord* top,
-                               ExtendedOopClosure* cl);
-
-  // We don't specialize this for FilteringClosure; filtering is handled by
-  // the "FilterKind" mechanism.  But we provide this to avoid a compiler
-  // warning.
-  void walk_mem_region_with_cl(MemRegion mr,
-                               HeapWord* bottom, HeapWord* top,
-                               FilteringClosure* cl) {
-    HeapRegionDCTOC::walk_mem_region_with_cl(mr, bottom, top,
-                                             (ExtendedOopClosure*)cl);
-  }
-
-  // Get the actual top of the area on which the closure will
-  // operate, given where the top is assumed to be (the end of the
-  // memory region passed to do_MemRegion) and where the object
-  // at the top is assumed to start. For example, an object may
-  // start at the top but actually extend past the assumed top,
-  // in which case the top becomes the end of the object.
-  HeapWord* get_actual_top(HeapWord* top, HeapWord* top_obj) {
-    return ContiguousSpaceDCTOC::get_actual_top(top, top_obj);
-  }
-
   // Walk the given memory region from bottom to (actual) top
   // looking for objects and applying the oop closure (_cl) to
   // them. The base implementation of this treats the area as
   // blocks, where a block may or may not be an object. Sub-
   // classes should override this to provide more accurate
   // or possibly more efficient walking.
-  void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top) {
-    Filtering_DCTOC::walk_mem_region(mr, bottom, top);
-  }
+  void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top);
 
 public:
   HeapRegionDCTOC(G1CollectedHeap* g1,
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,8 @@
 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGION_INLINE_HPP
 
+#include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
+
 inline HeapWord* G1OffsetTableContigSpace::allocate(size_t size) {
   HeapWord* res = ContiguousSpace::allocate(size);
   if (res != NULL) {
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -32,6 +32,7 @@
 #include "memory/padded.inline.hpp"
 #include "memory/space.inline.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "utilities/bitMap.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/growableArray.hpp"
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -29,6 +29,7 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/cardTableModRefBS.hpp"
 #include "memory/space.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 
 #define SPARSE_PRT_VERBOSE 0
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -226,7 +226,7 @@
 void VM_CGC_Operation::doit() {
   gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
   TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
-  GCTraceTime t(_printGCMessage, G1Log::fine(), true, G1CollectedHeap::heap()->gc_timer_cm());
+  GCTraceTime t(_printGCMessage, G1Log::fine(), true, G1CollectedHeap::heap()->gc_timer_cm(), G1CollectedHeap::heap()->concurrent_mark()->concurrent_gc_id());
   SharedHeap* sh = SharedHeap::heap();
   // This could go away if CollectedHeap gave access to _gc_is_active...
   if (sh != NULL) {
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -47,6 +47,7 @@
 #include "oops/objArrayOop.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.pcgc.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
@@ -955,7 +956,7 @@
     size_policy->minor_collection_begin();
   }
 
-  GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL);
+  GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, gc_tracer.gc_id());
   // Capture heap used before collection (for printing).
   size_t gch_prev_used = gch->used();
 
@@ -1013,14 +1014,14 @@
     ParNewRefProcTaskExecutor task_executor(*this, thread_state_set);
     stats = rp->process_discovered_references(&is_alive, &keep_alive,
                                               &evacuate_followers, &task_executor,
-                                              _gc_timer);
+                                              _gc_timer, gc_tracer.gc_id());
   } else {
     thread_state_set.flush();
     gch->set_par_threads(0);  // 0 ==> non-parallel.
     gch->save_marks();
     stats = rp->process_discovered_references(&is_alive, &keep_alive,
                                               &evacuate_followers, NULL,
-                                              _gc_timer);
+                                              _gc_timer, gc_tracer.gc_id());
   }
   gc_tracer.report_gc_reference_stats(stats);
   if (!promotion_failed()) {
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp"
 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/os.hpp"
 #include "utilities/bitMap.inline.hpp"
 #include "services/memTracker.hpp"
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -53,7 +53,7 @@
   ResourceMark rm;
 
   NOT_PRODUCT(GCTraceTime tm("ThreadRootsMarkingTask",
-    PrintGCDetails && TraceParallelOldGCTasks, true, NULL));
+    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
   ParCompactionManager* cm =
     ParCompactionManager::gc_thread_compaction_manager(which);
 
@@ -82,7 +82,7 @@
   assert(Universe::heap()->is_gc_active(), "called outside gc");
 
   NOT_PRODUCT(GCTraceTime tm("MarkFromRootsTask",
-    PrintGCDetails && TraceParallelOldGCTasks, true, NULL));
+    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
   ParCompactionManager* cm =
     ParCompactionManager::gc_thread_compaction_manager(which);
   PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
@@ -153,7 +153,7 @@
   assert(Universe::heap()->is_gc_active(), "called outside gc");
 
   NOT_PRODUCT(GCTraceTime tm("RefProcTask",
-    PrintGCDetails && TraceParallelOldGCTasks, true, NULL));
+    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
   ParCompactionManager* cm =
     ParCompactionManager::gc_thread_compaction_manager(which);
   PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
@@ -209,7 +209,7 @@
   assert(Universe::heap()->is_gc_active(), "called outside gc");
 
   NOT_PRODUCT(GCTraceTime tm("StealMarkingTask",
-    PrintGCDetails && TraceParallelOldGCTasks, true, NULL));
+    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
 
   ParCompactionManager* cm =
     ParCompactionManager::gc_thread_compaction_manager(which);
@@ -242,7 +242,7 @@
   assert(Universe::heap()->is_gc_active(), "called outside gc");
 
   NOT_PRODUCT(GCTraceTime tm("StealRegionCompactionTask",
-    PrintGCDetails && TraceParallelOldGCTasks, true, NULL));
+    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
 
   ParCompactionManager* cm =
     ParCompactionManager::gc_thread_compaction_manager(which);
@@ -309,7 +309,7 @@
 void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) {
 
   NOT_PRODUCT(GCTraceTime tm("UpdateDensePrefixTask",
-    PrintGCDetails && TraceParallelOldGCTasks, true, NULL));
+    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
 
   ParCompactionManager* cm =
     ParCompactionManager::gc_thread_compaction_manager(which);
@@ -324,7 +324,7 @@
   assert(Universe::heap()->is_gc_active(), "called outside gc");
 
   NOT_PRODUCT(GCTraceTime tm("DrainStacksCompactionTask",
-    PrintGCDetails && TraceParallelOldGCTasks, true, NULL));
+    PrintGCDetails && TraceParallelOldGCTasks, true, NULL, PSParallelCompact::gc_tracer()->gc_id()));
 
   ParCompactionManager* cm =
     ParCompactionManager::gc_thread_compaction_manager(which);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -34,6 +34,7 @@
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.pcgc.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "utilities/stack.inline.hpp"
 
 PSOldGen*            ParCompactionManager::_old_gen = NULL;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -170,7 +170,7 @@
 
     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL);
+    GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer->gc_id());
     TraceCollectorStats tcs(counters());
     TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
 
@@ -521,7 +521,7 @@
 
 void PSMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) {
   // Recursively traverse all live objects and mark them
-  GCTraceTime tm("phase 1", PrintGCDetails && Verbose, true, _gc_timer);
+  GCTraceTime tm("phase 1", PrintGCDetails && Verbose, true, _gc_timer, _gc_tracer->gc_id());
   trace(" 1");
 
   ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
@@ -556,7 +556,7 @@
     ref_processor()->setup_policy(clear_all_softrefs);
     const ReferenceProcessorStats& stats =
       ref_processor()->process_discovered_references(
-        is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL, _gc_timer);
+        is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL, _gc_timer, _gc_tracer->gc_id());
     gc_tracer()->report_gc_reference_stats(stats);
   }
 
@@ -582,7 +582,7 @@
 
 
 void PSMarkSweep::mark_sweep_phase2() {
-  GCTraceTime tm("phase 2", PrintGCDetails && Verbose, true, _gc_timer);
+  GCTraceTime tm("phase 2", PrintGCDetails && Verbose, true, _gc_timer, _gc_tracer->gc_id());
   trace("2");
 
   // Now all live objects are marked, compute the new object addresses.
@@ -612,7 +612,7 @@
 
 void PSMarkSweep::mark_sweep_phase3() {
   // Adjust the pointers to reflect the new locations
-  GCTraceTime tm("phase 3", PrintGCDetails && Verbose, true, _gc_timer);
+  GCTraceTime tm("phase 3", PrintGCDetails && Verbose, true, _gc_timer, _gc_tracer->gc_id());
   trace("3");
 
   ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
@@ -655,7 +655,7 @@
 
 void PSMarkSweep::mark_sweep_phase4() {
   EventMark m("4 compact heap");
-  GCTraceTime tm("phase 4", PrintGCDetails && Verbose, true, _gc_timer);
+  GCTraceTime tm("phase 4", PrintGCDetails && Verbose, true, _gc_timer, _gc_tracer->gc_id());
   trace("4");
 
   // All pointers are now adjusted, move objects accordingly
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -51,6 +51,7 @@
 #include "oops/methodData.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.pcgc.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/vmThread.hpp"
@@ -979,7 +980,7 @@
   // at each young gen gc.  Do the update unconditionally (even though a
   // promotion failure does not swap spaces) because an unknown number of minor
   // collections will have swapped the spaces an unknown number of times.
-  GCTraceTime tm("pre compact", print_phases(), true, &_gc_timer);
+  GCTraceTime tm("pre compact", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
   ParallelScavengeHeap* heap = gc_heap();
   _space_info[from_space_id].set_space(heap->young_gen()->from_space());
   _space_info[to_space_id].set_space(heap->young_gen()->to_space());
@@ -1022,7 +1023,7 @@
 
 void PSParallelCompact::post_compact()
 {
-  GCTraceTime tm("post compact", print_phases(), true, &_gc_timer);
+  GCTraceTime tm("post compact", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
   for (unsigned int id = old_space_id; id < last_space_id; ++id) {
     // Clear the marking bitmap, summary data and split info.
@@ -1848,7 +1849,7 @@
 void PSParallelCompact::summary_phase(ParCompactionManager* cm,
                                       bool maximum_compaction)
 {
-  GCTraceTime tm("summary phase", print_phases(), true, &_gc_timer);
+  GCTraceTime tm("summary phase", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
   // trace("2");
 
 #ifdef  ASSERT
@@ -2057,7 +2058,7 @@
 
     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL);
+    GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer.gc_id());
     TraceCollectorStats tcs(counters());
     TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
 
@@ -2359,7 +2360,7 @@
                                       bool maximum_heap_compaction,
                                       ParallelOldTracer *gc_tracer) {
   // Recursively traverse all live objects and mark them
-  GCTraceTime tm("marking phase", print_phases(), true, &_gc_timer);
+  GCTraceTime tm("marking phase", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
   ParallelScavengeHeap* heap = gc_heap();
   uint parallel_gc_threads = heap->gc_task_manager()->workers();
@@ -2374,7 +2375,7 @@
   ClassLoaderDataGraph::clear_claimed_marks();
 
   {
-    GCTraceTime tm_m("par mark", print_phases(), true, &_gc_timer);
+    GCTraceTime tm_m("par mark", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
     ParallelScavengeHeap::ParStrongRootsScope psrs;
 
@@ -2403,24 +2404,24 @@
 
   // Process reference objects found during marking
   {
-    GCTraceTime tm_r("reference processing", print_phases(), true, &_gc_timer);
+    GCTraceTime tm_r("reference processing", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
     ReferenceProcessorStats stats;
     if (ref_processor()->processing_is_mt()) {
       RefProcTaskExecutor task_executor;
       stats = ref_processor()->process_discovered_references(
         is_alive_closure(), &mark_and_push_closure, &follow_stack_closure,
-        &task_executor, &_gc_timer);
+        &task_executor, &_gc_timer, _gc_tracer.gc_id());
     } else {
       stats = ref_processor()->process_discovered_references(
         is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, NULL,
-        &_gc_timer);
+        &_gc_timer, _gc_tracer.gc_id());
     }
 
     gc_tracer->report_gc_reference_stats(stats);
   }
 
-  GCTraceTime tm_c("class unloading", print_phases(), true, &_gc_timer);
+  GCTraceTime tm_c("class unloading", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
   // This is the point where the entire marking should have completed.
   assert(cm->marking_stacks_empty(), "Marking should have completed");
@@ -2459,7 +2460,7 @@
 
 void PSParallelCompact::adjust_roots() {
   // Adjust the pointers to reflect the new locations
-  GCTraceTime tm("adjust roots", print_phases(), true, &_gc_timer);
+  GCTraceTime tm("adjust roots", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
   // Need new claim bits when tracing through and adjusting pointers.
   ClassLoaderDataGraph::clear_claimed_marks();
@@ -2495,7 +2496,7 @@
 void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q,
                                                       uint parallel_gc_threads)
 {
-  GCTraceTime tm("drain task setup", print_phases(), true, &_gc_timer);
+  GCTraceTime tm("drain task setup", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
   // Find the threads that are active
   unsigned int which = 0;
@@ -2569,7 +2570,7 @@
 
 void PSParallelCompact::enqueue_dense_prefix_tasks(GCTaskQueue* q,
                                                     uint parallel_gc_threads) {
-  GCTraceTime tm("dense prefix task setup", print_phases(), true, &_gc_timer);
+  GCTraceTime tm("dense prefix task setup", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
   ParallelCompactData& sd = PSParallelCompact::summary_data();
 
@@ -2651,7 +2652,7 @@
                                      GCTaskQueue* q,
                                      ParallelTaskTerminator* terminator_ptr,
                                      uint parallel_gc_threads) {
-  GCTraceTime tm("steal task setup", print_phases(), true, &_gc_timer);
+  GCTraceTime tm("steal task setup", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
   // Once a thread has drained it's stack, it should try to steal regions from
   // other threads.
@@ -2699,7 +2700,7 @@
 
 void PSParallelCompact::compact() {
   // trace("5");
-  GCTraceTime tm("compaction phase", print_phases(), true, &_gc_timer);
+  GCTraceTime tm("compaction phase", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
   ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
   assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
@@ -2716,7 +2717,7 @@
   enqueue_region_stealing_tasks(q, &terminator, active_gc_threads);
 
   {
-    GCTraceTime tm_pc("par compact", print_phases(), true, &_gc_timer);
+    GCTraceTime tm_pc("par compact", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
 
     gc_task_manager()->execute_and_wait(q);
 
@@ -2730,7 +2731,7 @@
 
   {
     // Update the deferred objects, if any.  Any compaction manager can be used.
-    GCTraceTime tm_du("deferred updates", print_phases(), true, &_gc_timer);
+    GCTraceTime tm_du("deferred updates", print_phases(), true, &_gc_timer, _gc_tracer.gc_id());
     ParCompactionManager* cm = ParCompactionManager::manager_array(0);
     for (unsigned int id = old_space_id; id < last_space_id; ++id) {
       update_deferred_objects(cm, SpaceId(id));
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1004,6 +1004,10 @@
   static bool   _dwl_initialized;
 #endif  // #ifdef ASSERT
 
+
+ public:
+  static ParallelOldTracer* gc_tracer() { return &_gc_tracer; }
+
  private:
 
   static void initialize_space_info();
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -332,7 +332,7 @@
 
     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    GCTraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL);
+    GCTraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer.gc_id());
     TraceCollectorStats tcs(counters());
     TraceMemoryManagerStats tms(false /* not full GC */,gc_cause);
 
@@ -398,7 +398,7 @@
     // We'll use the promotion manager again later.
     PSPromotionManager* promotion_manager = PSPromotionManager::vm_thread_promotion_manager();
     {
-      GCTraceTime tm("Scavenge", false, false, &_gc_timer);
+      GCTraceTime tm("Scavenge", false, false, &_gc_timer, _gc_tracer.gc_id());
       ParallelScavengeHeap::ParStrongRootsScope psrs;
 
       GCTaskQueue* q = GCTaskQueue::create();
@@ -440,7 +440,7 @@
 
     // Process reference objects discovered during scavenge
     {
-      GCTraceTime tm("References", false, false, &_gc_timer);
+      GCTraceTime tm("References", false, false, &_gc_timer, _gc_tracer.gc_id());
 
       reference_processor()->setup_policy(false); // not always_clear
       reference_processor()->set_active_mt_degree(active_workers);
@@ -451,10 +451,10 @@
         PSRefProcTaskExecutor task_executor;
         stats = reference_processor()->process_discovered_references(
           &_is_alive_closure, &keep_alive, &evac_followers, &task_executor,
-          &_gc_timer);
+          &_gc_timer, _gc_tracer.gc_id());
       } else {
         stats = reference_processor()->process_discovered_references(
-          &_is_alive_closure, &keep_alive, &evac_followers, NULL, &_gc_timer);
+          &_is_alive_closure, &keep_alive, &evac_followers, NULL, &_gc_timer, _gc_tracer.gc_id());
       }
 
       _gc_tracer.report_gc_reference_stats(stats);
@@ -469,7 +469,7 @@
     }
 
     {
-      GCTraceTime tm("StringTable", false, false, &_gc_timer);
+      GCTraceTime tm("StringTable", false, false, &_gc_timer, _gc_tracer.gc_id());
       // Unlink any dead interned Strings and process the remaining live ones.
       PSScavengeRootsClosure root_closure(promotion_manager);
       StringTable::unlink_or_oops_do(&_is_alive_closure, &root_closure);
@@ -641,7 +641,7 @@
     NOT_PRODUCT(reference_processor()->verify_no_references_recorded());
 
     {
-      GCTraceTime tm("Prune Scavenge Root Methods", false, false, &_gc_timer);
+      GCTraceTime tm("Prune Scavenge Root Methods", false, false, &_gc_timer, _gc_tracer.gc_id());
 
       CodeCache::prune_scavenge_root_nmethods();
     }
--- a/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "memory/collectorPolicy.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/sharedHeap.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "utilities/copy.hpp"
 
 /* Copyright (c) 1992-2009 Oracle and/or its affiliates, and Stanford University.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcId.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc_implementation/shared/gcId.hpp"
+#include "runtime/safepoint.hpp"
+
+uint GCId::_next_id = 0;
+
+const GCId GCId::create() {
+  return GCId(_next_id++);
+}
+const GCId GCId::peek() {
+  return GCId(_next_id);
+}
+const GCId GCId::undefined() {
+  return GCId(UNDEFINED);
+}
+bool GCId::is_undefined() const {
+  return _id == UNDEFINED;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcId.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCID_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCID_HPP
+
+#include "memory/allocation.hpp"
+
+class GCId VALUE_OBJ_CLASS_SPEC {
+ private:
+  uint _id;
+  GCId(uint id) : _id(id) {}
+  GCId() { } // Unused
+
+  static uint _next_id;
+  static const uint UNDEFINED = (uint)-1;
+
+ public:
+  uint id() const {
+    assert(_id != UNDEFINED, "Using undefined GC ID");
+    return _id;
+  }
+  bool is_undefined() const;
+
+  static const GCId create();
+  static const GCId peek();
+  static const GCId undefined();
+};
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCID_HPP
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "gc_implementation/shared/copyFailedInfo.hpp"
 #include "gc_implementation/shared/gcHeapSummary.hpp"
+#include "gc_implementation/shared/gcId.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"
 #include "gc_implementation/shared/objectCountEventSender.hpp"
@@ -38,19 +39,14 @@
 #include "gc_implementation/g1/evacuationInfo.hpp"
 #endif
 
-#define assert_unset_gc_id() assert(_shared_gc_info.id() == SharedGCInfo::UNSET_GCID, "GC already started?")
-#define assert_set_gc_id() assert(_shared_gc_info.id() != SharedGCInfo::UNSET_GCID, "GC not started?")
-
-static GCId GCTracer_next_gc_id = 0;
-static GCId create_new_gc_id() {
-  return GCTracer_next_gc_id++;
-}
+#define assert_unset_gc_id() assert(_shared_gc_info.gc_id().is_undefined(), "GC already started?")
+#define assert_set_gc_id() assert(!_shared_gc_info.gc_id().is_undefined(), "GC not started?")
 
 void GCTracer::report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp) {
   assert_unset_gc_id();
 
-  GCId gc_id = create_new_gc_id();
-  _shared_gc_info.set_id(gc_id);
+  GCId gc_id = GCId::create();
+  _shared_gc_info.set_gc_id(gc_id);
   _shared_gc_info.set_cause(cause);
   _shared_gc_info.set_start_timestamp(timestamp);
 }
@@ -62,7 +58,7 @@
 }
 
 bool GCTracer::has_reported_gc_start() const {
-  return _shared_gc_info.id() != SharedGCInfo::UNSET_GCID;
+  return !_shared_gc_info.gc_id().is_undefined();
 }
 
 void GCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
@@ -81,7 +77,7 @@
 
   report_gc_end_impl(timestamp, time_partitions);
 
-  _shared_gc_info.set_id(SharedGCInfo::UNSET_GCID);
+  _shared_gc_info.set_gc_id(GCId::undefined());
 }
 
 void GCTracer::report_gc_reference_stats(const ReferenceProcessorStats& rps) const {
@@ -132,7 +128,7 @@
     if (!cit.allocation_failed()) {
       HeapInspection hi(false, false, false, NULL);
       hi.populate_table(&cit, is_alive_cl);
-      ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), Ticks::now());
+      ObjectCountEventSenderClosure event_sender(_shared_gc_info.gc_id(), cit.size_of_instances_in_words(), Ticks::now());
       cit.iterate(&event_sender);
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -27,6 +27,7 @@
 
 #include "gc_interface/gcCause.hpp"
 #include "gc_interface/gcName.hpp"
+#include "gc_implementation/shared/gcId.hpp"
 #include "gc_implementation/shared/gcWhen.hpp"
 #include "gc_implementation/shared/copyFailedInfo.hpp"
 #include "memory/allocation.hpp"
@@ -38,7 +39,6 @@
 #include "utilities/macros.hpp"
 #include "utilities/ticks.hpp"
 
-typedef uint GCId;
 
 class EvacuationInfo;
 class GCHeapSummary;
@@ -50,11 +50,8 @@
 class BoolObjectClosure;
 
 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
- public:
-  static const GCId UNSET_GCID = (GCId)-1;
-
  private:
-  GCId _id;
+  GCId _gc_id;
   GCName _name;
   GCCause::Cause _cause;
   Ticks     _start_timestamp;
@@ -64,7 +61,7 @@
 
  public:
   SharedGCInfo(GCName name) :
-    _id(UNSET_GCID),
+    _gc_id(GCId::undefined()),
     _name(name),
     _cause(GCCause::_last_gc_cause),
     _start_timestamp(),
@@ -73,8 +70,8 @@
     _longest_pause() {
   }
 
-  void set_id(GCId id) { _id = id; }
-  GCId id() const { return _id; }
+  void set_gc_id(GCId gc_id) { _gc_id = gc_id; }
+  const GCId& gc_id() const { return _gc_id; }
 
   void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }
   const Ticks start_timestamp() const { return _start_timestamp; }
@@ -131,10 +128,11 @@
   void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
   void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
   bool has_reported_gc_start() const;
+  const GCId& gc_id() { return _shared_gc_info.gc_id(); }
 
  protected:
   GCTracer(GCName name) : _shared_gc_info(name) {}
-  virtual void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
+  void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
   virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
 
  private:
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -43,7 +43,7 @@
 void GCTracer::send_garbage_collection_event() const {
   EventGCGarbageCollection event(UNTIMED);
   if (event.should_commit()) {
-    event.set_gcId(_shared_gc_info.id());
+    event.set_gcId(_shared_gc_info.gc_id().id());
     event.set_name(_shared_gc_info.name());
     event.set_cause((u2) _shared_gc_info.cause());
     event.set_sumOfPauses(_shared_gc_info.sum_of_pauses());
@@ -57,7 +57,7 @@
 void GCTracer::send_reference_stats_event(ReferenceType type, size_t count) const {
   EventGCReferenceStatistics e;
   if (e.should_commit()) {
-      e.set_gcId(_shared_gc_info.id());
+      e.set_gcId(_shared_gc_info.gc_id().id());
       e.set_type((u1)type);
       e.set_count(count);
       e.commit();
@@ -68,7 +68,7 @@
                                                       const MetaspaceChunkFreeListSummary& summary) const {
   EventMetaspaceChunkFreeListSummary e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.set_when(when);
     e.set_metadataType(mdtype);
 
@@ -91,7 +91,7 @@
 void ParallelOldTracer::send_parallel_old_event() const {
   EventGCParallelOld e(UNTIMED);
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
     e.set_starttime(_shared_gc_info.start_timestamp());
     e.set_endtime(_shared_gc_info.end_timestamp());
@@ -102,7 +102,7 @@
 void YoungGCTracer::send_young_gc_event() const {
   EventGCYoungGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.set_tenuringThreshold(_tenuring_threshold);
     e.set_starttime(_shared_gc_info.start_timestamp());
     e.set_endtime(_shared_gc_info.end_timestamp());
@@ -113,7 +113,7 @@
 void OldGCTracer::send_old_gc_event() const {
   EventGCOldGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.set_starttime(_shared_gc_info.start_timestamp());
     e.set_endtime(_shared_gc_info.end_timestamp());
     e.commit();
@@ -132,7 +132,7 @@
 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
   EventPromotionFailed e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.set_data(to_trace_struct(pf_info));
     e.set_thread(pf_info.thread()->thread_id());
     e.commit();
@@ -143,7 +143,7 @@
 void OldGCTracer::send_concurrent_mode_failure_event() {
   EventConcurrentModeFailure e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.commit();
   }
 }
@@ -152,7 +152,7 @@
 void G1NewTracer::send_g1_young_gc_event() {
   EventGCG1GarbageCollection e(UNTIMED);
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.set_type(_g1_young_gc_info.type());
     e.set_starttime(_shared_gc_info.start_timestamp());
     e.set_endtime(_shared_gc_info.end_timestamp());
@@ -163,7 +163,7 @@
 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
   EventEvacuationInfo e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.set_cSetRegions(info->collectionset_regions());
     e.set_cSetUsedBefore(info->collectionset_used_before());
     e.set_cSetUsedAfter(info->collectionset_used_after());
@@ -179,7 +179,7 @@
 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const {
   EventEvacuationFailed e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.set_data(to_trace_struct(ef_info));
     e.commit();
   }
@@ -206,17 +206,17 @@
 }
 
 class GCHeapSummaryEventSender : public GCHeapSummaryVisitor {
-  GCId _id;
+  GCId _gc_id;
   GCWhen::Type _when;
  public:
-  GCHeapSummaryEventSender(GCId id, GCWhen::Type when) : _id(id), _when(when) {}
+  GCHeapSummaryEventSender(GCId gc_id, GCWhen::Type when) : _gc_id(gc_id), _when(when) {}
 
   void visit(const GCHeapSummary* heap_summary) const {
     const VirtualSpaceSummary& heap_space = heap_summary->heap();
 
     EventGCHeapSummary e;
     if (e.should_commit()) {
-      e.set_gcId(_id);
+      e.set_gcId(_gc_id.id());
       e.set_when((u1)_when);
       e.set_heapSpace(to_trace_struct(heap_space));
       e.set_heapUsed(heap_summary->used());
@@ -236,7 +236,7 @@
 
     EventPSHeapSummary e;
     if (e.should_commit()) {
-      e.set_gcId(_id);
+      e.set_gcId(_gc_id.id());
       e.set_when((u1)_when);
 
       e.set_oldSpace(to_trace_struct(ps_heap_summary->old()));
@@ -251,7 +251,7 @@
 };
 
 void GCTracer::send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const {
-  GCHeapSummaryEventSender visitor(_shared_gc_info.id(), when);
+  GCHeapSummaryEventSender visitor(_shared_gc_info.gc_id(), when);
   heap_summary.accept(&visitor);
 }
 
@@ -268,7 +268,7 @@
 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const {
   EventMetaspaceSummary e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.id());
+    e.set_gcId(_shared_gc_info.gc_id().id());
     e.set_when((u1) when);
     e.set_gcThreshold(meta_space_summary.capacity_until_GC());
     e.set_metaspace(to_trace_struct(meta_space_summary.meta_space()));
@@ -287,7 +287,7 @@
   void send_phase(PausePhase* pause) {
     T event(UNTIMED);
     if (event.should_commit()) {
-      event.set_gcId(_gc_id);
+      event.set_gcId(_gc_id.id());
       event.set_name(pause->name());
       event.set_starttime(pause->start());
       event.set_endtime(pause->end());
@@ -311,7 +311,7 @@
 };
 
 void GCTracer::send_phase_events(TimePartitions* time_partitions) const {
-  PhaseSender phase_reporter(_shared_gc_info.id());
+  PhaseSender phase_reporter(_shared_gc_info.gc_id());
 
   TimePartitionPhasesIterator iter(time_partitions);
   while (iter.has_next()) {
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
+#include "gc_implementation/shared/gcTrace.hpp"
 #include "gc_implementation/shared/gcTraceTime.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/os.hpp"
@@ -34,7 +35,7 @@
 #include "utilities/ticks.inline.hpp"
 
 
-GCTraceTime::GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* timer) :
+GCTraceTime::GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* timer, GCId gc_id) :
     _title(title), _doit(doit), _print_cr(print_cr), _timer(timer), _start_counter() {
   if (_doit || _timer != NULL) {
     _start_counter.stamp();
@@ -52,6 +53,9 @@
       gclog_or_tty->stamp();
       gclog_or_tty->print(": ");
     }
+    if (PrintGCID) {
+      gclog_or_tty->print("#%u: ", gc_id.id());
+    }
     gclog_or_tty->print("[%s", title);
     gclog_or_tty->flush();
   }
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACETIME_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACETIME_HPP
 
+#include "gc_implementation/shared/gcTrace.hpp"
 #include "prims/jni_md.h"
 #include "utilities/ticks.hpp"
 
@@ -38,7 +39,7 @@
   Ticks _start_counter;
 
  public:
-  GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* timer);
+  GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* timer, GCId gc_id);
   ~GCTraceTime();
 };
 
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "gc_implementation/shared/spaceDecorator.hpp"
 #include "memory/sharedHeap.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/shared/mutableSpace.hpp"
--- a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
 
 
 #include "precompiled.hpp"
+#include "gc_implementation/shared/gcId.hpp"
 #include "gc_implementation/shared/objectCountEventSender.hpp"
 #include "memory/heapInspection.hpp"
 #include "trace/tracing.hpp"
@@ -38,7 +39,7 @@
          "Only call this method if the event is enabled");
 
   EventObjectCountAfterGC event(UNTIMED);
-  event.set_gcId(gc_id);
+  event.set_gcId(gc_id.id());
   event.set_class(entry->klass());
   event.set_count(entry->count());
   event.set_totalSize(entry->words() * BytesPerWord);
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -558,13 +558,13 @@
 
 void CollectedHeap::pre_full_gc_dump(GCTimer* timer) {
   if (HeapDumpBeforeFullGC) {
-    GCTraceTime tt("Heap Dump (before full gc): ", PrintGCDetails, false, timer);
+    GCTraceTime tt("Heap Dump (before full gc): ", PrintGCDetails, false, timer, GCId::create());
     // We are doing a "major" collection and a heap dump before
     // major collection has been requested.
     HeapDumper::dump_heap();
   }
   if (PrintClassHistogramBeforeFullGC) {
-    GCTraceTime tt("Class Histogram (before full gc): ", PrintGCDetails, true, timer);
+    GCTraceTime tt("Class Histogram (before full gc): ", PrintGCDetails, true, timer, GCId::create());
     VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */);
     inspector.doit();
   }
@@ -572,11 +572,11 @@
 
 void CollectedHeap::post_full_gc_dump(GCTimer* timer) {
   if (HeapDumpAfterFullGC) {
-    GCTraceTime tt("Heap Dump (after full gc): ", PrintGCDetails, false, timer);
+    GCTraceTime tt("Heap Dump (after full gc): ", PrintGCDetails, false, timer, GCId::create());
     HeapDumper::dump_heap();
   }
   if (PrintClassHistogramAfterFullGC) {
-    GCTraceTime tt("Class Histogram (after full gc): ", PrintGCDetails, true, timer);
+    GCTraceTime tt("Class Histogram (after full gc): ", PrintGCDetails, true, timer, GCId::create());
     VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */);
     inspector.doit();
   }
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -37,6 +37,7 @@
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
@@ -2782,11 +2783,11 @@
       if (TraceExceptions) {
         ttyLocker ttyl;
         ResourceMark rm;
-        tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), (void*)except_oop());
+        tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), p2i(except_oop()));
         tty->print_cr(" thrown in interpreter method <%s>", METHOD->print_value_string());
         tty->print_cr(" at bci %d, continuing at %d for thread " INTPTR_FORMAT,
-                      istate->bcp() - (intptr_t)METHOD->code_base(),
-                      continuation_bci, THREAD);
+                      (int)(istate->bcp() - METHOD->code_base()),
+                      (int)continuation_bci, p2i(THREAD));
       }
       // for AbortVMOnException flag
       NOT_PRODUCT(Exceptions::debug_check_abort(except_oop));
@@ -2798,11 +2799,11 @@
     if (TraceExceptions) {
       ttyLocker ttyl;
       ResourceMark rm;
-      tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), (void*)except_oop());
+      tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", except_oop->print_value_string(), p2i(except_oop()));
       tty->print_cr(" thrown in interpreter method <%s>", METHOD->print_value_string());
       tty->print_cr(" at bci %d, unwinding for thread " INTPTR_FORMAT,
-                    istate->bcp() - (intptr_t)METHOD->code_base(),
-                    THREAD);
+                    (int)(istate->bcp() - METHOD->code_base()),
+                    p2i(THREAD));
     }
     // for AbortVMOnException flag
     NOT_PRODUCT(Exceptions::debug_check_abort(except_oop));
@@ -3401,7 +3402,7 @@
   tty->print_cr("osr._osr_buf: " INTPTR_FORMAT, (uintptr_t) this->_result._osr._osr_buf);
   tty->print_cr("osr._osr_entry: " INTPTR_FORMAT, (uintptr_t) this->_result._osr._osr_entry);
   tty->print_cr("prev_link: " INTPTR_FORMAT, (uintptr_t) this->_prev_link);
-  tty->print_cr("native_mirror: " INTPTR_FORMAT, (void*) this->_oop_temp);
+  tty->print_cr("native_mirror: " INTPTR_FORMAT, (uintptr_t) this->_oop_temp);
   tty->print_cr("stack_base: " INTPTR_FORMAT, (uintptr_t) this->_stack_base);
   tty->print_cr("stack_limit: " INTPTR_FORMAT, (uintptr_t) this->_stack_limit);
   tty->print_cr("monitor_base: " INTPTR_FORMAT, (uintptr_t) this->_monitor_base);
--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreterProfiling.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012, 2013 SAP AG. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,11 +86,11 @@
                   " \t-> " PTR_FORMAT "(%d)",                                  \
                 (int) THREAD->osthread()->thread_id(),                         \
                 BCI(),                                                         \
-                MDX(),                                                         \
+                p2i(MDX()),                                                    \
                 (MDX() == NULL                                                 \
                  ? 0                                                           \
                  : istate->method()->method_data()->dp_to_di((address)MDX())), \
-                mdx,                                                           \
+                p2i(mdx),                                                      \
                 istate->method()->method_data()->dp_to_di((address)mdx)        \
                 );                                                             \
   };                                                                           \
@@ -107,7 +107,7 @@
     MethodData *md = istate->method()->method_data();                          \
     tty->cr();                                                                 \
     tty->print("method data at mdx " PTR_FORMAT "(0) for",                     \
-               md->data_layout_at(md->bci_to_di(0)));                          \
+               p2i(md->data_layout_at(md->bci_to_di(0))));                     \
     istate->method()->print_short_name(tty);                                   \
     tty->cr();                                                                 \
     if (md != NULL) {                                                          \
@@ -115,7 +115,7 @@
       address mdx = (address) MDX();                                           \
       if (mdx != NULL) {                                                       \
         tty->print_cr("current mdx " PTR_FORMAT "(%d)",                        \
-                      mdx,                                                     \
+                      p2i(mdx),                                                \
                       istate->method()->method_data()->dp_to_di(mdx));         \
       }                                                                        \
     } else {                                                                   \
--- a/hotspot/src/share/vm/interpreter/bytecodes.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecodes.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -541,9 +541,6 @@
 
   def(_shouldnotreachhere  , "_shouldnotreachhere" , "b"    , NULL    , T_VOID   ,  0, false);
 
-  // platform specific JVM bytecodes
-  pd_initialize();
-
   // compare can_trap information for each bytecode with the
   // can_trap information for the corresponding base bytecode
   // (if a rewritten bytecode can trap, so must the base bytecode)
--- a/hotspot/src/share/vm/interpreter/bytecodes.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -287,23 +287,6 @@
 
     _shouldnotreachhere,      // For debugging
 
-    // Platform specific JVM bytecodes
-#ifdef TARGET_ARCH_x86
-# include "bytecodes_x86.hpp"
-#endif
-#ifdef TARGET_ARCH_sparc
-# include "bytecodes_sparc.hpp"
-#endif
-#ifdef TARGET_ARCH_zero
-# include "bytecodes_zero.hpp"
-#endif
-#ifdef TARGET_ARCH_arm
-# include "bytecodes_arm.hpp"
-#endif
-#ifdef TARGET_ARCH_ppc
-# include "bytecodes_ppc.hpp"
-#endif
-
 
     number_of_codes
   };
@@ -348,8 +331,6 @@
 
   static void        def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap);
   static void        def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap, Code java_code);
-  static void        pd_initialize();              // platform specific initialization
-  static Code        pd_base_code_for(Code code);  // platform specific base_code_for implementation
 
   // Verify that bcp points into method
 #ifdef ASSERT
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -42,6 +42,7 @@
 #include "oops/symbol.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/nativeLookup.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/deoptimization.hpp"
--- a/hotspot/src/share/vm/memory/allocation.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -29,7 +29,7 @@
 #include "memory/metaspaceShared.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/task.hpp"
 #include "runtime/threadCritical.hpp"
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -29,6 +29,7 @@
 #include "memory/generation.hpp"
 #include "memory/space.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/java.hpp"
 #include "runtime/os.hpp"
 #include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -41,6 +41,7 @@
 #include "memory/space.inline.hpp"
 #include "oops/instanceRefKlass.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/java.hpp"
 #include "runtime/prefetch.inline.hpp"
 #include "runtime/thread.inline.hpp"
@@ -585,7 +586,7 @@
 
   init_assuming_no_promotion_failure();
 
-  GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL);
+  GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, gc_tracer.gc_id());
   // Capture heap used before collection (for printing).
   size_t gch_prev_used = gch->used();
 
@@ -641,7 +642,7 @@
   rp->setup_policy(clear_all_soft_refs);
   const ReferenceProcessorStats& stats =
   rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers,
-                                    NULL, _gc_timer);
+                                    NULL, _gc_timer, gc_tracer.gc_id());
   gc_tracer.report_gc_reference_stats(stats);
 
   if (!_promotion_failed) {
--- a/hotspot/src/share/vm/memory/gcLocker.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/gcLocker.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #include "memory/gcLocker.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/sharedHeap.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
 volatile jint GC_locker::_jni_lock_count = 0;
@@ -59,6 +60,17 @@
     assert(_jni_lock_count == count, "must be equal");
   }
 }
+
+// In debug mode track the locking state at all times
+void GC_locker::increment_debug_jni_lock_count() {
+  assert(_debug_jni_lock_count >= 0, "bad value");
+  Atomic::inc(&_debug_jni_lock_count);
+}
+
+void GC_locker::decrement_debug_jni_lock_count() {
+  assert(_debug_jni_lock_count > 0, "bad value");
+  Atomic::dec(&_debug_jni_lock_count);
+}
 #endif
 
 bool GC_locker::check_active_before_gc() {
--- a/hotspot/src/share/vm/memory/gcLocker.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/gcLocker.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -94,18 +94,8 @@
   }
 
   // In debug mode track the locking state at all times
-  static void increment_debug_jni_lock_count() {
-#ifdef ASSERT
-    assert(_debug_jni_lock_count >= 0, "bad value");
-    Atomic::inc(&_debug_jni_lock_count);
-#endif
-  }
-  static void decrement_debug_jni_lock_count() {
-#ifdef ASSERT
-    assert(_debug_jni_lock_count > 0, "bad value");
-    Atomic::dec(&_debug_jni_lock_count);
-#endif
-  }
+  static void increment_debug_jni_lock_count() NOT_DEBUG_RETURN;
+  static void decrement_debug_jni_lock_count() NOT_DEBUG_RETURN;
 
   // Set the current lock count
   static void set_jni_lock_count(int count) {
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "classfile/vmSymbols.hpp"
 #include "code/icBuffer.hpp"
 #include "gc_implementation/shared/collectorCounters.hpp"
+#include "gc_implementation/shared/gcTrace.hpp"
 #include "gc_implementation/shared/gcTraceTime.hpp"
 #include "gc_implementation/shared/vmGCOperations.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
@@ -384,7 +385,9 @@
     const char* gc_cause_prefix = complete ? "Full GC" : "GC";
     gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    GCTraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, NULL);
+    // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
+    // so we can assume here that the next GC id is what we want.
+    GCTraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, NULL, GCId::peek());
 
     gc_prologue(complete);
     increment_total_collections(complete);
@@ -417,7 +420,9 @@
         }
         // Timer for individual generations. Last argument is false: no CR
         // FIXME: We should try to start the timing earlier to cover more of the GC pause
-        GCTraceTime t1(_gens[i]->short_name(), PrintGCDetails, false, NULL);
+        // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
+        // so we can assume here that the next GC id is what we want.
+        GCTraceTime t1(_gens[i]->short_name(), PrintGCDetails, false, NULL, GCId::peek());
         TraceCollectorStats tcs(_gens[i]->counters());
         TraceMemoryManagerStats tmms(_gens[i]->kind(),gc_cause());
 
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -69,7 +69,7 @@
   _ref_processor = rp;
   rp->setup_policy(clear_all_softrefs);
 
-  GCTraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL);
+  GCTraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL, _gc_tracer->gc_id());
 
   gch->trace_heap_before_gc(_gc_tracer);
 
@@ -193,7 +193,7 @@
 void GenMarkSweep::mark_sweep_phase1(int level,
                                   bool clear_all_softrefs) {
   // Recursively traverse all live objects and mark them
-  GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer);
+  GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
   trace(" 1");
 
   GenCollectedHeap* gch = GenCollectedHeap::heap();
@@ -220,7 +220,7 @@
     ref_processor()->setup_policy(clear_all_softrefs);
     const ReferenceProcessorStats& stats =
       ref_processor()->process_discovered_references(
-        &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer);
+        &is_alive, &keep_alive, &follow_stack_closure, NULL, _gc_timer, _gc_tracer->gc_id());
     gc_tracer()->report_gc_reference_stats(stats);
   }
 
@@ -262,7 +262,7 @@
 
   GenCollectedHeap* gch = GenCollectedHeap::heap();
 
-  GCTraceTime tm("phase 2", PrintGC && Verbose, true, _gc_timer);
+  GCTraceTime tm("phase 2", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
   trace("2");
 
   gch->prepare_for_compaction();
@@ -279,7 +279,7 @@
   GenCollectedHeap* gch = GenCollectedHeap::heap();
 
   // Adjust the pointers to reflect the new locations
-  GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer);
+  GCTraceTime tm("phase 3", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
   trace("3");
 
   // Need new claim bits for the pointer adjustment tracing.
@@ -327,7 +327,7 @@
   // to use a higher index (saved from phase2) when verifying perm_gen.
   GenCollectedHeap* gch = GenCollectedHeap::heap();
 
-  GCTraceTime tm("phase 4", PrintGC && Verbose, true, _gc_timer);
+  GCTraceTime tm("phase 4", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
   trace("4");
 
   GenCompactClosure blk;
--- a/hotspot/src/share/vm/memory/iterator.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/iterator.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -27,6 +27,7 @@
 #include "oops/oop.inline.hpp"
 
 void KlassToOopClosure::do_klass(Klass* k) {
+  assert(_oop_closure != NULL, "Not initialized?");
   k->oops_do(_oop_closure);
 }
 
--- a/hotspot/src/share/vm/memory/iterator.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/iterator.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -115,9 +115,19 @@
 };
 
 class KlassToOopClosure : public KlassClosure {
+  friend class MetadataAwareOopClosure;
+  friend class MetadataAwareOopsInGenClosure;
+
   OopClosure* _oop_closure;
- public:
-  KlassToOopClosure(OopClosure* oop_closure) : _oop_closure(oop_closure) {}
+
+  // Used when _oop_closure couldn't be set in an initialization list.
+  void initialize(OopClosure* oop_closure) {
+    assert(_oop_closure == NULL, "Should only be called once");
+    _oop_closure = oop_closure;
+  }
+
+public:
+  KlassToOopClosure(OopClosure* oop_closure = NULL) : _oop_closure(oop_closure) {}
   virtual void do_klass(Klass* k);
 };
 
@@ -135,6 +145,29 @@
   void do_cld(ClassLoaderData* cld);
 };
 
+// The base class for all concurrent marking closures,
+// that participates in class unloading.
+// It's used to proxy through the metadata to the oops defined in them.
+class MetadataAwareOopClosure: public ExtendedOopClosure {
+  KlassToOopClosure _klass_closure;
+
+ public:
+  MetadataAwareOopClosure() : ExtendedOopClosure() {
+    _klass_closure.initialize(this);
+  }
+  MetadataAwareOopClosure(ReferenceProcessor* rp) : ExtendedOopClosure(rp) {
+    _klass_closure.initialize(this);
+  }
+
+  virtual bool do_metadata()    { return do_metadata_nv(); }
+  inline  bool do_metadata_nv() { return true; }
+
+  virtual void do_klass(Klass* k);
+  void do_klass_nv(Klass* k);
+
+  virtual void do_class_loader_data(ClassLoaderData* cld);
+};
+
 // ObjectClosure is used for iterating through an object space
 
 class ObjectClosure : public Closure {
@@ -318,4 +351,16 @@
   }
 };
 
+
+// Helper defines for ExtendOopClosure
+
+#define if_do_metadata_checked(closure, nv_suffix)       \
+  /* Make sure the non-virtual and the virtual versions match. */     \
+  assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
+      "Inconsistency in do_metadata");                                \
+  if (closure->do_metadata##nv_suffix())
+
+#define assert_should_ignore_metadata(closure, nv_suffix)                                  \
+  assert(!closure->do_metadata##nv_suffix(), "Code to handle metadata is not implemented")
+
 #endif // SHARE_VM_MEMORY_ITERATOR_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/memory/iterator.inline.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_MEMORY_ITERATOR_INLINE_HPP
+#define SHARE_VM_MEMORY_ITERATOR_INLINE_HPP
+
+#include "classfile/classLoaderData.hpp"
+#include "memory/iterator.hpp"
+#include "oops/klass.hpp"
+#include "utilities/debug.hpp"
+
+inline void MetadataAwareOopClosure::do_class_loader_data(ClassLoaderData* cld) {
+  assert(_klass_closure._oop_closure == this, "Must be");
+
+  bool claim = true;  // Must claim the class loader data before processing.
+  cld->oops_do(_klass_closure._oop_closure, &_klass_closure, claim);
+}
+
+inline void MetadataAwareOopClosure::do_klass_nv(Klass* k) {
+  ClassLoaderData* cld = k->class_loader_data();
+  do_class_loader_data(cld);
+}
+
+inline void MetadataAwareOopClosure::do_klass(Klass* k)       { do_klass_nv(k); }
+
+#endif // SHARE_VM_MEMORY_ITERATOR_INLINE_HPP
--- a/hotspot/src/share/vm/memory/referenceProcessor.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -190,7 +190,8 @@
   OopClosure*                  keep_alive,
   VoidClosure*                 complete_gc,
   AbstractRefProcTaskExecutor* task_executor,
-  GCTimer*                     gc_timer) {
+  GCTimer*                     gc_timer,
+  GCId                         gc_id) {
   NOT_PRODUCT(verify_ok_to_handle_reflists());
 
   assert(!enqueuing_is_done(), "If here enqueuing should not be complete");
@@ -212,7 +213,7 @@
   // Soft references
   size_t soft_count = 0;
   {
-    GCTraceTime tt("SoftReference", trace_time, false, gc_timer);
+    GCTraceTime tt("SoftReference", trace_time, false, gc_timer, gc_id);
     soft_count =
       process_discovered_reflist(_discoveredSoftRefs, _current_soft_ref_policy, true,
                                  is_alive, keep_alive, complete_gc, task_executor);
@@ -223,7 +224,7 @@
   // Weak references
   size_t weak_count = 0;
   {
-    GCTraceTime tt("WeakReference", trace_time, false, gc_timer);
+    GCTraceTime tt("WeakReference", trace_time, false, gc_timer, gc_id);
     weak_count =
       process_discovered_reflist(_discoveredWeakRefs, NULL, true,
                                  is_alive, keep_alive, complete_gc, task_executor);
@@ -232,7 +233,7 @@
   // Final references
   size_t final_count = 0;
   {
-    GCTraceTime tt("FinalReference", trace_time, false, gc_timer);
+    GCTraceTime tt("FinalReference", trace_time, false, gc_timer, gc_id);
     final_count =
       process_discovered_reflist(_discoveredFinalRefs, NULL, false,
                                  is_alive, keep_alive, complete_gc, task_executor);
@@ -241,7 +242,7 @@
   // Phantom references
   size_t phantom_count = 0;
   {
-    GCTraceTime tt("PhantomReference", trace_time, false, gc_timer);
+    GCTraceTime tt("PhantomReference", trace_time, false, gc_timer, gc_id);
     phantom_count =
       process_discovered_reflist(_discoveredPhantomRefs, NULL, false,
                                  is_alive, keep_alive, complete_gc, task_executor);
@@ -253,7 +254,7 @@
   // thus use JNI weak references to circumvent the phantom references and
   // resurrect a "post-mortem" object.
   {
-    GCTraceTime tt("JNI Weak Reference", trace_time, false, gc_timer);
+    GCTraceTime tt("JNI Weak Reference", trace_time, false, gc_timer, gc_id);
     if (task_executor != NULL) {
       task_executor->set_single_threaded_mode();
     }
@@ -1251,14 +1252,15 @@
   OopClosure* keep_alive,
   VoidClosure* complete_gc,
   YieldClosure* yield,
-  GCTimer* gc_timer) {
+  GCTimer* gc_timer,
+  GCId     gc_id) {
 
   NOT_PRODUCT(verify_ok_to_handle_reflists());
 
   // Soft references
   {
     GCTraceTime tt("Preclean SoftReferences", PrintGCDetails && PrintReferenceGC,
-              false, gc_timer);
+              false, gc_timer, gc_id);
     for (uint i = 0; i < _max_num_q; i++) {
       if (yield->should_return()) {
         return;
@@ -1271,7 +1273,7 @@
   // Weak references
   {
     GCTraceTime tt("Preclean WeakReferences", PrintGCDetails && PrintReferenceGC,
-              false, gc_timer);
+              false, gc_timer, gc_id);
     for (uint i = 0; i < _max_num_q; i++) {
       if (yield->should_return()) {
         return;
@@ -1284,7 +1286,7 @@
   // Final references
   {
     GCTraceTime tt("Preclean FinalReferences", PrintGCDetails && PrintReferenceGC,
-              false, gc_timer);
+              false, gc_timer, gc_id);
     for (uint i = 0; i < _max_num_q; i++) {
       if (yield->should_return()) {
         return;
@@ -1297,7 +1299,7 @@
   // Phantom references
   {
     GCTraceTime tt("Preclean PhantomReferences", PrintGCDetails && PrintReferenceGC,
-              false, gc_timer);
+              false, gc_timer, gc_id);
     for (uint i = 0; i < _max_num_q; i++) {
       if (yield->should_return()) {
         return;
--- a/hotspot/src/share/vm/memory/referenceProcessor.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/referenceProcessor.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP
 #define SHARE_VM_MEMORY_REFERENCEPROCESSOR_HPP
 
+#include "gc_implementation/shared/gcTrace.hpp"
 #include "memory/referencePolicy.hpp"
 #include "memory/referenceProcessorStats.hpp"
 #include "memory/referenceType.hpp"
@@ -349,7 +350,8 @@
                                       OopClosure*        keep_alive,
                                       VoidClosure*       complete_gc,
                                       YieldClosure*      yield,
-                                      GCTimer*           gc_timer);
+                                      GCTimer*           gc_timer,
+                                      GCId               gc_id);
 
   // Delete entries in the discovered lists that have
   // either a null referent or are not active. Such
@@ -480,7 +482,8 @@
                                 OopClosure*                  keep_alive,
                                 VoidClosure*                 complete_gc,
                                 AbstractRefProcTaskExecutor* task_executor,
-                                GCTimer *gc_timer);
+                                GCTimer *gc_timer,
+                                GCId    gc_id);
 
   // Enqueue references at end of GC (called by the garbage collector)
   bool enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor = NULL);
--- a/hotspot/src/share/vm/memory/space.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/space.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -37,6 +37,7 @@
 #include "oops/oop.inline.hpp"
 #include "oops/oop.inline2.hpp"
 #include "runtime/java.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/prefetch.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/safepoint.hpp"
--- a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_MEMORY_SPECIALIZED_OOP_CLOSURES_HPP
 #define SHARE_VM_MEMORY_SPECIALIZED_OOP_CLOSURES_HPP
 
-#include "runtime/atomic.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/g1_specialized_oop_closures.hpp"
--- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -27,7 +27,6 @@
 
 #include "gc_interface/collectedHeap.hpp"
 #include "memory/threadLocalAllocBuffer.hpp"
-#include "runtime/atomic.hpp"
 #include "runtime/thread.hpp"
 #include "utilities/copy.hpp"
 
--- a/hotspot/src/share/vm/memory/universe.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/memory/universe.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -53,6 +53,7 @@
 #include "oops/typeArrayKlass.hpp"
 #include "prims/jvmtiRedefineClassesTrace.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
--- a/hotspot/src/share/vm/oops/arrayKlass.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/arrayKlass.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -93,7 +93,7 @@
   ResourceMark rm(THREAD);
   k->initialize_supers(super_klass(), CHECK);
   k->vtable()->initialize_vtable(false, CHECK);
-  java_lang_Class::create_mirror(k, Handle(NULL), CHECK);
+  java_lang_Class::create_mirror(k, Handle(NULL), Handle(NULL), CHECK);
 }
 
 GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots) {
--- a/hotspot/src/share/vm/oops/compiledICHolder.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/compiledICHolder.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -27,11 +27,27 @@
 #include "oops/klass.hpp"
 #include "oops/method.hpp"
 #include "oops/oop.inline2.hpp"
+#include "runtime/atomic.inline.hpp"
 
 volatile int CompiledICHolder::_live_count;
 volatile int CompiledICHolder::_live_not_claimed_count;
 
 
+CompiledICHolder::CompiledICHolder(Method* method, Klass* klass)
+  : _holder_method(method), _holder_klass(klass) {
+#ifdef ASSERT
+  Atomic::inc(&_live_count);
+  Atomic::inc(&_live_not_claimed_count);
+#endif // ASSERT
+}
+
+#ifdef ASSERT
+CompiledICHolder::~CompiledICHolder() {
+  assert(_live_count > 0, "underflow");
+  Atomic::dec(&_live_count);
+}
+#endif // ASSERT
+
 // Printing
 
 void CompiledICHolder::print_on(outputStream* st) const {
@@ -51,3 +67,11 @@
   guarantee(holder_method()->is_method(), "should be method");
   guarantee(holder_klass()->is_klass(),   "should be klass");
 }
+
+#ifdef ASSERT
+
+void CompiledICHolder::claim() {
+  Atomic::dec(&_live_not_claimed_count);
+}
+
+#endif // ASSERT
--- a/hotspot/src/share/vm/oops/compiledICHolder.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/compiledICHolder.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
 
 #include "oops/oop.hpp"
+#include "utilities/macros.hpp"
 
 // A CompiledICHolder* is a helper object for the inline cache implementation.
 // It holds an intermediate value (method+klass pair) used when converting from
@@ -50,20 +51,8 @@
 
  public:
   // Constructor
-  CompiledICHolder(Method* method, Klass* klass)
-      : _holder_method(method), _holder_klass(klass) {
-#ifdef ASSERT
-    Atomic::inc(&_live_count);
-    Atomic::inc(&_live_not_claimed_count);
-#endif
-  }
-
-  ~CompiledICHolder() {
-#ifdef ASSERT
-    assert(_live_count > 0, "underflow");
-    Atomic::dec(&_live_count);
-#endif
-  }
+  CompiledICHolder(Method* method, Klass* klass);
+  ~CompiledICHolder() NOT_DEBUG_RETURN;
 
   static int live_count() { return _live_count; }
   static int live_not_claimed_count() { return _live_not_claimed_count; }
@@ -91,11 +80,7 @@
 
   const char* internal_name() const { return "{compiledICHolder}"; }
 
-  void claim() {
-#ifdef ASSERT
-    Atomic::dec(&_live_not_claimed_count);
-#endif
-  }
+  void claim() NOT_DEBUG_RETURN;
 };
 
 #endif // SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -71,7 +71,6 @@
 
   // only set to non-zero if constant pool is merged by RedefineClasses
   set_version(0);
-  set_lock(new Monitor(Monitor::nonleaf + 2, "A constant pool lock"));
 
   // initialize tag array
   int length = tags->length();
@@ -100,9 +99,6 @@
 void ConstantPool::release_C_heap_structures() {
   // walk constant pool and decrement symbol reference counts
   unreference_symbols();
-
-  delete _lock;
-  set_lock(NULL);
 }
 
 objArrayOop ConstantPool::resolved_references() const {
@@ -146,8 +142,7 @@
 // CDS support. Create a new resolved_references array.
 void ConstantPool::restore_unshareable_info(TRAPS) {
 
-  // Only create the new resolved references array and lock if it hasn't been
-  // attempted before
+  // Only create the new resolved references array if it hasn't been attempted before
   if (resolved_references() != NULL) return;
 
   // restore the C++ vtable from the shared archive
@@ -163,9 +158,6 @@
       ClassLoaderData* loader_data = pool_holder()->class_loader_data();
       set_resolved_references(loader_data->add_handle(refs_handle));
     }
-
-    // Also need to recreate the mutex.  Make sure this matches the constructor
-    set_lock(new Monitor(Monitor::nonleaf + 2, "A constant pool lock"));
   }
 }
 
@@ -176,7 +168,6 @@
   set_resolved_reference_length(
     resolved_references() != NULL ? resolved_references()->length() : 0);
   set_resolved_references(NULL);
-  set_lock(NULL);
 }
 
 int ConstantPool::cp_to_object_index(int cp_index) {
@@ -186,11 +177,41 @@
   return (i < 0) ? _no_index_sentinel : i;
 }
 
+void ConstantPool::trace_class_resolution(constantPoolHandle this_cp, KlassHandle k) {
+  ResourceMark rm;
+  int line_number = -1;
+  const char * source_file = NULL;
+  if (JavaThread::current()->has_last_Java_frame()) {
+    // try to identify the method which called this function.
+    vframeStream vfst(JavaThread::current());
+    if (!vfst.at_end()) {
+      line_number = vfst.method()->line_number_from_bci(vfst.bci());
+      Symbol* s = vfst.method()->method_holder()->source_file_name();
+      if (s != NULL) {
+        source_file = s->as_C_string();
+      }
+    }
+  }
+  if (k() != this_cp->pool_holder()) {
+    // only print something if the classes are different
+    if (source_file != NULL) {
+      tty->print("RESOLVE %s %s %s:%d\n",
+                 this_cp->pool_holder()->external_name(),
+                 InstanceKlass::cast(k())->external_name(), source_file, line_number);
+    } else {
+      tty->print("RESOLVE %s %s\n",
+                 this_cp->pool_holder()->external_name(),
+                 InstanceKlass::cast(k())->external_name());
+    }
+  }
+}
+
 Klass* ConstantPool::klass_at_impl(constantPoolHandle this_cp, int which, TRAPS) {
+  assert(THREAD->is_Java_thread(), "must be a Java thread");
+
   // A resolved constantPool entry will contain a Klass*, otherwise a Symbol*.
-  // It is not safe to rely on the tag bit's here, since we don't have a lock, and the entry and
-  // tag is not updated atomicly.
-
+  // It is not safe to rely on the tag bit's here, since we don't have a lock, and
+  // the entry and tag is not updated atomicly.
   CPSlot entry = this_cp->slot_at(which);
   if (entry.is_resolved()) {
     assert(entry.get_klass()->is_klass(), "must be");
@@ -198,115 +219,51 @@
     return entry.get_klass();
   }
 
-  // Acquire lock on constant oop while doing update. After we get the lock, we check if another object
-  // already has updated the object
-  assert(THREAD->is_Java_thread(), "must be a Java thread");
-  bool do_resolve = false;
-  bool in_error = false;
-
-  // Create a handle for the mirror. This will preserve the resolved class
-  // until the loader_data is registered.
-  Handle mirror_handle;
-
-  Symbol* name = NULL;
-  Handle       loader;
-  {  MonitorLockerEx ml(this_cp->lock());
-
-    if (this_cp->tag_at(which).is_unresolved_klass()) {
-      if (this_cp->tag_at(which).is_unresolved_klass_in_error()) {
-        in_error = true;
-      } else {
-        do_resolve = true;
-        name   = this_cp->unresolved_klass_at(which);
-        loader = Handle(THREAD, this_cp->pool_holder()->class_loader());
-      }
-    }
-  } // unlocking constantPool
-
-
-  // The original attempt to resolve this constant pool entry failed so find the
-  // class of the original error and throw another error of the same class (JVMS 5.4.3).
-  // If there is a detail message, pass that detail message to the error constructor.
-  // The JVMS does not strictly require us to duplicate the same detail message,
-  // or any internal exception fields such as cause or stacktrace.  But since the
-  // detail message is often a class name or other literal string, we will repeat it if
-  // we can find it in the symbol table.
-  if (in_error) {
+  // This tag doesn't change back to unresolved class unless at a safepoint.
+  if (this_cp->tag_at(which).is_unresolved_klass_in_error()) {
+    // The original attempt to resolve this constant pool entry failed so find the
+    // class of the original error and throw another error of the same class
+    // (JVMS 5.4.3).
+    // If there is a detail message, pass that detail message to the error.
+    // The JVMS does not strictly require us to duplicate the same detail message,
+    // or any internal exception fields such as cause or stacktrace.  But since the
+    // detail message is often a class name or other literal string, we will repeat it
+    // if we can find it in the symbol table.
     throw_resolution_error(this_cp, which, CHECK_0);
+    ShouldNotReachHere();
   }
 
-  if (do_resolve) {
-    // this_cp must be unlocked during resolve_or_fail
-    oop protection_domain = this_cp->pool_holder()->protection_domain();
-    Handle h_prot (THREAD, protection_domain);
-    Klass* kk = SystemDictionary::resolve_or_fail(name, loader, h_prot, true, THREAD);
-    KlassHandle k;
-    if (!HAS_PENDING_EXCEPTION) {
-      k = KlassHandle(THREAD, kk);
-      // preserve the resolved klass.
-      mirror_handle = Handle(THREAD, kk->java_mirror());
-      // Do access check for klasses
-      verify_constant_pool_resolve(this_cp, k, THREAD);
-    }
-
-    // Failed to resolve class. We must record the errors so that subsequent attempts
-    // to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
-    if (HAS_PENDING_EXCEPTION) {
-        MonitorLockerEx ml(this_cp->lock());
-
-        // some other thread has beaten us and has resolved the class.
-        if (this_cp->tag_at(which).is_klass()) {
-          CLEAR_PENDING_EXCEPTION;
-          entry = this_cp->resolved_klass_at(which);
-          return entry.get_klass();
-        }
+  Handle mirror_handle;
+  Symbol* name = entry.get_symbol();
+  Handle loader (THREAD, this_cp->pool_holder()->class_loader());
+  Handle protection_domain (THREAD, this_cp->pool_holder()->protection_domain());
+  Klass* kk = SystemDictionary::resolve_or_fail(name, loader, protection_domain, true, THREAD);
+  KlassHandle k (THREAD, kk);
+  if (!HAS_PENDING_EXCEPTION) {
+    // preserve the resolved klass from unloading
+    mirror_handle = Handle(THREAD, kk->java_mirror());
+    // Do access check for klasses
+    verify_constant_pool_resolve(this_cp, k, THREAD);
+  }
 
-        // The tag could have changed to in-error before the lock but we have to
-        // handle that here for the class case.
-        save_and_throw_exception(this_cp, which, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_0);
-    }
+  // Failed to resolve class. We must record the errors so that subsequent attempts
+  // to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
+  if (HAS_PENDING_EXCEPTION) {
+    save_and_throw_exception(this_cp, which, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_0);
+  }
 
-    if (TraceClassResolution && !k()->oop_is_array()) {
-      // skip resolving the constant pool so that this code get's
-      // called the next time some bytecodes refer to this class.
-      ResourceMark rm;
-      int line_number = -1;
-      const char * source_file = NULL;
-      if (JavaThread::current()->has_last_Java_frame()) {
-        // try to identify the method which called this function.
-        vframeStream vfst(JavaThread::current());
-        if (!vfst.at_end()) {
-          line_number = vfst.method()->line_number_from_bci(vfst.bci());
-          Symbol* s = vfst.method()->method_holder()->source_file_name();
-          if (s != NULL) {
-            source_file = s->as_C_string();
-          }
-        }
-      }
-      if (k() != this_cp->pool_holder()) {
-        // only print something if the classes are different
-        if (source_file != NULL) {
-          tty->print("RESOLVE %s %s %s:%d\n",
-                     this_cp->pool_holder()->external_name(),
-                     InstanceKlass::cast(k())->external_name(), source_file, line_number);
-        } else {
-          tty->print("RESOLVE %s %s\n",
-                     this_cp->pool_holder()->external_name(),
-                     InstanceKlass::cast(k())->external_name());
-        }
-      }
+  // Make this class loader depend upon the class loader owning the class reference
+  ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
+  this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
+
+  if (TraceClassResolution && !k->oop_is_array()) {
+    // skip resolving the constant pool so that this code gets
+    // called the next time some bytecodes refer to this class.
+    trace_class_resolution(this_cp, k);
       return k();
     } else {
-      MonitorLockerEx ml(this_cp->lock());
-      // Only updated constant pool - if it is resolved.
-      do_resolve = this_cp->tag_at(which).is_unresolved_klass();
-      if (do_resolve) {
-        ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
-        this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
         this_cp->klass_at_put(which, k());
       }
-    }
-  }
 
   entry = this_cp->resolved_klass_at(which);
   assert(entry.is_resolved() && entry.get_klass()->is_klass(), "must be resolved at this point");
@@ -576,7 +533,7 @@
   switch (tag.value()) {
   case JVM_CONSTANT_UnresolvedClass:
     // return the class name in the error message
-    message = this_cp->unresolved_klass_at(which);
+    message = this_cp->klass_name_at(which);
     break;
   case JVM_CONSTANT_MethodHandle:
     // return the method handle name in the error message
@@ -606,7 +563,6 @@
 // in the resolution error table, so that the same exception is thrown again.
 void ConstantPool::save_and_throw_exception(constantPoolHandle this_cp, int which,
                                             constantTag tag, TRAPS) {
-  assert(this_cp->lock()->is_locked(), "constant pool lock should be held");
   Symbol* error = PENDING_EXCEPTION->klass()->name();
 
   int error_tag = tag.error_value();
@@ -620,7 +576,14 @@
   } else if (this_cp->tag_at(which).value() != error_tag) {
     Symbol* message = exception_message(this_cp, which, tag, PENDING_EXCEPTION);
     SystemDictionary::add_resolution_error(this_cp, which, error, message);
-    this_cp->tag_at_put(which, error_tag);
+    // CAS in the tag.  If a thread beat us to registering this error that's fine.
+    // If another thread resolved the reference, this is an error.  The resolution
+    // must deterministically get an error.   So why do we save this?
+    // We save this because jvmti can add classes to the bootclass path after this
+    // error, so it needs to get the same error if the error is first.
+    jbyte old_tag = Atomic::cmpxchg((jbyte)error_tag,
+                            (jbyte*)this_cp->tag_addr_at(which), (jbyte)tag.value());
+    assert(old_tag == error_tag || old_tag == tag.value(), "should not be resolved otherwise");
   } else {
     // some other thread put this in error state
     throw_resolution_error(this_cp, which, CHECK);
@@ -710,7 +673,6 @@
                                                                    THREAD);
       result_oop = value();
       if (HAS_PENDING_EXCEPTION) {
-        MonitorLockerEx ml(this_cp->lock());  // lock cpool to change tag.
         save_and_throw_exception(this_cp, index, tag, CHECK_NULL);
       }
       break;
@@ -727,7 +689,6 @@
       Handle value = SystemDictionary::find_method_handle_type(signature, klass, THREAD);
       result_oop = value();
       if (HAS_PENDING_EXCEPTION) {
-        MonitorLockerEx ml(this_cp->lock());  // lock cpool to change tag.
         save_and_throw_exception(this_cp, index, tag, CHECK_NULL);
       }
       break;
@@ -765,22 +726,17 @@
   }
 
   if (cache_index >= 0) {
-    // Cache the oop here also.
-    Handle result_handle(THREAD, result_oop);
-    MonitorLockerEx ml(this_cp->lock());  // don't know if we really need this
-    oop result = this_cp->resolved_references()->obj_at(cache_index);
-    // Benign race condition:  resolved_references may already be filled in while we were trying to lock.
+    // Benign race condition:  resolved_references may already be filled in.
     // The important thing here is that all threads pick up the same result.
     // It doesn't matter which racing thread wins, as long as only one
     // result is used by all threads, and all future queries.
-    // That result may be either a resolved constant or a failure exception.
-    if (result == NULL) {
-      this_cp->resolved_references()->obj_at_put(cache_index, result_handle());
-      return result_handle();
+    oop old_result = this_cp->resolved_references()->atomic_compare_exchange_oop(cache_index, result_oop, NULL);
+    if (old_result == NULL) {
+      return result_oop;  // was installed
     } else {
       // Return the winning thread's result.  This can be different than
-      // result_handle() for MethodHandles.
-      return result;
+      // the result here for MethodHandles.
+      return old_result;
     }
   } else {
     return result_oop;
@@ -853,9 +809,8 @@
 }
 
 
-// Iterate over symbols and decrement ones which are Symbol*s.
-// This is done during GC so do not need to lock constantPool unless we
-// have per-thread safepoints.
+// Iterate over symbols and decrement ones which are Symbol*s
+// This is done during GC.
 // Only decrement the UTF8 symbols. Unresolved classes and strings point to
 // these symbols but didn't increment the reference count.
 void ConstantPool::unreference_symbols() {
@@ -987,8 +942,8 @@
 
   case JVM_CONSTANT_UnresolvedClass:
   {
-    Symbol* k1 = unresolved_klass_at(index1);
-    Symbol* k2 = cp2->unresolved_klass_at(index2);
+    Symbol* k1 = klass_name_at(index1);
+    Symbol* k2 = cp2->klass_name_at(index2);
     if (k1 == k2) {
       return true;
     }
@@ -1970,7 +1925,6 @@
       break;
     case JVM_CONSTANT_UnresolvedClass :               // fall-through
     case JVM_CONSTANT_UnresolvedClassInError: {
-      // unresolved_klass_at requires lock or safe world.
       CPSlot entry = slot_at(index);
       if (entry.is_resolved()) {
         entry.get_klass()->print_value_on(st);
--- a/hotspot/src/share/vm/oops/constantPool.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/constantPool.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -112,12 +112,12 @@
     int                _version;
   } _saved;
 
-  Monitor*             _lock;
-
   void set_tags(Array<u1>* tags)               { _tags = tags; }
   void tag_at_put(int which, jbyte t)          { tags()->at_put(which, t); }
   void release_tag_at_put(int which, jbyte t)  { tags()->release_at_put(which, t); }
 
+  u1* tag_addr_at(int which) const             { return tags()->adr_at(which); }
+
   void set_operands(Array<u2>* operands)       { _operands = operands; }
 
   int flags() const                            { return _flags; }
@@ -362,14 +362,6 @@
     return CPSlot((Klass*)OrderAccess::load_ptr_acquire(obj_at_addr_raw(which))).get_klass();
   }
 
-  // This method should only be used with a cpool lock or during parsing or gc
-  Symbol* unresolved_klass_at(int which) {     // Temporary until actual use
-    Symbol* s = CPSlot((Symbol*)OrderAccess::load_ptr_acquire(obj_at_addr_raw(which))).get_symbol();
-    // check that the klass is still unresolved.
-    assert(tag_at(which).is_unresolved_klass(), "Corrupted constant pool");
-    return s;
-  }
-
   // RedefineClasses() API support:
   Symbol* klass_at_noresolve(int which) { return klass_name_at(which); }
 
@@ -818,6 +810,8 @@
   static Klass* klass_at_impl(constantPoolHandle this_cp, int which, TRAPS);
   static oop string_at_impl(constantPoolHandle this_cp, int which, int obj_index, TRAPS);
 
+  static void trace_class_resolution(constantPoolHandle this_cp, KlassHandle k);
+
   // Resolve string constants (to prevent allocation during compilation)
   static void resolve_string_constants_impl(constantPoolHandle this_cp, TRAPS);
 
@@ -848,8 +842,6 @@
 
   void set_resolved_reference_length(int length) { _saved._resolved_reference_length = length; }
   int  resolved_reference_length() const  { return _saved._resolved_reference_length; }
-  void set_lock(Monitor* lock)            { _lock = lock; }
-  Monitor* lock()                         { return _lock; }
 
   // Decrease ref counts of symbols that are in the constant pool
   // when the holder class is unloaded
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -32,6 +32,7 @@
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiRedefineClassesTrace.hpp"
 #include "prims/methodHandles.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "utilities/macros.hpp"
@@ -286,7 +287,9 @@
   // the lock, so that when the losing writer returns, he can use the linked
   // cache entry.
 
-  MonitorLockerEx ml(cpool->lock());
+  // Use the lock from the metaspace for this, which cannot stop for safepoint.
+  Mutex* metaspace_lock = cpool->pool_holder()->class_loader_data()->metaspace_lock();
+  MutexLockerEx ml(metaspace_lock,  Mutex::_no_safepoint_check_flag);
   if (!is_f1_null()) {
     return;
   }
--- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "gc_implementation/shared/markSweep.inline.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "memory/genOopClosures.inline.hpp"
+#include "memory/iterator.inline.hpp"
 #include "memory/oopFactory.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/instanceClassLoaderKlass.hpp"
@@ -44,12 +45,6 @@
 #include "oops/oop.pcgc.inline.hpp"
 #endif // INCLUDE_ALL_GCS
 
-#define if_do_metadata_checked(closure, nv_suffix)                    \
-  /* Make sure the non-virtual and the virtual versions match. */     \
-  assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
-      "Inconsistency in do_metadata");                                \
-  if (closure->do_metadata##nv_suffix())
-
 // Macro to define InstanceClassLoaderKlass::oop_oop_iterate for virtual/nonvirtual for
 // all closures.  Macros calling macros above for each oop size.
 // Since ClassLoader objects have only a pointer to the loader_data, they are not
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -35,6 +35,7 @@
 #include "jvmtifiles/jvmti.h"
 #include "memory/genOopClosures.inline.hpp"
 #include "memory/heapInspection.hpp"
+#include "memory/iterator.inline.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/oopFactory.hpp"
 #include "oops/fieldStreams.hpp"
@@ -51,6 +52,7 @@
 #include "prims/jvmtiRedefineClasses.hpp"
 #include "prims/jvmtiThreadState.hpp"
 #include "prims/methodComparator.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/fieldDescriptor.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
@@ -2113,12 +2115,6 @@
 // closure's do_metadata() method dictates whether the given closure should be
 // applied to the klass ptr in the object header.
 
-#define if_do_metadata_checked(closure, nv_suffix)                    \
-  /* Make sure the non-virtual and the virtual versions match. */     \
-  assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
-      "Inconsistency in do_metadata");                                \
-  if (closure->do_metadata##nv_suffix())
-
 #define InstanceKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)        \
                                                                              \
 int InstanceKlass::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \
@@ -2142,10 +2138,9 @@
 int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj,                \
                                               OopClosureType* closure) {        \
   SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik); \
-  /* header */                                                                  \
-  if_do_metadata_checked(closure, nv_suffix) {                                  \
-    closure->do_klass##nv_suffix(obj->klass());                                 \
-  }                                                                             \
+                                                                                \
+  assert_should_ignore_metadata(closure, nv_suffix);                            \
+                                                                                \
   /* instance variables */                                                      \
   InstanceKlass_OOP_MAP_REVERSE_ITERATE(                                        \
     obj,                                                                        \
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -32,7 +32,6 @@
 #include "oops/fieldInfo.hpp"
 #include "oops/instanceOop.hpp"
 #include "oops/klassVtable.hpp"
-#include "runtime/atomic.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/os.hpp"
 #include "utilities/accessFlags.hpp"
--- a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "gc_implementation/shared/markSweep.inline.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "memory/genOopClosures.inline.hpp"
+#include "memory/iterator.inline.hpp"
 #include "memory/oopFactory.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/instanceMirrorKlass.hpp"
@@ -241,12 +242,6 @@
   return oop_size(obj);                                                               \
 
 
-#define if_do_metadata_checked(closure, nv_suffix)                    \
-  /* Make sure the non-virtual and the virtual versions match. */     \
-  assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
-      "Inconsistency in do_metadata");                                \
-  if (closure->do_metadata##nv_suffix())
-
 // Macro to define InstanceMirrorKlass::oop_oop_iterate for virtual/nonvirtual for
 // all closures.  Macros calling macros above for each oop size.
 
--- a/hotspot/src/share/vm/oops/klass.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -508,7 +508,7 @@
   // Only recreate it if not present.  A previous attempt to restore may have
   // gotten an OOM later but keep the mirror if it was created.
   if (java_mirror() == NULL) {
-    java_lang_Class::create_mirror(this, Handle(NULL), CHECK);
+    java_lang_Class::create_mirror(this, Handle(NULL), Handle(NULL), CHECK);
   }
 }
 
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -29,6 +29,7 @@
 #include "gc_implementation/shared/markSweep.inline.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "memory/genOopClosures.inline.hpp"
+#include "memory/iterator.inline.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.inline.hpp"
@@ -476,12 +477,6 @@
 }
 #endif // INCLUDE_ALL_GCS
 
-#define if_do_metadata_checked(closure, nv_suffix)                    \
-  /* Make sure the non-virtual and the virtual versions match. */     \
-  assert(closure->do_metadata##nv_suffix() == closure->do_metadata(), \
-      "Inconsistency in do_metadata");                                \
-  if (closure->do_metadata##nv_suffix())
-
 #define ObjArrayKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)           \
                                                                                 \
 int ObjArrayKlass::oop_oop_iterate##nv_suffix(oop obj,                          \
--- a/hotspot/src/share/vm/oops/objArrayOop.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/objArrayOop.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,6 +27,22 @@
 #include "oops/objArrayOop.hpp"
 #include "oops/oop.inline.hpp"
 
+oop objArrayOopDesc::atomic_compare_exchange_oop(int index, oop exchange_value,
+                                                 oop compare_value) {
+  volatile HeapWord* dest;
+  if (UseCompressedOops) {
+    dest = (HeapWord*)obj_at_addr<narrowOop>(index);
+  } else {
+    dest = (HeapWord*)obj_at_addr<oop>(index);
+  }
+  oop res = oopDesc::atomic_compare_exchange_oop(exchange_value, dest, compare_value, true);
+  // update card mark if success
+  if (res == compare_value) {
+    update_barrier_set((void*)dest, exchange_value);
+  }
+  return res;
+}
+
 #define ObjArrayOop_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)                    \
                                                                                    \
 int objArrayOopDesc::oop_iterate_range(OopClosureType* blk, int start, int end) {  \
--- a/hotspot/src/share/vm/oops/objArrayOop.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/objArrayOop.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -95,6 +95,9 @@
       oop_store(obj_at_addr<oop>(index), value);
     }
   }
+
+  oop atomic_compare_exchange_oop(int index, oop exchange_value, oop compare_value);
+
   // Sizing
   static int header_size()    { return arrayOopDesc::header_size(T_OBJECT); }
   int object_size()           { return object_size(length()); }
--- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP
 
 #include "utilities/macros.hpp"
+#include "runtime/atomic.inline.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/parNew/parNewGeneration.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
--- a/hotspot/src/share/vm/oops/symbol.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/oops/symbol.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,11 +26,11 @@
 #include "precompiled.hpp"
 #include "classfile/altHashing.hpp"
 #include "classfile/classLoaderData.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/resourceArea.hpp"
 #include "oops/symbol.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/os.hpp"
-#include "memory/allocation.inline.hpp"
-#include "memory/resourceArea.hpp"
 
 Symbol::Symbol(const u1* name, int length, int refcount) {
   _refcount = refcount;
--- a/hotspot/src/share/vm/opto/compile.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/opto/compile.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -3411,7 +3411,7 @@
     _root->verify_edges(visited);
     if (no_dead_code) {
       // Now make sure that no visited node is used by an unvisited node.
-      bool dead_nodes = 0;
+      bool dead_nodes = false;
       Unique_Node_List checked(area);
       while (visited.size() > 0) {
         Node* n = visited.pop();
@@ -3422,14 +3422,16 @@
           if (visited.member(use))  continue;  // already in the graph
           if (use->is_Con())        continue;  // a dead ConNode is OK
           // At this point, we have found a dead node which is DU-reachable.
-          if (dead_nodes++ == 0)
+          if (!dead_nodes) {
             tty->print_cr("*** Dead nodes reachable via DU edges:");
+            dead_nodes = true;
+          }
           use->dump(2);
           tty->print_cr("---");
           checked.push(use);  // No repeats; pretend it is now checked.
         }
       }
-      assert(dead_nodes == 0, "using nodes must be reachable from root");
+      assert(!dead_nodes, "using nodes must be reachable from root");
     }
   }
 }
--- a/hotspot/src/share/vm/opto/matcher.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/opto/matcher.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -36,7 +36,6 @@
 #include "opto/runtime.hpp"
 #include "opto/type.hpp"
 #include "opto/vectornode.hpp"
-#include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #ifdef TARGET_ARCH_MODEL_x86_32
 # include "adfiles/ad_x86_32.hpp"
--- a/hotspot/src/share/vm/opto/runtime.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/opto/runtime.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -55,6 +55,7 @@
 #include "opto/mulnode.hpp"
 #include "opto/runtime.hpp"
 #include "opto/subnode.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/share/vm/prims/jni.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/prims/jni.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -59,6 +59,7 @@
 #include "prims/jvm_misc.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiThreadState.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/fieldDescriptor.hpp"
 #include "runtime/fprofiler.hpp"
@@ -3336,13 +3337,7 @@
     directBufferSupportInitializeEnded = 1;
   } else {
     while (!directBufferSupportInitializeEnded && !directBufferSupportInitializeFailed) {
-      // Set state as yield_all can call os:sleep. On Solaris, yield_all calls
-      // os::sleep which requires the VM state transition. On other platforms, it
-      // is not necessary. The following call to change the VM state is purposely
-      // put inside the loop to avoid potential deadlock when multiple threads
-      // try to call this method. See 6791815 for more details.
-      ThreadInVMfromNative tivn(thread);
-      os::yield_all();
+      os::yield();
     }
   }
 
--- a/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -44,6 +44,7 @@
 #include "prims/nativeLookup.hpp"
 #include "prims/privilegedStack.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/dtraceJSDT.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
@@ -55,6 +56,7 @@
 #include "runtime/os.hpp"
 #include "runtime/perfData.hpp"
 #include "runtime/reflection.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vframe.hpp"
 #include "runtime/vm_operations.hpp"
 #include "services/attachListener.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -258,9 +258,6 @@
       // VM representation. We don't attach the reconstituted class
       // bytes to the InstanceKlass here because they have not been
       // validated and we're not at a safepoint.
-      constantPoolHandle  constants(current_thread, ikh->constants());
-      MonitorLockerEx ml(constants->lock());    // lock constant pool while we query it
-
       JvmtiClassFileReconstituter reconstituter(ikh);
       if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
         return reconstituter.get_error();
@@ -2445,9 +2442,6 @@
   }
 
   instanceKlassHandle ikh(thread, k_oop);
-  constantPoolHandle  constants(thread, ikh->constants());
-  MonitorLockerEx ml(constants->lock());    // lock constant pool while we query it
-
   JvmtiConstantPoolReconstituter reconstituter(ikh);
   if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
     return reconstituter.get_error();
@@ -2467,6 +2461,7 @@
     return reconstituter.get_error();
   }
 
+  constantPoolHandle  constants(thread, ikh->constants());
   *constant_pool_count_ptr      = constants->length();
   *constant_pool_byte_count_ptr = cpool_size;
   *constant_pool_bytes_ptr      = cpool_bytes;
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -32,7 +32,7 @@
 #include "prims/jvmtiEventController.inline.hpp"
 #include "prims/jvmtiImpl.hpp"
 #include "prims/jvmtiRedefineClasses.hpp"
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/handles.inline.hpp"
--- a/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiRawMonitor.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "prims/jvmtiRawMonitor.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/thread.inline.hpp"
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -31,6 +31,7 @@
 #include "memory/allocation.inline.hpp"
 #include "prims/jni.h"
 #include "prims/jvm.h"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/prefetch.inline.hpp"
@@ -891,6 +892,14 @@
   }
 UNSAFE_END
 
+static jobject get_class_loader(JNIEnv* env, jclass cls) {
+  if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {
+    return NULL;
+  }
+  Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
+  oop loader = k->class_loader();
+  return JNIHandles::make_local(env, loader);
+}
 
 UNSAFE_ENTRY(jclass, Unsafe_DefineClass0(JNIEnv *env, jobject unsafe, jstring name, jbyteArray data, int offset, int length))
   UnsafeWrapper("Unsafe_DefineClass");
@@ -899,7 +908,7 @@
 
     int depthFromDefineClass0 = 1;
     jclass  caller = JVM_GetCallerClass(env, depthFromDefineClass0);
-    jobject loader = (caller == NULL) ? NULL : JVM_GetClassLoader(env, caller);
+    jobject loader = (caller == NULL) ? NULL : get_class_loader(env, caller);
     jobject pd     = (caller == NULL) ? NULL : JVM_GetProtectionDomain(env, caller);
 
     return Unsafe_DefineClass_impl(env, name, data, offset, length, loader, pd);
--- a/hotspot/src/share/vm/runtime/biasedLocking.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/biasedLocking.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "oops/klass.inline.hpp"
 #include "oops/markOop.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/task.hpp"
--- a/hotspot/src/share/vm/runtime/extendedPC.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/extendedPC.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,9 @@
 #ifndef SHARE_VM_RUNTIME_EXTENDEDPC_HPP
 #define SHARE_VM_RUNTIME_EXTENDEDPC_HPP
 
+#include "memory/allocation.hpp"
+#include "utilities/globalDefinitions.hpp"
+
 // An ExtendedPC contains the _pc from a signal handler in a platform
 // independent way.
 
--- a/hotspot/src/share/vm/runtime/frame.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -44,6 +44,7 @@
 #include "runtime/signature.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/decoder.hpp"
 
 #ifdef TARGET_ARCH_x86
--- a/hotspot/src/share/vm/runtime/globals.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -2299,6 +2299,9 @@
   manageable(bool, PrintGCTimeStamps, false,                                \
           "Print timestamps at garbage collection")                         \
                                                                             \
+  manageable(bool, PrintGCID, true,                                         \
+          "Print an identifier for each garbage collection")                \
+                                                                            \
   product(bool, PrintGCTaskTimeStamps, false,                               \
           "Print timestamps for individual gc worker thread tasks")         \
                                                                             \
--- a/hotspot/src/share/vm/runtime/handles.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 #include "memory/allocation.inline.hpp"
 #include "oops/constantPool.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/thread.inline.hpp"
 #ifdef TARGET_OS_FAMILY_linux
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "memory/genCollectedHeap.hpp"
 #include "memory/resourceArea.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/orderAccess.inline.hpp"
--- a/hotspot/src/share/vm/runtime/mutex.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/mutex.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
--- a/hotspot/src/share/vm/runtime/objectMonitor.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/objectMonitor.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -27,6 +27,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/markOop.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutexLocker.hpp"
--- a/hotspot/src/share/vm/runtime/os.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/os.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -40,6 +40,7 @@
 #include "prims/jvm_misc.hpp"
 #include "prims/privilegedStack.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/java.hpp"
--- a/hotspot/src/share/vm/runtime/os.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/os.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,7 +26,6 @@
 #define SHARE_VM_RUNTIME_OS_HPP
 
 #include "jvmtifiles/jvmti.h"
-#include "runtime/atomic.hpp"
 #include "runtime/extendedPC.hpp"
 #include "runtime/handles.hpp"
 #include "utilities/top.hpp"
@@ -453,8 +452,6 @@
     // yield that can be used in lieu of blocking.
   } ;
   static YieldResult NakedYield () ;
-  static void yield_all(); // Yields to all other threads including lower priority
-                           // (for the default scheduling policy)
   static OSReturn set_priority(Thread* thread, ThreadPriority priority);
   static OSReturn get_priority(const Thread* const thread, ThreadPriority& priority);
 
--- a/hotspot/src/share/vm/runtime/safepoint.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -32,10 +32,12 @@
 #include "code/scopeDesc.hpp"
 #include "gc_interface/collectedHeap.hpp"
 #include "interpreter/interpreter.hpp"
+#include "memory/gcLocker.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/symbol.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
@@ -264,8 +266,8 @@
       //
       // Further complicating matters is that yield() does not work as naively expected
       // on many platforms -- yield() does not guarantee that any other ready threads
-      // will run.   As such we revert yield_all() after some number of iterations.
-      // Yield_all() is implemented as a short unconditional sleep on some platforms.
+      // will run.   As such we revert to naked_short_sleep() after some number of iterations.
+      // nakes_short_sleep() is implemented as a short unconditional sleep.
       // Typical operating systems round a "short" sleep period up to 10 msecs, so sleeping
       // can actually increase the time it takes the VM thread to detect that a system-wide
       // stop-the-world safepoint has been reached.  In a pathological scenario such as that
@@ -322,9 +324,7 @@
       if (steps < DeferThrSuspendLoopCount) {
         os::NakedYield() ;
       } else {
-        os::yield_all() ;
-        // Alternately, the VM thread could transiently depress its scheduling priority or
-        // transiently increase the priority of the tardy mutator(s).
+        os::naked_short_sleep(1);
       }
 
       iterations ++ ;
@@ -744,80 +744,12 @@
 // ------------------------------------------------------------------------------------------------------
 // Exception handlers
 
-#ifndef PRODUCT
-
-#ifdef SPARC
-
-#ifdef _LP64
-#define PTR_PAD ""
-#else
-#define PTR_PAD "        "
-#endif
-
-static void print_ptrs(intptr_t oldptr, intptr_t newptr, bool wasoop) {
-  bool is_oop = newptr ? (cast_to_oop(newptr))->is_oop() : false;
-  tty->print_cr(PTR_FORMAT PTR_PAD " %s %c " PTR_FORMAT PTR_PAD " %s %s",
-                oldptr, wasoop?"oop":"   ", oldptr == newptr ? ' ' : '!',
-                newptr, is_oop?"oop":"   ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":"     "));
-}
-
-static void print_longs(jlong oldptr, jlong newptr, bool wasoop) {
-  bool is_oop = newptr ? (cast_to_oop(newptr))->is_oop() : false;
-  tty->print_cr(PTR64_FORMAT " %s %c " PTR64_FORMAT " %s %s",
-                oldptr, wasoop?"oop":"   ", oldptr == newptr ? ' ' : '!',
-                newptr, is_oop?"oop":"   ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":"     "));
-}
-
-static void print_me(intptr_t *new_sp, intptr_t *old_sp, bool *was_oops) {
-#ifdef _LP64
-  tty->print_cr("--------+------address-----+------before-----------+-------after----------+");
-  const int incr = 1;           // Increment to skip a long, in units of intptr_t
-#else
-  tty->print_cr("--------+--address-+------before-----------+-------after----------+");
-  const int incr = 2;           // Increment to skip a long, in units of intptr_t
-#endif
-  tty->print_cr("---SP---|");
-  for( int i=0; i<16; i++ ) {
-    tty->print("blob %c%d |"PTR_FORMAT" ","LO"[i>>3],i&7,new_sp); print_ptrs(*old_sp++,*new_sp++,*was_oops++); }
-  tty->print_cr("--------|");
-  for( int i1=0; i1<frame::memory_parameter_word_sp_offset-16; i1++ ) {
-    tty->print("argv pad|"PTR_FORMAT" ",new_sp); print_ptrs(*old_sp++,*new_sp++,*was_oops++); }
-  tty->print("     pad|"PTR_FORMAT" ",new_sp); print_ptrs(*old_sp++,*new_sp++,*was_oops++);
-  tty->print_cr("--------|");
-  tty->print(" G1     |"PTR_FORMAT" ",new_sp); print_longs(*(jlong*)old_sp,*(jlong*)new_sp,was_oops[incr-1]); old_sp += incr; new_sp += incr; was_oops += incr;
-  tty->print(" G3     |"PTR_FORMAT" ",new_sp); print_longs(*(jlong*)old_sp,*(jlong*)new_sp,was_oops[incr-1]); old_sp += incr; new_sp += incr; was_oops += incr;
-  tty->print(" G4     |"PTR_FORMAT" ",new_sp); print_longs(*(jlong*)old_sp,*(jlong*)new_sp,was_oops[incr-1]); old_sp += incr; new_sp += incr; was_oops += incr;
-  tty->print(" G5     |"PTR_FORMAT" ",new_sp); print_longs(*(jlong*)old_sp,*(jlong*)new_sp,was_oops[incr-1]); old_sp += incr; new_sp += incr; was_oops += incr;
-  tty->print_cr(" FSR    |"PTR_FORMAT" "PTR64_FORMAT"       "PTR64_FORMAT,new_sp,*(jlong*)old_sp,*(jlong*)new_sp);
-  old_sp += incr; new_sp += incr; was_oops += incr;
-  // Skip the floats
-  tty->print_cr("--Float-|"PTR_FORMAT,new_sp);
-  tty->print_cr("---FP---|");
-  old_sp += incr*32;  new_sp += incr*32;  was_oops += incr*32;
-  for( int i2=0; i2<16; i2++ ) {
-    tty->print("call %c%d |"PTR_FORMAT" ","LI"[i2>>3],i2&7,new_sp); print_ptrs(*old_sp++,*new_sp++,*was_oops++); }
-  tty->cr();
-}
-#endif  // SPARC
-#endif  // PRODUCT
-
 
 void SafepointSynchronize::handle_polling_page_exception(JavaThread *thread) {
   assert(thread->is_Java_thread(), "polling reference encountered by VM thread");
   assert(thread->thread_state() == _thread_in_Java, "should come from Java code");
   assert(SafepointSynchronize::is_synchronizing(), "polling encountered outside safepoint synchronization");
 
-  // Uncomment this to get some serious before/after printing of the
-  // Sparc safepoint-blob frame structure.
-  /*
-  intptr_t* sp = thread->last_Java_sp();
-  intptr_t stack_copy[150];
-  for( int i=0; i<150; i++ ) stack_copy[i] = sp[i];
-  bool was_oops[150];
-  for( int i=0; i<150; i++ )
-    was_oops[i] = stack_copy[i] ? ((oop)stack_copy[i])->is_oop() : false;
-  */
-
   if (ShowSafepointMsgs) {
     tty->print("handle_polling_page_exception: ");
   }
@@ -829,7 +761,6 @@
   ThreadSafepointState* state = thread->safepoint_state();
 
   state->handle_polling_page_exception();
-  // print_me(sp,stack_copy,was_oops);
 }
 
 
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -42,6 +42,7 @@
 #include "prims/jvmtiRedefineClassesTrace.hpp"
 #include "prims/methodHandles.hpp"
 #include "prims/nativeLookup.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/handles.inline.hpp"
@@ -1176,10 +1177,7 @@
          (!is_virtual && invoke_code == Bytecodes::_invokedynamic) ||
          ( is_virtual && invoke_code != Bytecodes::_invokestatic ), "inconsistent bytecode");
 
-  // We do not patch the call site if the caller nmethod has been made non-entrant.
-  if (!caller_nm->is_in_use()) {
-    return callee_method;
-  }
+  assert(caller_nm->is_alive(), "It should be alive");
 
 #ifndef PRODUCT
   // tracing/debugging/statistics
@@ -1249,13 +1247,11 @@
 
     // Now that we are ready to patch if the Method* was redefined then
     // don't update call site and let the caller retry.
-    // Don't update call site if caller nmethod has been made non-entrant
-    // as it is a waste of time.
     // Don't update call site if callee nmethod was unloaded or deoptimized.
     // Don't update call site if callee nmethod was replaced by an other nmethod
     // which may happen when multiply alive nmethod (tiered compilation)
     // will be supported.
-    if (!callee_method->is_old() && caller_nm->is_in_use() &&
+    if (!callee_method->is_old() &&
         (callee_nm == NULL || callee_nm->is_in_use() && (callee_method->code() == callee_nm))) {
 #ifdef ASSERT
       // We must not try to patch to jump to an already unloaded method.
@@ -1454,14 +1450,12 @@
   // out of scope.
   JvmtiDynamicCodeEventCollector event_collector;
 
-  // Update inline cache to megamorphic. Skip update if caller has been
-  // made non-entrant or we are called from interpreted.
+  // Update inline cache to megamorphic. Skip update if we are called from interpreted.
   { MutexLocker ml_patch (CompiledIC_lock);
     RegisterMap reg_map(thread, false);
     frame caller_frame = thread->last_frame().sender(&reg_map);
     CodeBlob* cb = caller_frame.cb();
-    if (cb->is_nmethod() && ((nmethod*)cb)->is_in_use()) {
-      // Not a non-entrant nmethod, so find inline_cache
+    if (cb->is_nmethod()) {
       CompiledIC* inline_cache = CompiledIC_before(((nmethod*)cb), caller_frame.pc());
       bool should_be_mono = false;
       if (inline_cache->is_optimized()) {
@@ -1604,19 +1598,13 @@
       // resolve is only done once.
 
       MutexLocker ml(CompiledIC_lock);
-      //
-      // We do not patch the call site if the nmethod has been made non-entrant
-      // as it is a waste of time
-      //
-      if (caller_nm->is_in_use()) {
-        if (is_static_call) {
-          CompiledStaticCall* ssc= compiledStaticCall_at(call_addr);
-          ssc->set_to_clean();
-        } else {
-          // compiled, dispatched call (which used to call an interpreted method)
-          CompiledIC* inline_cache = CompiledIC_at(caller_nm, call_addr);
-          inline_cache->set_to_clean();
-        }
+      if (is_static_call) {
+        CompiledStaticCall* ssc= compiledStaticCall_at(call_addr);
+        ssc->set_to_clean();
+      } else {
+        // compiled, dispatched call (which used to call an interpreted method)
+        CompiledIC* inline_cache = CompiledIC_at(caller_nm, call_addr);
+        inline_cache->set_to_clean();
       }
     }
 
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -30,7 +30,7 @@
 #include "compiler/compileBroker.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/method.hpp"
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.inline.hpp"
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -27,6 +27,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/markOop.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -46,6 +46,7 @@
 #include "prims/jvmtiThreadState.hpp"
 #include "prims/privilegedStack.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/fprofiler.hpp"
@@ -1357,14 +1358,24 @@
 }
 
 void WatcherThread::stop() {
-  {
-    MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
-    _should_terminate = true;
-    OrderAccess::fence();  // ensure WatcherThread sees update in main loop
-
+  // Get the PeriodicTask_lock if we can. If we cannot, then the
+  // WatcherThread is using it and we don't want to block on that lock
+  // here because that might cause a safepoint deadlock depending on
+  // what the current WatcherThread tasks are doing.
+  bool have_lock = PeriodicTask_lock->try_lock();
+
+  _should_terminate = true;
+  OrderAccess::fence();  // ensure WatcherThread sees update in main loop
+
+  if (have_lock) {
     WatcherThread* watcher = watcher_thread();
-    if (watcher != NULL)
+    if (watcher != NULL) {
+      // If we managed to get the lock, then we should unpark the
+      // WatcherThread so that it can see we want it to stop.
       watcher->unpark();
+    }
+
+    PeriodicTask_lock->unlock();
   }
 
   // it is ok to take late safepoints here, if needed
--- a/hotspot/src/share/vm/runtime/thread.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -343,42 +343,16 @@
 
   bool has_async_exception() const { return (_suspend_flags & _has_async_exception) != 0; }
 
-  void set_suspend_flag(SuspendFlags f) {
-    assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
-    uint32_t flags;
-    do {
-      flags = _suspend_flags;
-    }
-    while (Atomic::cmpxchg((jint)(flags | f),
-                           (volatile jint*)&_suspend_flags,
-                           (jint)flags) != (jint)flags);
-  }
-  void clear_suspend_flag(SuspendFlags f) {
-    assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
-    uint32_t flags;
-    do {
-      flags = _suspend_flags;
-    }
-    while (Atomic::cmpxchg((jint)(flags & ~f),
-                           (volatile jint*)&_suspend_flags,
-                           (jint)flags) != (jint)flags);
-  }
+  inline void set_suspend_flag(SuspendFlags f);
+  inline void clear_suspend_flag(SuspendFlags f);
 
-  void set_has_async_exception() {
-    set_suspend_flag(_has_async_exception);
-  }
-  void clear_has_async_exception() {
-    clear_suspend_flag(_has_async_exception);
-  }
+  inline void set_has_async_exception();
+  inline void clear_has_async_exception();
 
   bool do_critical_native_unlock() const { return (_suspend_flags & _critical_native_unlock) != 0; }
 
-  void set_critical_native_unlock() {
-    set_suspend_flag(_critical_native_unlock);
-  }
-  void clear_critical_native_unlock() {
-    clear_suspend_flag(_critical_native_unlock);
-  }
+  inline void set_critical_native_unlock();
+  inline void clear_critical_native_unlock();
 
   // Support for Unhandled Oop detection
 #ifdef CHECK_UNHANDLED_OOPS
@@ -1074,8 +1048,8 @@
 
   // Suspend/resume support for JavaThread
  private:
-  void set_ext_suspended()       { set_suspend_flag (_ext_suspended);  }
-  void clear_ext_suspended()     { clear_suspend_flag(_ext_suspended); }
+  inline void set_ext_suspended();
+  inline void clear_ext_suspended();
 
  public:
   void java_suspend();
@@ -1123,11 +1097,11 @@
   // via the appropriate -XX options.
   bool wait_for_ext_suspend_completion(int count, int delay, uint32_t *bits);
 
-  void set_external_suspend()     { set_suspend_flag  (_external_suspend); }
-  void clear_external_suspend()   { clear_suspend_flag(_external_suspend); }
+  inline void set_external_suspend();
+  inline void clear_external_suspend();
 
-  void set_deopt_suspend()        { set_suspend_flag  (_deopt_suspend); }
-  void clear_deopt_suspend()      { clear_suspend_flag(_deopt_suspend); }
+  inline void set_deopt_suspend();
+  inline void clear_deopt_suspend();
   bool is_deopt_suspend()         { return (_suspend_flags & _deopt_suspend) != 0; }
 
   bool is_external_suspend() const {
@@ -1215,11 +1189,7 @@
 
   void set_pending_unsafe_access_error()          { _special_runtime_exit_condition = _async_unsafe_access_error; }
 
-  void set_pending_async_exception(oop e) {
-    _pending_async_exception = e;
-    _special_runtime_exit_condition = _async_exception;
-    set_has_async_exception();
-  }
+  inline void set_pending_async_exception(oop e);
 
   // Fast-locking support
   bool is_lock_owned(address adr) const;
--- a/hotspot/src/share/vm/runtime/thread.inline.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/thread.inline.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -27,6 +27,7 @@
 
 #define SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
 
+#include "runtime/atomic.inline.hpp"
 #include "runtime/thread.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "thread_linux.inline.hpp"
@@ -46,6 +47,40 @@
 
 #undef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
 
+inline void Thread::set_suspend_flag(SuspendFlags f) {
+  assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
+  uint32_t flags;
+  do {
+    flags = _suspend_flags;
+  }
+  while (Atomic::cmpxchg((jint)(flags | f),
+                         (volatile jint*)&_suspend_flags,
+                         (jint)flags) != (jint)flags);
+}
+inline void Thread::clear_suspend_flag(SuspendFlags f) {
+  assert(sizeof(jint) == sizeof(_suspend_flags), "size mismatch");
+  uint32_t flags;
+  do {
+    flags = _suspend_flags;
+  }
+  while (Atomic::cmpxchg((jint)(flags & ~f),
+                         (volatile jint*)&_suspend_flags,
+                         (jint)flags) != (jint)flags);
+}
+
+inline void Thread::set_has_async_exception() {
+  set_suspend_flag(_has_async_exception);
+}
+inline void Thread::clear_has_async_exception() {
+  clear_suspend_flag(_has_async_exception);
+}
+inline void Thread::set_critical_native_unlock() {
+  set_suspend_flag(_critical_native_unlock);
+}
+inline void Thread::clear_critical_native_unlock() {
+  clear_suspend_flag(_critical_native_unlock);
+}
+
 inline jlong Thread::cooked_allocated_bytes() {
   jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
   if (UseTLAB) {
@@ -59,6 +94,33 @@
   return allocated_bytes;
 }
 
+inline void JavaThread::set_ext_suspended() {
+  set_suspend_flag (_ext_suspended);
+}
+inline void JavaThread::clear_ext_suspended() {
+  clear_suspend_flag(_ext_suspended);
+}
+
+inline void JavaThread::set_external_suspend() {
+  set_suspend_flag(_external_suspend);
+}
+inline void JavaThread::clear_external_suspend() {
+  clear_suspend_flag(_external_suspend);
+}
+
+inline void JavaThread::set_deopt_suspend() {
+  set_suspend_flag(_deopt_suspend);
+}
+inline void JavaThread::clear_deopt_suspend() {
+  clear_suspend_flag(_deopt_suspend);
+}
+
+inline void JavaThread::set_pending_async_exception(oop e) {
+  _pending_async_exception = e;
+  _special_runtime_exit_condition = _async_exception;
+  set_has_async_exception();
+}
+
 #ifdef PPC64
 inline JavaThreadState JavaThread::thread_state() const    {
   return (JavaThreadState) OrderAccess::load_acquire((volatile jint*)&_thread_state);
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -104,6 +104,7 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/hashtable.hpp"
 #include "utilities/macros.hpp"
+
 #ifdef TARGET_ARCH_x86
 # include "vmStructs_x86.hpp"
 #endif
@@ -168,6 +169,11 @@
 #include "gc_implementation/parallelScavenge/vmStructs_parallelgc.hpp"
 #include "gc_implementation/g1/vmStructs_g1.hpp"
 #endif // INCLUDE_ALL_GCS
+
+#if INCLUDE_TRACE
+ #include "runtime/vmStructs_trace.hpp"
+#endif
+
 #ifdef COMPILER2
 #include "opto/addnode.hpp"
 #include "opto/block.hpp"
@@ -1390,6 +1396,8 @@
   /* unsigned short on Win32 */                                           \
   declare_unsigned_integer_type(u1)                                       \
   declare_unsigned_integer_type(u2)                                       \
+  declare_unsigned_integer_type(u4)                                       \
+  declare_unsigned_integer_type(u8)                                       \
   declare_unsigned_integer_type(unsigned)                                 \
                                                                           \
   /*****************************/                                         \
@@ -2923,6 +2931,11 @@
                 GENERATE_STATIC_VM_STRUCT_ENTRY)
 #endif // INCLUDE_ALL_GCS
 
+#if INCLUDE_TRACE
+  VM_STRUCTS_TRACE(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+                GENERATE_STATIC_VM_STRUCT_ENTRY)
+#endif
+
   VM_STRUCTS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
                  GENERATE_STATIC_VM_STRUCT_ENTRY,
                  GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
@@ -2968,6 +2981,11 @@
               GENERATE_TOPLEVEL_VM_TYPE_ENTRY)
 #endif // INCLUDE_ALL_GCS
 
+#if INCLUDE_TRACE
+  VM_TYPES_TRACE(GENERATE_VM_TYPE_ENTRY,
+              GENERATE_TOPLEVEL_VM_TYPE_ENTRY)
+#endif
+
   VM_TYPES_CPU(GENERATE_VM_TYPE_ENTRY,
                GENERATE_TOPLEVEL_VM_TYPE_ENTRY,
                GENERATE_OOP_VM_TYPE_ENTRY,
@@ -3003,6 +3021,10 @@
   VM_INT_CONSTANTS_PARNEW(GENERATE_VM_INT_CONSTANT_ENTRY)
 #endif // INCLUDE_ALL_GCS
 
+#if INCLUDE_TRACE
+  VM_INT_CONSTANTS_TRACE(GENERATE_VM_INT_CONSTANT_ENTRY)
+#endif
+
   VM_INT_CONSTANTS_CPU(GENERATE_VM_INT_CONSTANT_ENTRY,
                        GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
                        GENERATE_C1_VM_INT_CONSTANT_ENTRY,
@@ -3065,8 +3087,14 @@
 
   VM_STRUCTS_G1(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
                 CHECK_STATIC_VM_STRUCT_ENTRY);
+
 #endif // INCLUDE_ALL_GCS
 
+#if INCLUDE_TRACE
+  VM_STRUCTS_TRACE(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
+                CHECK_STATIC_VM_STRUCT_ENTRY);
+#endif
+
   VM_STRUCTS_CPU(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
                  CHECK_STATIC_VM_STRUCT_ENTRY,
                  CHECK_NO_OP,
@@ -3105,8 +3133,14 @@
 
   VM_TYPES_G1(CHECK_VM_TYPE_ENTRY,
               CHECK_SINGLE_ARG_VM_TYPE_NO_OP);
+
 #endif // INCLUDE_ALL_GCS
 
+#if INCLUDE_TRACE
+  VM_TYPES_TRACE(CHECK_VM_TYPE_ENTRY,
+              CHECK_SINGLE_ARG_VM_TYPE_NO_OP);
+#endif
+
   VM_TYPES_CPU(CHECK_VM_TYPE_ENTRY,
                CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
                CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
@@ -3169,6 +3203,12 @@
   debug_only(VM_STRUCTS_G1(ENSURE_FIELD_TYPE_PRESENT,
                            ENSURE_FIELD_TYPE_PRESENT));
 #endif // INCLUDE_ALL_GCS
+
+#if INCLUDE_TRACE
+  debug_only(VM_STRUCTS_TRACE(ENSURE_FIELD_TYPE_PRESENT,
+                           ENSURE_FIELD_TYPE_PRESENT));
+#endif
+
   debug_only(VM_STRUCTS_CPU(ENSURE_FIELD_TYPE_PRESENT,
                             ENSURE_FIELD_TYPE_PRESENT,
                             CHECK_NO_OP,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/runtime/vmStructs_trace.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_RUNTIME_VMSTRUCTS_TRACE_HPP
+#define SHARE_VM_RUNTIME_VMSTRUCTS_TRACE_HPP
+
+#define VM_INT_CONSTANTS_TRACE(a)
+
+#define VM_STRUCTS_TRACE(a, b)
+
+#define VM_TYPES_TRACE(a, b)
+
+
+#endif // SHARE_VM_RUNTIME_VMSTRUCTS_TRACE_HPP
--- a/hotspot/src/share/vm/runtime/vm_version.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -72,14 +72,16 @@
 #ifndef JRE_RELEASE_VERSION
   #error JRE_RELEASE_VERSION must be defined
 #endif
-#ifndef HOTSPOT_BUILD_TARGET
-  #error HOTSPOT_BUILD_TARGET must be defined
-#endif
 
-#ifdef PRODUCT
+// NOTE: Builds within Visual Studio do not define the build target in
+//       HOTSPOT_RELEASE_VERSION, so it must be done here
+#if defined(VISUAL_STUDIO_BUILD) && !defined(PRODUCT)
+  #ifndef HOTSPOT_BUILD_TARGET
+    #error HOTSPOT_BUILD_TARGET must be defined
+  #endif
+  #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
+#else
   #define VM_RELEASE HOTSPOT_RELEASE_VERSION
-#else
-  #define VM_RELEASE HOTSPOT_RELEASE_VERSION "-" HOTSPOT_BUILD_TARGET
 #endif
 
 // HOTSPOT_RELEASE_VERSION follows the JDK release version naming convention
--- a/hotspot/src/share/vm/services/memPtr.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/services/memPtr.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "services/memPtr.hpp"
 #include "services/memTracker.hpp"
 
--- a/hotspot/src/share/vm/services/memPtr.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/services/memPtr.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -26,7 +26,6 @@
 #define SHARE_VM_SERVICES_MEM_PTR_HPP
 
 #include "memory/allocation.hpp"
-#include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "runtime/safepoint.hpp"
 
--- a/hotspot/src/share/vm/services/memRecorder.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/services/memRecorder.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "services/memBaseline.hpp"
 #include "services/memRecorder.hpp"
 #include "services/memPtr.hpp"
--- a/hotspot/src/share/vm/services/memTracker.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/services/memTracker.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,7 +24,7 @@
 #include "precompiled.hpp"
 
 #include "oops/instanceKlass.hpp"
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/safepoint.hpp"
--- a/hotspot/src/share/vm/services/memTracker.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/services/memTracker.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -481,17 +481,9 @@
     if (_slowdown_calling_thread && thr != _worker_thread) {
 #ifdef _WINDOWS
       // On Windows, os::NakedYield() does not work as well
-      // as os::yield_all()
-      os::yield_all();
+      // as short sleep.
+      os::naked_short_sleep(1);
 #else
-     // On Solaris, os::yield_all() depends on os::sleep()
-     // which requires JavaTherad in _thread_in_vm state.
-     // Transits thread to _thread_in_vm state can be dangerous
-     // if caller holds lock, as it may deadlock with Threads_lock.
-     // So use NaKedYield instead.
-     //
-     // Linux and BSD, NakedYield() and yield_all() implementations
-     // are the same.
       os::NakedYield();
 #endif
     }
--- a/hotspot/src/share/vm/services/threadService.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/services/threadService.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -29,6 +29,7 @@
 #include "memory/oopFactory.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/thread.hpp"
--- a/hotspot/src/share/vm/shark/sharkRuntime.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/shark/sharkRuntime.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/thread.hpp"
--- a/hotspot/src/share/vm/trace/tracetypes.xml	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/trace/tracetypes.xml	Wed Jul 05 19:50:06 2017 +0200
@@ -98,6 +98,7 @@
       <value type="SYMBOL" field="name" label="Name"/>
       <value type="SYMBOL" field="signature" label="Signature"/>
       <value type="SHORT" field="modifiers" label="Access modifiers"/>
+      <value type="BOOLEAN" field="hidden" label="Hidden"/>
     </content_type>
 
     <content_type id="UTFConstant" hr_name="UTF constant"
--- a/hotspot/src/share/vm/utilities/accessFlags.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/accessFlags.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "utilities/accessFlags.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
--- a/hotspot/src/share/vm/utilities/bitMap.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/bitMap.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "utilities/bitMap.inline.hpp"
 #include "utilities/copy.hpp"
 #ifdef TARGET_OS_FAMILY_linux
--- a/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,7 +25,7 @@
 #ifndef SHARE_VM_UTILITIES_BITMAP_INLINE_HPP
 #define SHARE_VM_UTILITIES_BITMAP_INLINE_HPP
 
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "utilities/bitMap.hpp"
 
 #ifdef ASSERT
--- a/hotspot/src/share/vm/utilities/debug.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -39,6 +39,7 @@
 #include "oops/oop.inline.hpp"
 #include "prims/privilegedStack.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/frame.hpp"
 #include "runtime/java.hpp"
 #include "runtime/sharedRuntime.hpp"
--- a/hotspot/src/share/vm/utilities/histogram.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/histogram.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "utilities/histogram.hpp"
 
 #ifdef ASSERT
--- a/hotspot/src/share/vm/utilities/ostream.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/ostream.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "compiler/compileLog.hpp"
+#include "gc_implementation/shared/gcId.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/arguments.hpp"
 #include "utilities/defaultStream.hpp"
@@ -240,6 +241,14 @@
   return;
 }
 
+void outputStream::gclog_stamp(const GCId& gc_id) {
+  date_stamp(PrintGCDateStamps);
+  stamp(PrintGCTimeStamps);
+  if (PrintGCID) {
+    print("#%u: ", gc_id.id());
+  }
+}
+
 outputStream& outputStream::indent() {
   while (_position < _indentation) sp();
   return *this;
--- a/hotspot/src/share/vm/utilities/ostream.hpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/ostream.hpp	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 #include "memory/allocation.hpp"
 #include "runtime/timer.hpp"
 
+class GCId;
 DEBUG_ONLY(class ResourceMark;)
 
 // Output streams for printing
@@ -107,6 +108,7 @@
    void date_stamp(bool guard) {
      date_stamp(guard, "", ": ");
    }
+   void gclog_stamp(const GCId& gc_id);
 
    // portable printing of 64 bit integers
    void print_jlong(jlong value);
--- a/hotspot/src/share/vm/utilities/taskqueue.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/taskqueue.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/debug.hpp"
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -27,6 +27,7 @@
 #include "gc_interface/collectedHeap.hpp"
 #include "prims/whitebox.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/os.hpp"
--- a/hotspot/src/share/vm/utilities/workgroup.cpp	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "memory/allocation.hpp"
 #include "memory/allocation.inline.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/os.hpp"
 #include "utilities/workgroup.hpp"
 
--- a/hotspot/test/compiler/8009761/Test8009761.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/8009761/Test8009761.java	Wed Jul 05 19:50:06 2017 +0200
@@ -21,11 +21,7 @@
  * questions.
  */
 
-import com.sun.management.HotSpotDiagnosticMXBean;
-import com.sun.management.VMOption;
 import sun.hotspot.WhiteBox;
-import sun.management.ManagementFactoryHelper;
-
 import java.lang.reflect.Method;
 
 /*
@@ -40,6 +36,7 @@
 public class Test8009761 {
 
     private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    private static int COMP_LEVEL_SIMPLE = 1;
     private static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
     private static Method m3 = null;
 
@@ -236,7 +233,7 @@
 
     static public void main(String[] args) {
         // Make sure background compilation is disabled
-        if (backgroundCompilationEnabled()) {
+        if (WHITE_BOX.getBooleanVMFlag("BackgroundCompilation")) {
             throw new RuntimeException("Background compilation enabled");
         }
 
@@ -256,7 +253,11 @@
         c1 = count;
 
         // Force the compilation of m3() that will inline m1()
-        WHITE_BOX.enqueueMethodForCompilation(m3, COMP_LEVEL_FULL_OPTIMIZATION);
+        if(!WHITE_BOX.enqueueMethodForCompilation(m3, COMP_LEVEL_FULL_OPTIMIZATION)) {
+            // C2 compiler not available, compile with C1
+            WHITE_BOX.enqueueMethodForCompilation(m3, COMP_LEVEL_SIMPLE);
+        }
+
         // Because background compilation is disabled, method should now be compiled
         if(!WHITE_BOX.isMethodCompiled(m3)) {
             throw new RuntimeException(m3 + " not compiled");
@@ -278,19 +279,4 @@
             System.out.println("PASSED " + c1);
         }
     }
-
-    /**
-     * Checks if background compilation (-XX:+BackgroundCompilation) is enabled.
-     * @return True if background compilation is enabled, false otherwise
-     */
-    private static boolean backgroundCompilationEnabled() {
-      HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
-      VMOption backgroundCompilation;
-      try {
-          backgroundCompilation = diagnostic.getVMOption("BackgroundCompilation");
-      } catch (IllegalArgumentException e) {
-          return false;
-      }
-      return Boolean.valueOf(backgroundCompilation.getValue());
-    }
 }
--- a/hotspot/test/compiler/ciReplay/TestSA.sh	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/ciReplay/TestSA.sh	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 ##
 ## @test
 ## @bug 8011675
+## @ignore 8032226, 8031978
 ## @summary testing of ciReplay with using generated by SA replay.txt 
 ## @author igor.ignatyev@oracle.com
 ## @run shell TestSA.sh
--- a/hotspot/test/compiler/ciReplay/TestVM.sh	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/ciReplay/TestVM.sh	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 ##
 ## @test
 ## @bug 8011675
+## @ignore 8031978
 ## @summary testing of ciReplay with using generated by VM replay.txt 
 ## @author igor.ignatyev@oracle.com
 ## @run shell TestVM.sh
--- a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 ##
 ## @test
 ## @bug 8011675
+## @ignore 8031978
 ## @summary testing of ciReplay with using generated by VM replay.txt w/o comp_level
 ## @author igor.ignatyev@oracle.com
 ## @run shell TestVM_no_comp_level.sh
--- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 
 /**
  * @test NonTieredLevelsTest
+ * @ignore 8046268
  * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
  * @build NonTieredLevelsTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/tiered/TieredLevelsTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,6 +23,7 @@
 
 /**
  * @test TieredLevelsTest
+ * @ignore 8046268
  * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
  * @build TieredLevelsTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 
 /*
  * @test ClearMethodStateTest
+ * @ignore 8046268
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /testlibrary/whitebox
  * @build ClearMethodStateTest
--- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,6 +23,7 @@
 
 /*
  * @test DeoptimizeAllTest
+ * @ignore 8046268
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /testlibrary/whitebox
  * @build DeoptimizeAllTest
--- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,6 +23,7 @@
 
 /*
  * @test DeoptimizeMethodTest
+ * @ignore 8046268
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /testlibrary/whitebox
  * @build DeoptimizeMethodTest
--- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,6 +23,7 @@
 
 /*
  * @test EnqueueMethodForCompilationTest
+ * @ignore 8046268
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /testlibrary/whitebox
  * @build EnqueueMethodForCompilationTest
--- a/hotspot/test/compiler/whitebox/GetNMethodTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -26,6 +26,7 @@
 
 /*
  * @test GetNMethodTest
+ * @ignore 8046268
  * @bug 8038240
  * @library /testlibrary /testlibrary/whitebox
  * @build GetNMethodTest
--- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,6 +23,7 @@
 
 /*
  * @test MakeMethodNotCompilableTest
+ * @ignore 8046268
  * @bug 8012322 8006683 8007288 8022832
  * @library /testlibrary /testlibrary/whitebox
  * @build MakeMethodNotCompilableTest
--- a/hotspot/test/gc/g1/TestSummarizeRSetStatsTools.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsTools.java	Wed Jul 05 19:50:06 2017 +0200
@@ -88,7 +88,6 @@
         ArrayList<String> finalargs = new ArrayList<String>();
         String[] defaultArgs = new String[] {
             "-XX:+UseG1GC",
-            "-XX:+UseCompressedOops",
             "-Xmn4m",
             "-Xmx20m",
             "-XX:InitiatingHeapOccupancyPercent=100", // we don't want the additional GCs due to initial marking
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/logging/TestGCId.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestGCId
+ * @bug 8043607
+ * @summary Ensure that the GCId is logged
+ * @key gc
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.ProcessTools;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+public class TestGCId {
+  public static void main(String[] args) throws Exception {
+    testGCId("UseParallelGC", "PrintGC");
+    testGCId("UseParallelGC", "PrintGCDetails");
+
+    testGCId("UseG1GC", "PrintGC");
+    testGCId("UseG1GC", "PrintGCDetails");
+
+    testGCId("UseConcMarkSweepGC", "PrintGC");
+    testGCId("UseConcMarkSweepGC", "PrintGCDetails");
+
+    testGCId("UseSerialGC", "PrintGC");
+    testGCId("UseSerialGC", "PrintGCDetails");
+  }
+
+  private static void verifyContainsGCIDs(OutputAnalyzer output) {
+    output.shouldMatch("^#0: \\[");
+    output.shouldMatch("^#1: \\[");
+    output.shouldHaveExitValue(0);
+  }
+
+  private static void verifyContainsNoGCIDs(OutputAnalyzer output) {
+    output.shouldNotMatch("^#[0-9]+: \\[");
+    output.shouldHaveExitValue(0);
+  }
+
+  private static void testGCId(String gcFlag, String logFlag) throws Exception {
+    // GCID logging enabled
+    ProcessBuilder pb_enabled =
+      ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-XX:+" + logFlag, "-Xmx10M", "-XX:+PrintGCID", GCTest.class.getName());
+    verifyContainsGCIDs(new OutputAnalyzer(pb_enabled.start()));
+
+    // GCID logging disabled
+    ProcessBuilder pb_disabled =
+      ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-XX:+" + logFlag, "-Xmx10M", "-XX:-PrintGCID", GCTest.class.getName());
+    verifyContainsNoGCIDs(new OutputAnalyzer(pb_disabled.start()));
+
+    // GCID logging default
+    ProcessBuilder pb_default =
+      ProcessTools.createJavaProcessBuilder("-XX:+" + gcFlag, "-XX:+" + logFlag, "-Xmx10M", GCTest.class.getName());
+    verifyContainsGCIDs(new OutputAnalyzer(pb_default.start()));
+  }
+
+  static class GCTest {
+    private static byte[] garbage;
+    public static void main(String [] args) {
+      System.out.println("Creating garbage");
+      // create 128MB of garbage. This should result in at least one GC
+      for (int i = 0; i < 1024; i++) {
+        garbage = new byte[128 * 1024];
+      }
+      // do a system gc to get one more gc
+      System.gc();
+      System.out.println("Done");
+    }
+  }
+}
--- a/hotspot/test/runtime/8001071/Test8001071.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 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.
- */
-
-import sun.misc.Unsafe;
-import java.lang.reflect.Field;
-
-@SuppressWarnings("sunapi")
-public class Test8001071 {
-    public static Unsafe unsafe;
-
-    static {
-        try {
-            Field f = Unsafe.class.getDeclaredField("theUnsafe");
-            f.setAccessible(true);
-            unsafe = (Unsafe) f.get(null);
-        } catch ( Exception e ) {
-            e.printStackTrace();
-        }
-    }
-
-    public static void main(String args[]) {
-        unsafe.getObject(new Test8001071(), Short.MAX_VALUE);
-    }
-
-}
--- a/hotspot/test/runtime/8001071/Test8001071.sh	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 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.
-
-## @test
-## @bug 8001071
-## @summary Add simple range check into VM implemenation of Unsafe access methods 
-## @compile Test8001071.java
-## @run shell Test8001071.sh
-## @author filipp.zhinkin@oracle.com
-
-VERSION=`${TESTJAVA}/bin/java ${TESTVMOPTS} -version 2>&1`
-
-if [ -n "`echo $VERSION | grep debug`" -o -n "`echo $VERSION | grep jvmg`" ]; then
-        echo "Build type check passed"
-        echo "Continue testing"
-else
-        echo "Fastdebug build is required for this test"
-        exit 0
-fi
-
-${TESTJAVA}/bin/java -cp ${TESTCLASSES} ${TESTVMOPTS} Test8001071 2>&1
-
-HS_ERR_FILE=hs_err_pid*.log
-
-if [ ! -f $HS_ERR_FILE ]
-then
-    echo "hs_err_pid log file was not found"
-    echo "Test failed"
-    exit 1
-fi
-
-grep "assert(byte_offset < p_size) failed: Unsafe access: offset.*> object's size.*" $HS_ERR_FILE
-
-if [ "0" = "$?" ];
-then
-    echo "Range check assertion failed as expected"
-    echo "Test passed"
-    exit 0
-else
-    echo "Range check assertion was not failed"
-    echo "Test failed"
-    exit 1
-fi
--- a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Wed Jul 05 19:50:06 2017 +0200
@@ -44,8 +44,16 @@
             "-server", "-XX:+UnlockDiagnosticVMOptions",
             "-XX:SharedArchiveFile=./sample.jsa", "-version");
         output = new OutputAnalyzer(pb.start());
-        output.shouldNotContain("sharing");
-        output.shouldHaveExitValue(0);
+        // We asked for server but it could be aliased to something else
+        if (output.getOutput().contains("Server VM")) {
+            // In server case we don't expect to see sharing flag
+            output.shouldNotContain("sharing");
+            output.shouldHaveExitValue(0);
+        }
+        else {
+            System.out.println("Skipping test - no Server VM available");
+            return;
+        }
 
         pb = ProcessTools.createJavaProcessBuilder(
             "-server", "-Xshare:auto", "-XX:+UnlockDiagnosticVMOptions",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/Unsafe/RangeCheck.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8001071
+ * @summary Add simple range check into VM implemenation of Unsafe access methods
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+
+public class RangeCheck {
+
+    public static void main(String args[]) throws Exception {
+        if (!Platform.isDebugBuild()) {
+            System.out.println("Testing assert which requires a debug build. Passing silently.");
+            return;
+        }
+
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                true,
+                "-Xmx32m",
+                "-XX:-TransmitErrorReport",
+                "-XX:-InlineUnsafeOps", // The compiler intrinsics doesn't have the assert
+                DummyClassWithMainRangeCheck.class.getName());
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldMatch("assert\\(byte_offset < p_size\\) failed: Unsafe access: offset \\d+ > object's size \\d+");
+    }
+
+    public static class DummyClassWithMainRangeCheck {
+        public static void main(String args[]) throws Exception {
+            Unsafe unsafe = Utils.getUnsafe();
+            unsafe.getObject(new DummyClassWithMainRangeCheck(), Short.MAX_VALUE);
+        }
+    }
+}
--- a/hotspot/test/runtime/memory/ReadFromNoaccessArea.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/runtime/memory/ReadFromNoaccessArea.java	Wed Jul 05 19:50:06 2017 +0200
@@ -47,6 +47,7 @@
           "-XX:+WhiteBoxAPI",
           "-XX:+UseCompressedOops",
           "-XX:HeapBaseMinAddress=33G",
+          "-Xmx32m",
           DummyClassWithMainTryingToReadFromNoaccessArea.class.getName());
 
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
--- a/hotspot/test/runtime/memory/ReserveMemory.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/hotspot/test/runtime/memory/ReserveMemory.java	Wed Jul 05 19:50:06 2017 +0200
@@ -57,6 +57,7 @@
           "-XX:+UnlockDiagnosticVMOptions",
           "-XX:+WhiteBoxAPI",
           "-XX:-TransmitErrorReport",
+          "-Xmx32m",
           "ReserveMemory",
           "test");
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/verifier/TestANewArray.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
+
+import com.oracle.java.testlibrary.*;
+
+/*
+ * @test
+ * @summary Test that anewarray bytecode is valid only if it specifies 255 or fewer dimensions.
+ * @library /testlibrary
+ * @compile -XDignore.symbol.file TestANewArray.java
+ * @run main/othervm TestANewArray 49
+ * @run main/othervm TestANewArray 50
+ * @run main/othervm TestANewArray 51
+ * @run main/othervm TestANewArray 52
+ */
+
+/*
+ * Testing anewarray instruction with 254, 255 & 264 dimensions to verify JVMS 8,
+ * Section 4.9.1, Static Constraints that states the following:
+ *
+ * "No anewarray instruction may be used to create an array of more than 255 dimensions."
+ *
+ */
+
+public class TestANewArray {
+
+    static String classCName = null; // the generated class name
+
+    static final int test_Dimension_254 = 254; // should always pass
+    static final int test_Dimension_255 = 255; // should always pass, except for cfv 49
+    static final int test_Dimension_264 = 264; // should always fail
+
+    static final String array_Dimension_254 = genArrayDim(test_Dimension_254);
+    static final String array_Dimension_255 = genArrayDim(test_Dimension_255);
+    static final String array_Dimension_264 = genArrayDim(test_Dimension_264);
+
+    public static void main(String... args) throws Exception {
+        int cfv = Integer.parseInt(args[0]);
+
+        // 254 array dimensions
+        byte[] classFile_254 = dumpClassFile(cfv, test_Dimension_254, array_Dimension_254);
+        writeClassFileFromByteArray(classFile_254);
+        System.err.println("Running with cfv: " + cfv + ", test_Dimension_254");
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-verify", "-cp", ".",  classCName);
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("java.lang.VerifyError");
+        output.shouldHaveExitValue(0);
+
+        // 255 array dimensions
+        byte[] classFile_255 = dumpClassFile(cfv, test_Dimension_255, array_Dimension_255);
+        writeClassFileFromByteArray(classFile_255);
+        System.err.println("Running with cfv: " + cfv + ", test_Dimension_255");
+        pb = ProcessTools.createJavaProcessBuilder(true, "-verify", "-cp", ".",  classCName);
+        output = new OutputAnalyzer(pb.start());
+        if (cfv == 49) {
+            // The type-inferencing verifier used for <=49.0 ClassFiles detects an anewarray instruction
+            // with exactly 255 dimensions and incorrectly issues the "Array with too many dimensions" VerifyError.
+            output.shouldContain("Array with too many dimensions");
+            output.shouldHaveExitValue(1);
+        } else {
+            // 255 dimensions should always pass, except for cfv 49
+            output.shouldNotContain("java.lang.VerifyError");
+            output.shouldNotContain("java.lang.ClassFormatError");
+            output.shouldHaveExitValue(0);
+        }
+
+        // 264 array dimensions
+        byte[] classFile_264 = dumpClassFile(cfv, test_Dimension_264, array_Dimension_264);
+        writeClassFileFromByteArray(classFile_264);
+        System.err.println("Running with cfv: " + cfv + ", test_Dimension_264");
+        pb = ProcessTools.createJavaProcessBuilder(true, "-verify", "-cp", ".",  classCName);
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("java.lang.ClassFormatError");
+        output.shouldHaveExitValue(1);
+    }
+
+    public static byte[] dumpClassFile(int cfv, int testDimension264, String arrayDim) throws Exception {
+        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
+        MethodVisitor mv;
+
+        classCName = "classCName_" + cfv + "_" + testDimension264;
+
+        cw.visit(cfv, ACC_PUBLIC + ACC_SUPER, classCName, null, "java/lang/Object", null);
+        {
+            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+        {   // classCName main method
+            mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
+            mv.visitCode();
+            mv.visitIntInsn(BIPUSH, 1);
+            mv.visitTypeInsn(ANEWARRAY, arrayDim); // Test ANEWARRAY bytecode with various dimensions
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(2, 2);
+            mv.visitEnd();
+        }
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    public static FileOutputStream writeClassFileFromByteArray(byte[] classFileByteArray) throws Exception {
+        FileOutputStream fos = new FileOutputStream(new File(classCName + ".class"));
+        fos.write(classFileByteArray);
+        fos.close();
+        return fos;
+    }
+
+    private static String genArrayDim(int testDim) {
+        StringBuilder array_Dimension = new StringBuilder();
+        for (int i = 0; i < testDim; i++)
+        {
+            array_Dimension.append("[");
+        }
+        return array_Dimension.append("Ljava/lang/Object;").toString();
+    }
+}
--- a/jaxp/.hgtags	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxp/.hgtags	Wed Jul 05 19:50:06 2017 +0200
@@ -264,3 +264,4 @@
 f9c82769a6bc2b219a8f01c24afe5c91039267d7 jdk9-b19
 94fd4d9d3a75819644b21e18c8a567fd0e973eaf jdk9-b20
 7eb0ab676ea75cb1dd31c613e77008a7d8cb0af7 jdk9-b21
+82b94ff002c6e007a03bf0f364ca94b381e09135 jdk9-b22
--- a/jaxws/.hgtags	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/.hgtags	Wed Jul 05 19:50:06 2017 +0200
@@ -267,3 +267,4 @@
 7f922a73e8a2c6ce42634238090fce7c6d599541 jdk9-b19
 6a9f8ff45c04a172df446a418c586da6a86564d5 jdk9-b20
 4a099451fd7e17b6cc4772fe9547907576a45b6f jdk9-b21
+7f5e5902cde75fd9335c52f469491f061fe0239e jdk9-b22
--- a/jaxws/src/share/jaxws_classes/com/sun/istack/internal/ByteArrayDataSource.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/istack/internal/ByteArrayDataSource.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -41,9 +41,19 @@
     private final byte[] buf;
     private final int len;
 
+    /**
+     * @param buf input buffer - the byte array isn't being copied; used directly
+     * @param contentType
+     */
     public ByteArrayDataSource(byte[] buf, String contentType) {
         this(buf,buf.length,contentType);
     }
+
+    /**
+     * @param buf input buffer - the byte array isn't being copied; used directly
+     * @param length
+     * @param contentType
+     */
     public ByteArrayDataSource(byte[] buf, int length, String contentType) {
         this.buf = buf;
         this.len = length;
--- a/jaxws/src/share/jaxws_classes/com/sun/istack/internal/XMLStreamReaderToContentHandler.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/istack/internal/XMLStreamReaderToContentHandler.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -91,7 +91,7 @@
         this.saxHandler = saxCore;
         this.eagerQuit = eagerQuit;
         this.fragment = fragment;
-        this.inscopeNamespaces = inscopeNamespaces;
+        this.inscopeNamespaces = inscopeNamespaces.clone();
         assert inscopeNamespaces.length%2 == 0;
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -30,10 +30,10 @@
     Non-existent directory: {0}
 
 VERSION = \
-        schemagen 2.2.9-b140218.1920
+        schemagen 2.2.11-b140528.1207
 
 FULLVERSION = \
-        schemagen full version "2.2.9-b140218.1920"
+        schemagen full version "2.2.11-b140528.1207"
 
 USAGE = \
 Usage: schemagen [-options ...] <java files> \n\
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_de.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_de.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0}
 
-VERSION = schemagen 2.2.9-b140218.1920
+VERSION = schemagen 2.2.11-b140528.1207
 
-FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.9-b140218.1920"
+FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.11-b140528.1207"
 
 USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path>             : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path>            : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path>     : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding>  : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file>       : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version              : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion          : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help                 : Zeigt diese Verwendungsmeldung an
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_es.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_es.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Directorio no existente: {0}
 
-VERSION = schemagen 2.2.9-b140218.1920
+VERSION = schemagen 2.2.11-b140528.1207
 
-FULLVERSION = versi\u00F3n completa de schemagen "2.2.9-b140218.1920"
+FULLVERSION = versi\u00F3n completa de schemagen "2.2.11-b140528.1207"
 
 USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso>             : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso>            : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n>  : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo>       : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version              : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion          : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help                 : muestra este mensaje de sintaxis
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant
 
-VERSION = schemagen 2.2.9-b140218.1920
+VERSION = schemagen 2.2.11-b140528.1207
 
-FULLVERSION = version compl\u00E8te de schemagen "2.2.9-b140218.1920"
+FULLVERSION = version compl\u00E8te de schemagen "2.2.11-b140528.1207"
 
 USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_it.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_it.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Directory non esistente: {0}
 
-VERSION = schemagen 2.2.9-b140218.1920
+VERSION = schemagen 2.2.11-b140528.1207
 
-FULLVERSION = versione completa schemagen "2.2.9-b140218.1920"
+FULLVERSION = versione completa schemagen "2.2.11-b140528.1207"
 
 USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path>             : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path>            : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path>     : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding>  : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file>       : genera il file di episodio per la compilazione separata\n\ \ \ \ -version              : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion          : visualizza le informazioni sulla versione completa\n\ \ \ \ -help                 : visualizza questo messaggio sull'uso
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
 
-VERSION = schemagen 2.2.9-b140218.1920
+VERSION = schemagen 2.2.11-b140528.1207
 
-FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.9-b140218.1920"
+FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.11-b140528.1207"
 
 USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path>             : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path>            : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path>     : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding>  : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file>       : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version              : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion          : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help                 : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0}
 
-VERSION = schemagen 2.2.9-b140218.1920
+VERSION = schemagen 2.2.11-b140528.1207
 
-FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.9-b140218.1920"
+FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.11-b140528.1207"
 
 USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path>             : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path>            : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path>     : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding>  : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file>       : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version              : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion          : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help                 : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0}
 
-VERSION = gera\u00E7\u00E3o do esquema 2.2.9-b140218.1920
+VERSION = gera\u00E7\u00E3o do esquema 2.2.11-b140528.1207
 
-FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.9-b140218.1920"
+FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.11-b140528.1207"
 
 USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path>             : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path>            : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path>     : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding>  : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file>       : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version              : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion          : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help                 : exibir esta mensagem de uso
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0}
 
-VERSION = schemagen 2.2.9-b140218.1920
+VERSION = schemagen 2.2.11-b140528.1207
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.11-b140528.1207"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path>             : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path>            : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path>     : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding>  : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file>       : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version              : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion          : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help                 : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0}
 
-VERSION = schemagen 2.2.9-b140218.1920
+VERSION = schemagen 2.2.11-b140528.1207
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.11-b140528.1207"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path>             : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path>            : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path>     : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding>  : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file>       : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version              : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion          : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help                 : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/version.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/version.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -23,7 +23,7 @@
 # questions.
 #
 
-build-id=2.2.10-b140228.1436
-build-version=JAX-WS RI 2.2.10-b140228.1436
-major-version=2.2.10
-svn-revision=e1d4708e8a2aee1ae9d38313452e14ce4b67851a
+build-id=2.2.11-b140602.1731
+build-version=JAX-WS RI 2.2.11-b140602.1731
+major-version=2.2.11
+svn-revision=a684014c13b34abb8b9613e106f44f59abea206f
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/Driver.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/Driver.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -31,6 +31,8 @@
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Iterator;
 
 import com.sun.codemodel.internal.CodeWriter;
@@ -64,14 +66,12 @@
  */
 public class Driver {
 
+    private static final String SYSTEM_PROXY_PROPERTY = "java.net.useSystemProxies";
+
     public static void main(final String[] args) throws Exception {
         // use the platform default proxy if available.
         // see sun.net.spi.DefaultProxySelector for details.
-        try {
-            System.setProperty("java.net.useSystemProxies","true");
-        } catch (SecurityException e) {
-            // failing to set this property isn't fatal
-        }
+        setupProxies();
 
         if( Util.getSystemProperty(Driver.class,"noThreadSwap")!=null )
             _main(args);    // for the ease of debugging
@@ -103,6 +103,27 @@
         }
     }
 
+    /**
+     * Set useSystemProxies if needed
+     */
+    private static void setupProxies() {
+        Object setProperty = AccessController.doPrivileged(new PrivilegedAction<Object>() {
+            @Override
+            public Object run() {
+                return System.getProperty(SYSTEM_PROXY_PROPERTY);
+            }
+        });
+        if (setProperty == null) {
+            AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                @Override
+                public Void run() {
+                    System.setProperty(SYSTEM_PROXY_PROPERTY, "true");
+                    return null;
+                }
+            });
+        }
+    }
+
     private static void _main( String[] args ) throws Exception {
         try {
             System.exit(run( args, System.out, System.out ));
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -171,20 +171,20 @@
 Driver.FailedToGenerateCode = \
         Failed to produce code.
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
 Driver.FilePrologComment = \
-        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.9-b140218.1920 \n\
+        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11-b140528.1207 \n\
         See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\
         Any modifications to this file will be lost upon recompilation of the source schema. \n\
         Generated on: {0} \n
 
 Driver.Version = \
-        xjc 2.2.9-b140218.1920
+        xjc 2.2.11-b140528.1207
 
 Driver.FullVersion = \
-        xjc full version "2.2.9-b140218.1920"
+        xjc full version "2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_de.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_de.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden.
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.9-b140218.1920 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11-b140528.1207 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
 
-Driver.Version = xjc 2.2.9-b140218.1920
+Driver.Version = xjc 2.2.11-b140528.1207
 
-Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.9-b140218.1920"
+Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_es.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_es.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo.
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.9-b140218.1920 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.11-b140528.1207 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
 
-Driver.Version = xjc 2.2.9-b140218.1920
+Driver.Version = xjc 2.2.11-b140528.1207
 
-Driver.FullVersion = versi\u00F3n completa de xjc "2.2.9-b140218.1920"
+Driver.FullVersion = versi\u00F3n completa de xjc "2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Echec de la production du code.
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.9-b140218.1920 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.11-b140528.1207 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
 
-Driver.Version = xjc 2.2.9-b140218.1920
+Driver.Version = xjc 2.2.11-b140528.1207
 
-Driver.FullVersion = version compl\u00E8te xjc "2.2.9-b140218.1920"
+Driver.FullVersion = version compl\u00E8te xjc "2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_it.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_it.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Produzione del codice non riuscita.
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.9-b140218.1920 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.11-b140528.1207 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
 
-Driver.Version = xjc 2.2.9-b140218.1920
+Driver.Version = xjc 2.2.11-b140528.1207
 
-Driver.FullVersion = versione completa xjc "2.2.9-b140218.1920"
+Driver.FullVersion = versione completa xjc "2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.9-b140218.1920\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.11-b140528.1207\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
 
-Driver.Version = xjc 2.2.9-b140218.1920
+Driver.Version = xjc 2.2.11-b140528.1207
 
-Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.9-b140218.1920"
+Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.9-b140218.1920 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.11-b140528.1207 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
 
-Driver.Version = XJC 2.2.9-b140218.1920
+Driver.Version = XJC 2.2.11-b140528.1207
 
-Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.9-b140218.1920"
+Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo.
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.9-b140218.1920 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.11-b140528.1207 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
 
-Driver.Version = xjc 2.2.9-b140218.1920
+Driver.Version = xjc 2.2.11-b140528.1207
 
-Driver.FullVersion = vers\u00E3o completa de xjc "2.2.9-b140218.1920"
+Driver.FullVersion = vers\u00E3o completa de xjc "2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.9-b140218.1920 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.11-b140528.1207 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
 
-Driver.Version = xjc 2.2.9-b140218.1920
+Driver.Version = xjc 2.2.11-b140528.1207
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc.
 
-# DO NOT localize the 2.2.9-b140218.1920 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.9-b140218.1920 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
+# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11-b140528.1207 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
 
-Driver.Version = xjc 2.2.9-b140218.1920
+Driver.Version = xjc 2.2.11-b140528.1207
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.9-b140218.1920"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.11-b140528.1207"
 
-Driver.BuildID = 2.2.9-b140218.1920
+Driver.BuildID = 2.2.11-b140528.1207
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/Options.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/Options.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -773,7 +773,10 @@
      */
     public void addCatalog(File catalogFile) throws IOException {
         if(entityResolver==null) {
-            CatalogManager.getStaticManager().setIgnoreMissingProperties(true);
+            final CatalogManager staticManager = CatalogManager.getStaticManager();
+            // hack to force initialization so catalog manager system properties take effect
+            staticManager.getVerbosity();
+            staticManager.setIgnoreMissingProperties(true);
             entityResolver = new CatalogResolver(true);
         }
         ((CatalogResolver)entityResolver).getCatalog().parseCatalog(catalogFile.getPath());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages_de.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = JAXP 1.3 DatatypeFactory-Klasse konnte nicht initialisiert werden.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages_es.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = Fallo al inicializar la clase DatatypeFactory de JAXP 1.3.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages_fr.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = Echec de l'initialisation de la classe JAXP 1.3 DatatypeFactory.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages_it.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = Inizializzazione della classe DatatypeFactory di JAXP 1.3 non riuscita.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages_ja.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = JAXP 1.3 DatatypeFactory\u30AF\u30E9\u30B9\u306E\u521D\u671F\u5316\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages_ko.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = JAXP 1.3 DatatypeFactory \uD074\uB798\uC2A4 \uCD08\uAE30\uD654\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages_pt_BR.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = Falha ao inicializar a classe DatatypeFactory de JAXP 1.3.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages_zh_CN.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = \u65E0\u6CD5\u521D\u59CB\u5316 JAXP 1.3 DatatypeFactory \u7C7B\u3002
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/Messages_zh_TW.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,26 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+FAILED_TO_INITIALE_DATATYPE_FACTORY = \u7121\u6CD5\u8D77\u59CB JAXP 1.3 DatatypeFactory \u985E\u5225.
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -90,9 +90,6 @@
 INVALID_XML_ENUM_VALUE = \
     "{0}" is not a valid value for {1}.
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = \
-    Failed to initialize JAXP 1.3 DatatypeFactory class.
-
 NO_IMAGE_WRITER = \
     No javax.imageio.ImageWriter is available for the specified MIME type "{0}"
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_de.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_de.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -69,8 +69,6 @@
 # {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName'
 INVALID_XML_ENUM_VALUE = "{0}" ist kein g\u00FCltiger Wert f\u00FCr {1}.
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = JAXP 1.3 DatatypeFactory-Klasse konnte nicht initialisiert werden.
-
 NO_IMAGE_WRITER = Es ist kein javax.imageio.ImageWriter f\u00FCr den angegebenen MIME-Typ "{0}" verf\u00FCgbar
 
 ILLEGAL_MIME_TYPE = "{0}" ist kein g\u00FCltiger MIME-Typ: {1}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_es.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_es.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -69,8 +69,6 @@
 # {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName'
 INVALID_XML_ENUM_VALUE = "{0}" no es un valor v\u00E1lido para {1}.
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = Fallo al inicializar la clase DatatypeFactory de JAXP 1.3.
-
 NO_IMAGE_WRITER = No hay disponible ning\u00FAn javax.imageio.ImageWriter para el tipo MIME especificado "{0}"
 
 ILLEGAL_MIME_TYPE = "{0}" no es un tipo MIME v\u00E1lido: {1}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_fr.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_fr.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -69,8 +69,6 @@
 # {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName'
 INVALID_XML_ENUM_VALUE = "{0}" n''est pas une valeur valide pour {1}.
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = Echec de l'initialisation de la classe JAXP 1.3 DatatypeFactory.
-
 NO_IMAGE_WRITER = Aucune classe javax.imageio.ImageWriter n''est disponible pour le type MIME "{0}" indiqu\u00E9
 
 ILLEGAL_MIME_TYPE = "{0}" n''est pas un type MIME valide : {1}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_it.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_it.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -69,8 +69,6 @@
 # {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName'
 INVALID_XML_ENUM_VALUE = "{0}" non \u00E8 un valore valido per {1}.
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = Inizializzazione della classe DatatypeFactory di JAXP 1.3 non riuscita.
-
 NO_IMAGE_WRITER = Nessun javax.imageio.ImageWriter disponibile per il tipo MIME specificato "{0}"
 
 ILLEGAL_MIME_TYPE = "{0}" non \u00E8 un tipo MIME valido: {1}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_ja.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_ja.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -69,8 +69,6 @@
 # {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName'
 INVALID_XML_ENUM_VALUE = "{0}"\u306F{1}\u306B\u5BFE\u3059\u308B\u6709\u52B9\u306A\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = JAXP 1.3 DatatypeFactory\u30AF\u30E9\u30B9\u306E\u521D\u671F\u5316\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002
-
 NO_IMAGE_WRITER = \u6307\u5B9A\u3057\u305FMIME \u30BF\u30A4\u30D7"{0}"\u306B\u4F7F\u7528\u3067\u304D\u308Bjavax.imageio.ImageWriter\u304C\u3042\u308A\u307E\u305B\u3093
 
 ILLEGAL_MIME_TYPE = "{0}"\u306F\u6709\u52B9\u306AMIME\u30BF\u30A4\u30D7\u3067\u306F\u3042\u308A\u307E\u305B\u3093: {1}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_ko.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_ko.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -69,8 +69,6 @@
 # {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName'
 INVALID_XML_ENUM_VALUE = "{0}"\uC740(\uB294) {1}\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4.
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = JAXP 1.3 DatatypeFactory \uD074\uB798\uC2A4 \uCD08\uAE30\uD654\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
-
 NO_IMAGE_WRITER = \uC9C0\uC815\uB41C MIME \uC720\uD615 "{0}"\uC5D0 \uC0AC\uC6A9 \uAC00\uB2A5\uD55C javax.imageio.ImageWriter\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.
 
 ILLEGAL_MIME_TYPE = "{0}"\uC740(\uB294) \uC801\uD569\uD55C MIME \uC720\uD615\uC774 \uC544\uB2D8: {1}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_pt_BR.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_pt_BR.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -69,8 +69,6 @@
 # {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName'
 INVALID_XML_ENUM_VALUE = "{0}" n\u00E3o \u00E9 um valor v\u00E1lido para {1}.
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = Falha ao inicializar a classe DatatypeFactory de JAXP 1.3.
-
 NO_IMAGE_WRITER = Nenhum javax.imageio.ImageWriter dispon\u00EDvel para o tipo MIME "{0}" especificado
 
 ILLEGAL_MIME_TYPE = "{0}" n\u00E3o \u00E9 um tipo MIME v\u00E1lido: {1}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_zh_CN.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_zh_CN.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -69,8 +69,6 @@
 # {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName'
 INVALID_XML_ENUM_VALUE = "{0}" \u4E0D\u662F{1}\u7684\u6709\u6548\u503C\u3002
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = \u65E0\u6CD5\u521D\u59CB\u5316 JAXP 1.3 DatatypeFactory \u7C7B\u3002
-
 NO_IMAGE_WRITER = \u6307\u5B9A MIME \u7C7B\u578B "{0}" \u6CA1\u6709\u53EF\u7528\u7684 javax.imageio.ImageWriter
 
 ILLEGAL_MIME_TYPE = "{0}" \u4E0D\u662F\u6709\u6548\u7684 MIME \u7C7B\u578B: {1}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_zh_TW.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/Messages_zh_TW.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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
@@ -69,8 +69,6 @@
 # {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName'
 INVALID_XML_ENUM_VALUE = "{0}" \u4E0D\u662F {1} \u7684\u6709\u6548\u503C.
 
-FAILED_TO_INITIALE_DATATYPE_FACTORY = \u7121\u6CD5\u8D77\u59CB JAXP 1.3 DatatypeFactory \u985E\u5225.
-
 NO_IMAGE_WRITER = \u6307\u5B9A\u7684 MIME \u985E\u578B "{0}" \u6C92\u6709\u53EF\u7528\u7684 javax.imageio.ImageWriter
 
 ILLEGAL_MIME_TYPE = "{0}" \u4E0D\u662F\u6709\u6548\u7684 MIME \u985E\u578B: {1}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -43,6 +43,8 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Collections;
@@ -950,7 +952,13 @@
         m.put(DatatypeConstants.DATETIME,   "%Y-%M-%DT%h:%m:%s"+ "%z");
         m.put(DatatypeConstants.DATE,       "%Y-%M-%D" +"%z");
         m.put(DatatypeConstants.TIME,       "%h:%m:%s"+ "%z");
-        if (System.getProperty(USE_OLD_GMONTH_MAPPING) == null) {
+        final String oldGmonthMappingProperty = AccessController.doPrivileged(new PrivilegedAction<String>() {
+            @Override
+            public String run() {
+                return System.getProperty(USE_OLD_GMONTH_MAPPING);
+            }
+        });
+        if (oldGmonthMappingProperty == null) {
             m.put(DatatypeConstants.GMONTH, "--%M%z");      //  E2-12 Error. http://www.w3.org/2001/05/xmlschema-errata#e2-12
         } else {                                            //  backw. compatibility
             if (logger.isLoggable(Level.FINE)) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -79,19 +79,19 @@
 
         @Override
         public void startElement(UnmarshallingContext.State state, TagName ea) {
-            state.target = new ArrayList();
+            state.setTarget(new ArrayList());
         }
 
         @Override
         public void leaveElement(UnmarshallingContext.State state, TagName ea) {
-            state.target = toArray((List)state.target);
+            state.setTarget(toArray((List)state.getTarget()));
         }
 
         @Override
         public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
             if(ea.matches("","item")) {
-                state.loader = itemLoader;
-                state.receiver = this;
+                state.setLoader(itemLoader);
+                state.setReceiver(this);
             } else {
                 super.childElement(state,ea);
             }
@@ -103,9 +103,9 @@
         }
 
         public void receive(UnmarshallingContext.State state, Object o) {
-            ((List)state.target).add(o);
+            ((List)state.getTarget()).add(o);
         }
-    };
+    }
 
     protected Object toArray( List list ) {
         int len = list.size();
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ElementBeanInfoImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -208,8 +208,8 @@
 
         @Override
         public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
-            state.loader = core;
-            state.intercepter = this;
+            state.setLoader(core);
+            state.setIntercepter(this);
 
             // TODO: make sure there aren't too many duplicate of this code
             // create the object to unmarshal
@@ -231,21 +231,21 @@
             fireBeforeUnmarshal(ElementBeanInfoImpl.this, child, state);
 
             context.recordOuterPeer(child);
-            UnmarshallingContext.State p = state.prev;
-            p.backup = p.target;
-            p.target = child;
+            UnmarshallingContext.State p = state.getPrev();
+            p.setBackup(p.getTarget());
+            p.setTarget(child);
 
             core.startElement(state,ea);
         }
 
         public Object intercept(UnmarshallingContext.State state, Object o) throws SAXException {
-            JAXBElement e = (JAXBElement)state.target;
-            state.target = state.backup;
-            state.backup = null;
+            JAXBElement e = (JAXBElement)state.getTarget();
+            state.setTarget(state.getBackup());
+            state.setBackup(null);
 
-            if (state.nil) {
+            if (state.isNil()) {
                 e.setNil(true);
-                state.nil = false;
+                state.setNil(false);
             }
 
             if(o!=null)
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Messages.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/Messages.java	Wed Jul 05 19:50:06 2017 +0200
@@ -58,7 +58,6 @@
     FAILED_TO_GENERATE_SCHEMA, // 0 args
     ERROR_PROCESSING_SCHEMA, // 0 args
     ILLEGAL_CONTENT, // 2 args
-    FAILED_TO_INITIALE_DATATYPE_FACTORY, // 2 args
     ;
 
     private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName());
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -90,7 +90,7 @@
                 idx = p;
             }
 
-            state.target = toArray(r);
+            state.setTarget(toArray(r));
         }
     };
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -98,7 +98,7 @@
             UnmarshallingContext context = state.getContext();
             context.startScope(1);
             // inherit the target so that our children can access its target
-            state.target = state.prev.target;
+            state.setTarget(state.getPrev().getTarget());
 
             // start it now, so that even if there's no children we can still return empty collection
             context.getScope(0).start(acc,lister);
@@ -116,8 +116,8 @@
                 super.childElement(state,ea);
                 return;
             }
-            state.loader = child.loader;
-            state.receiver = child.receiver;
+            state.setLoader(child.loader);
+            state.setReceiver(child.receiver);
         }
 
         @Override
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Wed Jul 05 19:50:06 2017 +0200
@@ -147,7 +147,7 @@
         public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
             // create or obtain the Map object
             try {
-                BeanT target = (BeanT) state.prev.target;
+                BeanT target = (BeanT) state.getPrev().getTarget();
                 ValueT mapValue = acc.get(target);
                 if(mapValue == null)
                     mapValue = ClassFactory.create(mapImplClass);
@@ -156,11 +156,11 @@
 
                 Stack.push(this.target, target);
                 Stack.push(map, mapValue);
-                state.target = mapValue;
+                state.setTarget(mapValue);
             } catch (AccessorException e) {
                 // recover from error by setting a dummy Map that receives and discards the values
                 handleGenericException(e,true);
-                state.target = new HashMap();
+                state.setTarget(new HashMap());
             }
         }
 
@@ -177,7 +177,7 @@
         @Override
         public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
             if(ea.matches(entryTag)) {
-                state.loader = entryLoader;
+                state.setLoader(entryLoader);
             } else {
                 super.childElement(state,ea);
             }
@@ -197,26 +197,26 @@
     private final Loader entryLoader = new Loader(false) {
         @Override
         public void startElement(UnmarshallingContext.State state, TagName ea) {
-            state.target = new Object[2];  // this is inefficient
+            state.setTarget(new Object[2]);  // this is inefficient
         }
 
         @Override
         public void leaveElement(UnmarshallingContext.State state, TagName ea) {
-            Object[] keyValue = (Object[])state.target;
-            Map map = (Map) state.prev.target;
+            Object[] keyValue = (Object[])state.getTarget();
+            Map map = (Map) state.getPrev().getTarget();
             map.put(keyValue[0],keyValue[1]);
         }
 
         @Override
         public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
             if(ea.matches(keyTag)) {
-                state.loader = keyLoader;
-                state.receiver = keyReceiver;
+                state.setLoader(keyLoader);
+                state.setReceiver(keyReceiver);
                 return;
             }
             if(ea.matches(valueTag)) {
-                state.loader = valueLoader;
-                state.receiver = valueReceiver;
+                state.setLoader(valueLoader);
+                state.setReceiver(valueReceiver);
                 return;
             }
             super.childElement(state,ea);
@@ -234,7 +234,7 @@
             this.index = index;
         }
         public void receive(UnmarshallingContext.State state, Object o) {
-            ((Object[])state.target)[index] = o;
+            ((Object[])state.getTarget())[index] = o;
         }
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -148,7 +148,7 @@
 
     public void receive(UnmarshallingContext.State state, Object o) throws SAXException {
         try {
-            set((BeanT) state.target, (ValueT) o);
+            set((BeanT) state.getTarget(), (ValueT) o);
         } catch (AccessorException e) {
             Loader.handleGenericException(e, true);
         } catch (IllegalAccessError iae) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -44,10 +44,10 @@
     @Override
     public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
         // install the default value, but don't override the one given by the parent loader
-        if(state.elementDefaultValue==null)
-            state.elementDefaultValue = defaultValue;
+        if(state.getElementDefaultValue() == null)
+            state.setElementDefaultValue(defaultValue);
 
-        state.loader = l;
+        state.setLoader(l);
         l.startElement(state,ea);
     }
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -44,8 +44,8 @@
 
     @Override
     public void childElement(UnmarshallingContext.State state, TagName ea) {
-        state.target = null;
+        state.setTarget(null);
         // registering this allows the discarder to process the whole subtree.
-        state.loader = this;
+        state.setLoader(this);
     }
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -99,10 +99,10 @@
     @Override
     public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
         UnmarshallingContext context = state.getContext();
-        if (state.target == null)
-            state.target = new State(context);
+        if (state.getTarget() == null)
+            state.setTarget(new State(context));
 
-        State s = (State) state.target;
+        State s = (State) state.getTarget();
         try {
             s.declarePrefixes(context, context.getNewlyDeclaredPrefixes());
             s.handler.startElement(ea.uri, ea.local, ea.getQname(), ea.atts);
@@ -114,10 +114,10 @@
 
     @Override
     public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
-        state.loader = this;
-        State s = (State) state.prev.target;
+        state.setLoader(this);
+        State s = (State) state.getPrev().getTarget();
         s.depth++;
-        state.target = s;
+        state.setTarget(s);
     }
 
     @Override
@@ -125,7 +125,7 @@
         if(text.length()==0)
             return;     // there's no point in creating an empty Text node in DOM.
         try {
-            State s = (State) state.target;
+            State s = (State) state.getTarget();
             s.handler.characters(text.toString().toCharArray(),0,text.length());
         } catch( SAXException e ) {
             state.getContext().handleError(e);
@@ -135,7 +135,7 @@
 
     @Override
     public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
-        State s = (State) state.target;
+        State s = (State) state.getTarget();
         UnmarshallingContext context = state.getContext();
 
         try {
@@ -157,7 +157,7 @@
             }
 
             // we are done
-            state.target = s.getElement();
+            state.setTarget(s.getElement());
         }
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -47,7 +47,7 @@
 
     public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException {
         try {
-            xacc.parse(state.prev.target,text);
+            xacc.parse(state.getPrev().getTarget(), text);
         } catch (AccessorException e) {
             handleGenericException(e,true);
         } catch (RuntimeException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -55,9 +55,9 @@
 
     @Override
     public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
-        state.loader = selectLoader(state, ea);
-
-        state.loader.startElement(state, ea);
+        final Loader loader = selectLoader(state, ea);
+        state.setLoader(loader);
+        loader.startElement(state, ea);
     }
 
     protected Loader selectLoader(UnmarshallingContext.State state, TagName ea) throws SAXException {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -88,8 +88,8 @@
     public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
         // notify the error, then recover by ignoring the whole element.
         reportUnexpectedChildElement(ea, true);
-        state.loader = Discarder.INSTANCE;
-        state.receiver = null;
+        state.setLoader(Discarder.INSTANCE);
+        state.setReceiver(null);
     }
 
     @SuppressWarnings({"StringEquality"})
@@ -195,10 +195,10 @@
             UnmarshallingContext context = state.getContext();
             Unmarshaller.Listener listener = context.parent.getListener();
             if(beanInfo.hasBeforeUnmarshalMethod()) {
-                beanInfo.invokeBeforeUnmarshalMethod(context.parent, child, state.prev.target);
+                beanInfo.invokeBeforeUnmarshalMethod(context.parent, child, state.getPrev().getTarget());
             }
             if(listener!=null) {
-                listener.beforeUnmarshal(child, state.prev.target);
+                listener.beforeUnmarshal(child, state.getPrev().getTarget());
             }
         }
     }
@@ -215,10 +215,10 @@
             UnmarshallingContext context = state.getContext();
             Unmarshaller.Listener listener = context.parent.getListener();
             if(beanInfo.hasAfterUnmarshalMethod()) {
-                beanInfo.invokeAfterUnmarshalMethod(context.parent, child, state.target);
+                beanInfo.invokeAfterUnmarshalMethod(context.parent, child, state.getTarget());
             }
             if(listener!=null)
-                listener.afterUnmarshal(child, state.target);
+                listener.afterUnmarshal(child, state.getTarget());
         }
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -41,7 +41,7 @@
     @Override
     public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
         Loader loader = selectLoader(state,ea);
-        state.loader = loader;
+        state.setLoader(loader);
         loader.startElement(state,ea);
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -144,17 +144,7 @@
         if( qname==null || qname.length()==0 )
             qname=local;
 
-
-        boolean ignorable = true;
-        StructureLoader sl;
-
-        // not null only if element content is processed (StructureLoader is used)
-        // ugly
-        if((sl = this.context.getStructureLoader()) != null) {
-            ignorable = ((ClassBeanInfoImpl)sl.getBeanInfo()).hasElementOnlyContentModel();
-        }
-
-        processText(ignorable);
+        processText(!context.getCurrentState().isMixed());
 
         tagName.uri = uri;
         tagName.local = local;
@@ -204,7 +194,7 @@
     }
 
     private void processText( boolean ignorable ) throws SAXException {
-        if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer)))
+        if (predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer)))
             next.text(buffer);
         buffer.setLength(0);
     }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -97,7 +97,7 @@
     public void add( Accessor<BeanT,PropT> acc, Lister<BeanT,PropT,ItemT,PackT> lister, ItemT value) throws SAXException{
         try {
             if(!hasStarted()) {
-                this.bean = (BeanT)context.getCurrentState().target;
+                this.bean = (BeanT)context.getCurrentState().getTarget();
                 this.acc = acc;
                 this.lister = lister;
                 this.pack = lister.startPacking(bean,acc);
@@ -121,7 +121,7 @@
     public void start( Accessor<BeanT,PropT> acc, Lister<BeanT,PropT,ItemT,PackT> lister) throws SAXException{
         try {
             if(!hasStarted()) {
-                this.bean = (BeanT)context.getCurrentState().target;
+                this.bean = (BeanT)context.getCurrentState().getTarget();
                 this.acc = acc;
                 this.lister = lister;
                 this.pack = lister.startPacking(bean,acc);
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -172,7 +172,7 @@
 
         context.recordInnerPeer(child);
 
-        state.target = child;
+        state.setTarget(child);
 
         fireBeforeUnmarshal(beanInfo, child, state);
 
@@ -197,7 +197,7 @@
                         String qname = atts.getQName(i);
                         if(atts.getURI(i).equals(WellKnownNamespace.XML_SCHEMA_INSTANCE))
                             continue;   // xsi:* attributes are meant to be processed by us, not by user apps.
-                        Object o = state.target;
+                        Object o = state.getTarget();
                         Map<QName,String> map = attCatchAll.get(o);
                         if(map==null) {
                             // TODO: use  ClassFactory.inferImplClass(sig,knownImplClasses)
@@ -250,8 +250,8 @@
             }
         }
 
-        state.loader = child.loader;
-        state.receiver = child.receiver;
+        state.setLoader(child.loader);
+        state.setReceiver(child.receiver);
     }
 
     @Override
@@ -273,7 +273,7 @@
     @Override
     public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
         state.getContext().endScope(frameSize);
-        fireAfterUnmarshal(beanInfo, state.target, state.prev);
+        fireAfterUnmarshal(beanInfo, state.getTarget(), state.getPrev());
     }
 
     private static final QNameMap<TransducedAccessor> EMPTY = new QNameMap<TransducedAccessor>();
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -51,7 +51,7 @@
 
     public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException {
         try {
-            state.target = xducer.parse(text);
+            state.setTarget(xducer.parse(text));
         } catch (AccessorException e) {
             handleGenericException(e,true);
         } catch (RuntimeException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -198,20 +198,19 @@
         /**
          * Loader that owns this element.
          */
-        public Loader loader;
+        private Loader loader;
         /**
          * Once {@link #loader} is completed, this receiver
          * receives the result.
          */
-        public Receiver receiver;
+        private Receiver receiver;
 
-        public Intercepter intercepter;
-
+        private Intercepter intercepter;
 
         /**
          * Object being unmarshalled by this {@link #loader}.
          */
-        public Object target;
+        private Object target;
 
         /**
          * Hack for making JAXBElement unmarshalling work.
@@ -240,7 +239,7 @@
          * @see ElementBeanInfoImpl.IntercepterLoader#startElement(State, TagName)
          * @see ElementBeanInfoImpl.IntercepterLoader#intercept(State, Object)
          */
-        public Object backup;
+        private Object backup;
 
         /**
          * Number of {@link UnmarshallingContext#nsBind}s declared thus far.
@@ -256,17 +255,22 @@
          * or by a child {@link Loader} when
          * {@link Loader#startElement(State, TagName)} is called.
          */
-        public String elementDefaultValue;
+        private String elementDefaultValue;
 
         /**
          * {@link State} for the parent element
          *
          * {@link State} objects form a doubly linked list.
          */
-        public State prev;
+        private State prev;
         private State next;
 
-        public boolean nil = false;
+        private boolean nil = false;
+
+        /**
+         * specifies that we are working with mixed content
+         */
+        private boolean mixed = false;
 
         /**
          * Gets the context.
@@ -280,6 +284,8 @@
             this.prev = prev;
             if (prev!=null) {
                 prev.next = this;
+                if (prev.mixed) // parent is in mixed mode
+                    this.mixed = true;
             }
         }
 
@@ -289,7 +295,7 @@
             }
             if (next==null) {
                 assert current == this;
-                allocateMoreStates();
+                next = new State(this);
             }
             nil = false;
             State n = next;
@@ -304,11 +310,71 @@
             assert prev!=null;
             loader = null;
             nil = false;
+            mixed = false;
             receiver = null;
             intercepter = null;
             elementDefaultValue = null;
             target = null;
             current = prev;
+            next = null;
+        }
+
+        public boolean isMixed() {
+            return mixed;
+        }
+
+        public Object getTarget() {
+            return target;
+        }
+
+        public void setLoader(Loader loader) {
+            if (loader instanceof StructureLoader) // set mixed mode
+                mixed = !((StructureLoader)loader).getBeanInfo().hasElementOnlyContentModel();
+            this.loader = loader;
+        }
+
+        public void setReceiver(Receiver receiver) {
+            this.receiver = receiver;
+        }
+
+        public State getPrev() {
+            return prev;
+        }
+
+        public void setIntercepter(Intercepter intercepter) {
+            this.intercepter = intercepter;
+        }
+
+        public void setBackup(Object backup) {
+            this.backup = backup;
+        }
+
+        public void setTarget(Object target) {
+            this.target = target;
+        }
+
+        public Object getBackup() {
+            return backup;
+        }
+
+        public boolean isNil() {
+            return nil;
+        }
+
+        public void setNil(boolean nil) {
+            this.nil = nil;
+        }
+
+        public Loader getLoader() {
+            return loader;
+        }
+
+        public String getElementDefaultValue() {
+            return elementDefaultValue;
+        }
+
+        public void setElementDefaultValue(String elementDefaultValue) {
+            this.elementDefaultValue = elementDefaultValue;
         }
     }
 
@@ -348,7 +414,6 @@
         this.parent = _parent;
         this.assoc = assoc;
         this.root = this.current = new State(null);
-        allocateMoreStates();
     }
 
     public void reset(InfosetScanner scanner,boolean isInplaceMode, JaxBeanInfo expectedType, IDResolver idResolver) {
@@ -395,23 +460,6 @@
         return null;
     }
 
-    /**
-     * Allocates a few more {@link State}s.
-     *
-     * Allocating multiple {@link State}s at once allows those objects
-     * to be allocated near each other, which reduces the working set
-     * of CPU. It improves the chance the relevant data is in the cache.
-     */
-    private void allocateMoreStates() {
-        // this method should be used only when we run out of a state.
-        assert current.next==null;
-
-        State s = current;
-        for (int i=0; i<8; i++) {
-            s = new State(s);
-        }
-    }
-
     public void clearStates() {
         State last = current;
         while (last.next != null) last = last.next;
@@ -515,16 +563,15 @@
 
     @Override
     public void text(CharSequence pcdata) throws SAXException {
-        State cur = current;
         pushCoordinator();
         try {
-            if(cur.elementDefaultValue!=null) {
-                if(pcdata.length()==0) {
+            if (current.elementDefaultValue != null) {
+                if (pcdata.length() == 0) {
                     // send the default value into the unmarshaller instead
-                    pcdata = cur.elementDefaultValue;
+                    pcdata = current.elementDefaultValue;
                 }
             }
-            cur.loader.text(cur,pcdata);
+            current.loader.text(current, pcdata);
         } finally {
             popCoordinator();
         }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValuePropertyLoader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -49,18 +49,17 @@
 
     public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException {
         try {
-            xacc.parse(state.target,text);
+            xacc.parse(state.getTarget(),text);
         } catch (AccessorException e) {
             handleGenericException(e,true);
         } catch (RuntimeException e) {
-            if(state.prev != null) {
-                if(state.prev.target instanceof JAXBElement) {
-                    ; // do nothing - issue 601 - don't report exceptions like
-                      // NumberFormatException when unmarshalling "nillable" element
-                      // (I suppose JAXBElement indicates this
-                } else {
+            if(state.getPrev() != null) {
+                if (!(state.getPrev().getTarget() instanceof JAXBElement))
                     handleParseConversionException(state,e);
-                }
+                // else
+                // do nothing - issue 601 - don't report exceptions like
+                // NumberFormatException when unmarshalling "nillable" element
+                // (I suppose JAXBElement indicates this
             } else {
                 handleParseConversionException(state,e);
             }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -62,7 +62,7 @@
                 onNil(state);
                 boolean hasOtherAttributes = (ea.atts.getLength() - 1) > 0;
                 // see issues 6759703 and 565 - need to preserve attributes even if the element is nil; only when the type is stored in JAXBElement
-                if (!(hasOtherAttributes && (state.prev.target instanceof JAXBElement))) {
+                if (!(hasOtherAttributes && (state.getPrev().getTarget() instanceof JAXBElement))) {
                     return Discarder.INSTANCE;
                 }
             }
@@ -96,8 +96,8 @@
         @Override
         protected void onNil(UnmarshallingContext.State state) throws SAXException {
             try {
-                acc.set(state.prev.target,null);
-                state.prev.nil = true;
+                acc.set(state.getPrev().getTarget(),null);
+                state.getPrev().setNil(true);
             } catch (AccessorException e) {
                 handleGenericException(e,true);
             }
@@ -113,7 +113,7 @@
         @Override
         protected void onNil(UnmarshallingContext.State state) {
             // let the receiver add this to the lister
-            state.target = null;
+            state.setTarget(null);
         }
     }
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -61,7 +61,7 @@
             beanInfo = defaultBeanInfo;
 
         Loader loader = beanInfo.getLoader(null,false);
-        state.loader = loader;
+        state.setLoader(loader);
         loader.startElement(state,ea);
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -358,7 +358,7 @@
                 bos.close();
             try {
                 if (decoded != null)
-                    decoded.close();
+                decoded.close();
             } catch (IOException ex) {
                 throw new SOAPException(ex);
             }
@@ -582,8 +582,7 @@
                     mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
                     mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
                     mailMap.addMailcap("application/fastinfoset;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.FastInfosetDataContentHandler");
-                    // this handler seems to be not used according VCS history ...
-                    // mailMap.addMailcap("multipart/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.MultipartDataContentHandler");
+                    //mailMap.addMailcap("multipart/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.MultipartDataContentHandler");
                     mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.ImageDataContentHandler");
                     mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.StringDataContentHandler");
                 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/EnvelopeFactory.java	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 
 package com.sun.xml.internal.messaging.saaj.soap;
 
+import com.sun.xml.internal.messaging.saaj.LazyEnvelopeSource;
 import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl;
 import com.sun.xml.internal.messaging.saaj.util.JAXMStreamSource;
 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
@@ -45,10 +46,6 @@
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stax.StAXSource;
 import javax.xml.transform.stream.StreamSource;
-
-import com.sun.xml.internal.messaging.saaj.LazyEnvelopeSource;
-import com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer;
-
 import java.util.logging.Logger;
 
 /**
@@ -58,8 +55,8 @@
 public class EnvelopeFactory {
 
     protected static final Logger
-            log = Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
-            "com.sun.xml.internal.messaging.saaj.soap.LocalStrings");
+        log = Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
+        "com.sun.xml.internal.messaging.saaj.soap.LocalStrings");
 
     private static ContextClassloaderLocal<ParserPool> parserPool =
             new ContextClassloaderLocal<ParserPool>() {
@@ -72,16 +69,16 @@
     public static Envelope createEnvelope(Source src, SOAPPartImpl soapPart)
         throws SOAPException
     {
-        if (src instanceof JAXMStreamSource) {
-            try {
-                if (!SOAPPartImpl.lazyContentLength) {
-                    ((JAXMStreamSource) src).reset();
+            if (src instanceof JAXMStreamSource) {
+                try {
+                    if (!SOAPPartImpl.lazyContentLength) {
+                        ((JAXMStreamSource) src).reset();
+                    }
+                } catch (java.io.IOException ioe) {
+                    log.severe("SAAJ0515.source.reset.exception");
+                    throw new SOAPExceptionImpl(ioe);
                 }
-            } catch (java.io.IOException ioe) {
-                log.severe("SAAJ0515.source.reset.exception");
-                throw new SOAPExceptionImpl(ioe);
             }
-        }
         if (src instanceof LazyEnvelopeSource) {
           return lazy((LazyEnvelopeSource)src, soapPart);
       }
@@ -93,7 +90,7 @@
     }
 
     private static Envelope lazy(LazyEnvelopeSource src, SOAPPartImpl soapPart) throws SOAPException {
-        try {
+            try {
                 StaxBridge staxBridge = new StaxLazySourceBridge(src, soapPart);
                 staxBridge.bridgeEnvelopeAndHeaders();
             Envelope env = (Envelope) soapPart.getEnvelope();
@@ -144,11 +141,11 @@
             } catch (Exception e) {
                 log.severe("SAAJ0601.util.newSAXParser.exception");
                 throw new SOAPExceptionImpl(
-                        "Couldn't get a SAX parser while constructing a envelope",
-                        e);
+                    "Couldn't get a SAX parser while constructing a envelope",
+                    e);
             }
             InputSource is = SAXSource.sourceToInputSource(src);
-            if (is.getEncoding() == null && soapPart.getSourceCharsetEncoding() != null) {
+            if (is.getEncoding()== null && soapPart.getSourceCharsetEncoding() != null) {
                 is.setEncoding(soapPart.getSourceCharsetEncoding());
             }
             XMLReader rejectFilter;
@@ -157,15 +154,15 @@
             } catch (Exception ex) {
                 log.severe("SAAJ0510.soap.cannot.create.envelope");
                 throw new SOAPExceptionImpl(
-                        "Unable to create envelope from given source: ",
-                        ex);
+                    "Unable to create envelope from given source: ",
+                    ex);
             }
             src = new SAXSource(rejectFilter, is);
         }
 
         try {
             Transformer transformer =
-                    EfficientStreamingTransformer.newTransformer();
+                EfficientStreamingTransformer.newTransformer();
             DOMResult result = new DOMResult(soapPart);
             transformer.transform(src, result);
 
@@ -177,8 +174,8 @@
             }
             log.severe("SAAJ0511.soap.cannot.create.envelope");
             throw new SOAPExceptionImpl(
-                    "Unable to create envelope from given source: ",
-                    ex);
+                "Unable to create envelope from given source: ",
+                ex);
         } finally {
             if (saxParser != null) {
                 parserPool.get().returnParser(saxParser);
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -55,8 +55,6 @@
     static final protected String Body = "Body";
     static final protected String xmlns = "xmlns";
 
-    private boolean isHeaderSeen = false;
-
     public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
         soap = msg;
         this.envURI = uri;
@@ -93,7 +91,6 @@
                     fixPrefix(prefix);
                     return;
                 } else if (Header.equals(ln)) {
-                    isHeaderSeen = true;
                     currentElement = soap.getSOAPHeader();
                     fixPrefix(prefix);
                     return;
@@ -144,21 +141,6 @@
 
     @Override
     public void writeEndDocument() throws XMLStreamException {
-        try {
-            if (!isHeaderSeen) {
-                SOAPElement header = soap.getSOAPHeader();
-                if (header != null) {
-                    String prefixAtHeader = header.getPrefix();
-                    SOAPElement env = getEnvelope();
-                    header.detachNode();
-                    if (prefixAtHeader != null && !prefixAtHeader.equals(env.getPrefix())) {
-                        env.removeNamespaceDeclaration(prefixAtHeader);
-                    }
-                }
-            }
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
     }
 
     @Override
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/Packet.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/Packet.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1388,7 +1388,12 @@
     public ContentType getInternalContentType() {
         Message msg = getInternalMessage();
         if (msg instanceof MessageWritable) {
-            return ((MessageWritable)msg).getContentType();
+            MessageWritable mw = (MessageWritable) msg;
+
+            //bug 18121499 fix
+            mw.setMTOMConfiguration(mtomFeature);
+
+            return mw.getContentType();
         }
         return contentType;
     }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -55,8 +55,6 @@
     static final protected String Body = "Body";
     static final protected String xmlns = "xmlns";
 
-    private boolean isHeaderSeen = false;
-
     public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
         soap = msg;
         this.envURI = uri;
@@ -93,7 +91,6 @@
                     fixPrefix(prefix);
                     return;
                 } else if (Header.equals(ln)) {
-                    isHeaderSeen = true;
                     currentElement = soap.getSOAPHeader();
                     fixPrefix(prefix);
                     return;
@@ -144,21 +141,6 @@
 
     @Override
     public void writeEndDocument() throws XMLStreamException {
-        try {
-            if (!isHeaderSeen) {
-                SOAPElement header = soap.getSOAPHeader();
-                if (header != null) {
-                    String prefixAtHeader = header.getPrefix();
-                    SOAPElement env = getEnvelope();
-                    header.detachNode();
-                    if (prefixAtHeader != null && !prefixAtHeader.equals(env.getPrefix())) {
-                        env.removeNamespaceDeclaration(prefixAtHeader);
-                    }
-                }
-            }
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
     }
 
     @Override
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -58,6 +58,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Constructor;
 import java.util.*;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
@@ -272,7 +273,7 @@
             final Method buildMethod = builder.getClass().getDeclaredMethod("build");
 
             for (Method builderMethod : builder.getClass().getDeclaredMethods()) {
-                if (!builderMethod.equals(buildMethod)) {
+                if (!builderMethod.equals(buildMethod) && !builderMethod.isSynthetic()) {
                     final String methodName = builderMethod.getName();
                     final Method annotationMethod = annotation.annotationType().getDeclaredMethod(methodName);
                     final Object annotationFieldValue = annotationMethod.invoke(annotation);
@@ -291,6 +292,7 @@
                 throw new WebServiceException("Not a WebServiceFeature: " + result);
             }
         } catch (final NoSuchMethodException e) {
+            LOGGER.log(Level.INFO, "Unable to find builder method on webservice feature: " + beanClass.getName(), e);
             return null;
         } catch (final IllegalAccessException e) {
             throw new WebServiceException(e);
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/version.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/version.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -23,7 +23,7 @@
 # questions.
 #
 
-build-id=2.2.10-b140228.1436
-build-version=JAX-WS RI 2.2.10-b140228.1436
-major-version=2.2.10
-svn-revision=e1d4708e8a2aee1ae9d38313452e14ce4b67851a
+build-id=2.2.11-b140602.1731
+build-version=JAX-WS RI 2.2.11-b140602.1731
+major-version=2.2.11
+svn-revision=a684014c13b34abb8b9613e106f44f59abea206f
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XMLReaderComposite.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XMLReaderComposite.java	Wed Jul 05 19:50:06 2017 +0200
@@ -85,7 +85,7 @@
     public XMLReaderComposite(final ElemInfo elem, XMLStreamReader[] wrapees) {
         elemInfo = elem;
         tagInfo = elem.tagInfo;
-        children = wrapees;
+        children = wrapees.clone();
         if (children != null && children.length > 0) {
             payloadIndex = 0;
             payloadReader = children[payloadIndex];
--- a/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRef.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/WebServiceRef.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -123,7 +123,7 @@
     String mappedName() default "";
 
     /**
-     * The service class, alwiays a type extending
+     * The service class, always a type extending
      * <code>javax.xml.ws.Service</code>. This element MUST be specified
      * whenever the type of the reference is a service endpoint interface.
      */
--- a/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Provider.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/javax/xml/ws/spi/Provider.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -29,7 +29,7 @@
 import java.util.List;
 import java.util.Iterator;
 import java.util.Map;
-import java.lang.reflect.Method;
+import java.util.ServiceLoader;
 import javax.xml.namespace.QName;
 import javax.xml.ws.*;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
@@ -50,8 +50,7 @@
      * name of a <code>Provider</code> implementation
      * class.
      */
-    static public final String JAXWSPROVIDER_PROPERTY
-            = "javax.xml.ws.spi.Provider";
+    static public final String JAXWSPROVIDER_PROPERTY = "javax.xml.ws.spi.Provider";
 
     /**
      * A constant representing the name of the default
@@ -62,29 +61,6 @@
             = "com.sun"+".xml.internal.ws.spi.ProviderImpl";
 
     /**
-     * Take advantage of Java SE 6's java.util.ServiceLoader API.
-     * Using reflection so that there is no compile-time dependency on SE 6.
-     */
-    static private final Method loadMethod;
-    static private final Method iteratorMethod;
-    static {
-        Method tLoadMethod = null;
-        Method tIteratorMethod = null;
-        try {
-            Class<?> clazz = Class.forName("java.util.ServiceLoader");
-            tLoadMethod = clazz.getMethod("load", Class.class);
-            tIteratorMethod = clazz.getMethod("iterator");
-        } catch(ClassNotFoundException ce) {
-            // Running on Java SE 5
-        } catch(NoSuchMethodException ne) {
-            // Shouldn't happen
-        }
-        loadMethod = tLoadMethod;
-        iteratorMethod = tIteratorMethod;
-    }
-
-
-    /**
      * Creates a new instance of Provider
      */
     protected Provider() {
@@ -146,25 +122,16 @@
         }
     }
 
-
     private static Provider getProviderUsingServiceLoader() {
-        if (loadMethod != null) {
-            Object loader;
-            try {
-                loader = loadMethod.invoke(null, Provider.class);
-            } catch (Exception e) {
-                throw new WebServiceException("Cannot invoke java.util.ServiceLoader#load()", e);
-            }
-
-            Iterator<Provider> it;
-            try {
-                it = (Iterator<Provider>)iteratorMethod.invoke(loader);
-            } catch(Exception e) {
-                throw new WebServiceException("Cannot invoke java.util.ServiceLoader#iterator()", e);
-            }
-            return it.hasNext() ? it.next() : null;
+        ServiceLoader<Provider> sl;
+        Iterator<Provider> it;
+        try {
+            sl = ServiceLoader.load(Provider.class);
+            it = (Iterator<Provider>)sl.iterator();
+        } catch (Exception e) {
+            throw new WebServiceException("Cannot invoke java.util.ServiceLoader#iterator()", e);
         }
-        return null;
+        return ((it != null) && it.hasNext()) ? it.next() : null;
     }
 
     /**
--- a/jdk/.hgtags	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/.hgtags	Wed Jul 05 19:50:06 2017 +0200
@@ -264,3 +264,4 @@
 27561aede285c25a3e9ed8bf8918234ad3bb81e3 jdk9-b19
 f87c5be90e01a7ffb47947108eb3e0b0b1920880 jdk9-b20
 2df45ac1bf491278f38c12e0dfbeebadb6c54c8c jdk9-b21
+85bcf0f99edc08873614afbe5a5563e13ce13c83 jdk9-b22
--- a/jdk/make/CopyFiles.gmk	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/make/CopyFiles.gmk	Wed Jul 05 19:50:06 2017 +0200
@@ -407,16 +407,11 @@
 
 ##########################################################################################
 
-BLACKLISTED_CERTS_SRC := $(JDK_TOPDIR)/src/share/lib/security/blacklisted.certs
-BLACKLISTED_CERTS_DST := $(JDK_OUTPUTDIR)/lib/security/blacklisted.certs
-
 ifndef OPENJDK
 
   BLACKLIST_SRC := $(JDK_TOPDIR)/src/closed/share/lib/security/blacklist
   BLACKLIST_DST := $(JDK_OUTPUTDIR)/lib/security/blacklist
 
-  BLACKLISTED_CERTS_SRC += $(wildcard $(JDK_TOPDIR)/src/closed/share/lib/security/blacklisted.certs)
-
   TRUSTEDLIBS_SRC := $(JDK_TOPDIR)/src/closed/share/lib/security/trusted.libraries
   TRUSTEDLIBS_DST := $(JDK_OUTPUTDIR)/lib/security/trusted.libraries
 
@@ -432,20 +427,6 @@
 
 endif
 
-$(BLACKLISTED_CERTS_DST): $(BLACKLISTED_CERTS_SRC)
-	$(MKDIR) -p $(@D)
-	$(CAT) $^ | $(SED) '/^$$/d' | $(SORT) | $(UNIQ) > $@.tmp
-	$(GREP) -i Algorithm $@.tmp > $@
-	if [ `$(SED) -n -e "$$=" $@` != 1 ]; then \
-	   $(ECHO) "Different algorithms defined in $^"; \
-	   $(RM) $@ $@.tmp; \
-	   false; \
-	fi
-	$(GREP) -iv Algorithm $@.tmp >> $@
-	$(RM) $@.tmp
-
-COPY_FILES += $(BLACKLISTED_CERTS_DST)
-
 ##########################################################################################
 
 ifndef OPENJDK
--- a/jdk/make/GenerateData.gmk	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/make/GenerateData.gmk	Wed Jul 05 19:50:06 2017 +0200
@@ -50,6 +50,9 @@
 include gendata/GendataHtml32dtd.gmk
 GENDATA += $(GENDATA_HTML32DTD)
 
+include gendata/GendataBlacklistedCerts.gmk
+GENDATA += $(GENDATA_BLACKLISTED_CERTS)
+
 ##########################################################################################
 
 GENDATA_UNINAME := $(JDK_OUTPUTDIR)/classes/java/lang/uniName.dat
--- a/jdk/make/Tools.gmk	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/make/Tools.gmk	Wed Jul 05 19:50:06 2017 +0200
@@ -87,6 +87,9 @@
 TOOL_TZDB = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.tzdb.TzdbZoneRulesCompiler
 
+TOOL_BLACKLISTED_CERTS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+    build.tools.blacklistedcertsconverter.BlacklistedCertsConverter
+
 
 # TODO: There are references to the jdwpgen.jar in jdk/make/netbeans/jdwpgen/build.xml
 # and nbproject/project.properties in the same dir. Needs to be looked at.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/data/blacklistedcertsconverter/blacklisted.certs.pem	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,727 @@
+#! java BlacklistedCertsConverter SHA-256
+
+# The line above must be the first line of the blacklisted.certs.pem
+# file inside src/share/lib/security/. It will be ignored if added in
+# src/closed/share/lib/security/blacklisted.certs.pem.
+
+// Subject: CN=Digisign Server ID (Enrich),
+//          OU=457608-K,
+//          O=Digicert Sdn. Bhd.,
+//          C=MY
+// Issuer:  CN=GTE CyberTrust Global Root,
+//          OU=GTE CyberTrust Solutions, Inc.,
+//          O=GTE Corporation,
+//          C=US
+// Serial:  120001705 (07:27:14:a9)
+-----BEGIN CERTIFICATE-----
+MIIDyzCCAzSgAwIBAgIEBycUqTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV
+UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
+cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
+b2JhbCBSb290MB4XDTA3MDcxNzE1MTc0OFoXDTEyMDcxNzE1MTY1NFowYzELMAkG
+A1UEBhMCTVkxGzAZBgNVBAoTEkRpZ2ljZXJ0IFNkbi4gQmhkLjERMA8GA1UECxMI
+NDU3NjA4LUsxJDAiBgNVBAMTG0RpZ2lzaWduIFNlcnZlciBJRCAoRW5yaWNoKTCB
+nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArahkS02Hx4RZufuQRqCmicDx/tXa
+VII3DZkrRSYK6Fawf8qo9I5HhAGCKeOzarWR8/uVhbxyqGToCkCcxfRxrnt7agfq
+kBRPjYmvlKuyBtQCanuYH1m5Os1U+iDfsioK6bjdaZDAKdNO0JftZszFGUkGf/pe
+LHx7hRsyQt97lSUCAwEAAaOCAXgwggF0MBIGA1UdEwEB/wQIMAYBAf8CAQAwXAYD
+VR0gBFUwUzBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcCARYtaHR0cDovL2N5YmVy
+dHJ1c3Qub21uaXJvb3QuY29tL3JlcG9zaXRvcnkuY2ZtMAcGBWCDSgEBMA4GA1Ud
+DwEB/wQEAwIB5jCBiQYDVR0jBIGBMH+heaR3MHUxCzAJBgNVBAYTAlVTMRgwFgYD
+VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv
+bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv
+b3SCAgGlMEUGA1UdHwQ+MDwwOqA4oDaGNGh0dHA6Ly93d3cucHVibGljLXRydXN0
+LmNvbS9jZ2ktYmluL0NSTC8yMDE4L2NkcC5jcmwwHQYDVR0OBBYEFMYWk04WF+wW
+royUdvOGbcV0boR3MA0GCSqGSIb3DQEBBQUAA4GBAHYAe6Z4K2Ydjl42xqSOBfIj
+knyTZ9P0wAp9iy3Z6tVvGvPhSilaIoRNUC9LDPL/hcJ7VdREgr5trGeOvLQfkpxR
+gBoU9m6rYYgLrRx/90tQUdZlG6ZHcRVesHHzNRTyN71jyNXwk1o0X9g96F33xR7A
+5c8fhiSpPAdmzcHSNmNZ
+-----END CERTIFICATE-----
+
+// Subject: CN=Digisign Server ID - (Enrich),
+//          OU=457608-K,
+//          O=Digicert Sdn. Bhd.,
+//          C=MY
+// Issuer:  CN=Entrust.net Certification Authority (2048)
+//          OU=(c) 1999 Entrust.net Limited,
+//          OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.),
+//          O=Entrust.net
+// Serial:  1184644297 (4c:0e:63:6a)
+-----BEGIN CERTIFICATE-----
+MIIEzjCCA7agAwIBAgIETA5jajANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML
+RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp
+bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5
+IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp
+ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw0xMDA3MTYxNzIzMzdaFw0xNTA3
+MTYxNzUzMzdaMGUxCzAJBgNVBAYTAk1ZMRswGQYDVQQKExJEaWdpY2VydCBTZG4u
+IEJoZC4xETAPBgNVBAsTCDQ1NzYwOC1LMSYwJAYDVQQDEx1EaWdpc2lnbiBTZXJ2
+ZXIgSUQgLSAoRW5yaWNoKTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
+AMWJ5PQNBkCSWccaszXRDkwqM/n4r8qef+65p21g9FTob9Wb8xtjMQRoctE0Foy0
+FyyX3nPF2JAVoBor9cuzSIZE8B2ITM5BQhrv9Qze/kDaOSD3BlU6ap1GwdJvpbLI
+Vz4po5zg6YV3ZuiYpyR+vsBZIOVEb7ZX2L7OwmV3WMZhQdF0BMh/SULFcqlyFu6M
+3RJdtErU0a9Qt9iqdXZorT5dqjBtYairEFs+E78z4K9EnTgiW+9ML6ZxJhUmyiiM
+2fqOjqmiFDXimySItPR/hZ2DTwehthSQNsQ0HI0mYW0Tb3i+6I8nx0uElqOGaAwj
+vgvsjJQAqQSKE5D334VsDLECAwEAAaOCATQwggEwMA4GA1UdDwEB/wQEAwIBBjAS
+BgNVHRMBAf8ECDAGAQH/AgEAMCcGA1UdJQQgMB4GCCsGAQUFBwMBBggrBgEFBQcD
+AgYIKwYBBQUHAwQwMwYIKwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdodHRwOi8v
+b2NzcC5lbnRydXN0Lm5ldDBEBgNVHSAEPTA7MDkGBWCDSgEBMDAwLgYIKwYBBQUH
+AgEWImh0dHA6Ly93d3cuZGlnaWNlcnQuY29tLm15L2Nwcy5odG0wMgYDVR0fBCsw
+KTAnoCWgI4YhaHR0cDovL2NybC5lbnRydXN0Lm5ldC8yMDQ4Y2EuY3JsMBEGA1Ud
+DgQKBAhMTswlKAMpgTAfBgNVHSMEGDAWgBRV5IHREYC+2Im5CKMx+aEkCRa5cDAN
+BgkqhkiG9w0BAQUFAAOCAQEAl0zvSjpJrHL8MCBrtClbp8WVBJD5MtXChWreA6E3
++YkAsFqsVX7bQzX/yQH4Ub7MJsrIaqTEVD4mHucMo82XZ5TdpkLrXM2POXlrM3kh
+Bnn6gkQVmczBtznTRmJ8snDrb84gqj4Zt+l0gpy0pUtNYQA35IfS8hQ6ZHy4qXth
+4JMi59WfPkfmNnagU9gAAzoPtTP+lsrT0oI6Lt3XSOHkp2nMHOmZSufKcEXXCwcO
+mnUb0C+Sb/akB8O9HEumhLZ9qJqp0qcp8QtXaR6XVybsK0Os1EWDBQDp4/BGQAf6
+6rFRc5Mcpd1TETfIKqcVJx20qsx/qjEw/LhFn0gJ7RDixQ==
+-----END CERTIFICATE-----
+
+// Subject: CN=Java Media APIs,
+//          OU=Java Signed Extensions,
+//          OU=Corporate Object Signing,
+//          O=Sun Microsystems Inc
+// Issuer:  CN=Object Signing CA,
+//          OU=Class 2 OnSite Subscriber CA,
+//          OU=VeriSign Trust Network,
+//          O=Sun Microsystems Inc
+// Serial:  6a:8b:99:91:37:59:4f:89:53:e2:97:18:9f:19:1e:4e
+-----BEGIN CERTIFICATE-----
+MIIFdzCCBF+gAwIBAgIQaouZkTdZT4lT4pcYnxkeTjANBgkqhkiG9w0BAQUFADCB
+gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT
+aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj
+cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA5MDUxMjAw
+MDAwMFoXDTEyMDUxMTIzNTk1OVowfTEdMBsGA1UEChQUU3VuIE1pY3Jvc3lzdGVt
+cyBJbmMxITAfBgNVBAsUGENvcnBvcmF0ZSBPYmplY3QgU2lnbmluZzEfMB0GA1UE
+CxQWSmF2YSBTaWduZWQgRXh0ZW5zaW9uczEYMBYGA1UEAxQPSmF2YSBNZWRpYSBB
+UElzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl5blzoKTVE8y4Hpz
+q6E15RZz1bF5HnYEyYqgHkZXnAKedmYCoMzm1XK8s+gQWShLEvGEAvs5yqarx9gE
+nnC21N28aEZgIJMa2/arKxCUkS4pxdGPYGexL9UzSRkUpoBShCZKEGdmX7gfJE2K
+/sd9MFvGV5/yZtWXrADzvm0Kd/9mg1KRv1gfrZIq0TJbupoXPYYqb73AkI9eT2ZD
+q9MdwD4E5+oojsDFXt8GU/D00fUhtXpYwuplU7D667WHYdJhIah0ST6JywyqcLXG
+XSuFTXOgITT2idSHluZVmx3dqJ72u9kPkO4JdJTMDfaK8zgNLaRkiU8Qcj+qhLYH
+ytaqcwIDAQABo4IB6jCCAeYwCQYDVR0TBAIwADAOBgNVHQ8BAf8EBAMCB4AwfwYD
+VR0fBHgwdjB0oHKgcIZuaHR0cDovL29uc2l0ZWNybC52ZXJpc2lnbi5jb20vU3Vu
+TWljcm9zeXN0ZW1zSW5jQ29ycG9yYXRlT2JqZWN0U2lnbmluZ0phdmFTaWduZWRF
+eHRlbnNpb25zQ2xhc3NCL0xhdGVzdENSTC5jcmwwHwYDVR0jBBgwFoAUs0crgn5T
+tHPKuLsZt76BTQeVx+0wHQYDVR0OBBYEFKS32mVx0gNWTeS4ProHEaeSpvvIMDsG
+CCsGAQUFBwEBBC8wLTArBggrBgEFBQcwAYYfaHR0cDovL29uc2l0ZS1vY3NwLnZl
+cmlzaWduLmNvbTCBtQYDVR0gBIGtMIGqMDkGC2CGSAGG+EUBBxcCMCowKAYIKwYB
+BQUHAgEWHGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9ycGEwbQYLYIZIAYb3AIN9
+nD8wXjAnBggrBgEFBQcCARYbaHR0cHM6Ly93d3cuc3VuLmNvbS9wa2kvY3BzMDMG
+CCsGAQUFBwICMCcaJVZhbGlkYXRlZCBGb3IgU3VuIEJ1c2luZXNzIE9wZXJhdGlv
+bnMwEwYDVR0lBAwwCgYIKwYBBQUHAwMwDQYJKoZIhvcNAQEFBQADggEBAAe6BO4W
+3TSNWfezyelJs6kE3HfulT6Bdyz4UUoh9ykXcV8nRwT+kh25I5MdyG2GfkJoADPR
+VhC5DYo13UFpIsTNVjq+hGYe2hML93bN7ad9SxCCyjHUo3yMz2qgBbHZI3VA9ZHA
+aWM4Tx0saMwbcnVvlbuGh+PXvStfypJqYT6lzcdFfjNVX4FI/QQNGhBswMY51tC8
+GTBCL2qhJon0gSCU4zaawDOf7+XxJWirLamYL1Aal1/h2z2sFrvA/1ftxtU3kZ6I
+7De8DyoHeZg7pYGdrj7g+lPhCga/WvEhN152I+aP08YbFcJHYmK05ngl/Ye4c6Bd
+cdrdfbw6QzEUIYY=
+-----END CERTIFICATE-----
+
+// Subject: CN=JavaFX 1.0 Runtime,
+//          OU=Java Signed Extensions,
+//          OU=Corporate Object Signing,
+//          O=Sun Microsystems Inc
+// Issuer:  CN=Object Signing CA,
+//          OU=Class 2 OnSite Subscriber CA,
+//          OU=VeriSign Trust Network,
+//          O=Sun Microsystems Inc
+// Serial:  55:c0:e6:44:59:59:79:9e:d9:26:f1:b0:4a:1e:f0:27
+-----BEGIN CERTIFICATE-----
+MIIFezCCBGOgAwIBAgIQVcDmRFlZeZ7ZJvGwSh7wJzANBgkqhkiG9w0BAQUFADCB
+gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT
+aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj
+cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA4MTAwOTAw
+MDAwMFoXDTExMTAwOTIzNTk1OVowgYAxHTAbBgNVBAoUFFN1biBNaWNyb3N5c3Rl
+bXMgSW5jMSEwHwYDVQQLFBhDb3Jwb3JhdGUgT2JqZWN0IFNpZ25pbmcxHzAdBgNV
+BAsUFkphdmEgU2lnbmVkIEV4dGVuc2lvbnMxGzAZBgNVBAMUEkphdmFGWCAxLjAg
+UnVudGltZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM+WDc6+bu+4
+tmAcS/lBtUc02WOt9QZpVsXg9cG2pu/8bUtmDELa8iiYBVFpIs8DU58HLrGQtCUY
+SIAGOVPsOJoN29UKCDWfY9j5JeVhfhMGqk9DwrWhzgsjy4cpZ1pIp+k/fJ8zT8Ul
+aYLpow1vg3UNddsmwz02tN7cOrMw9WYIG4CRYnY1OrtJSfe2pYzheC4zyvR+aiVl
+nang2OtqikSQsNFOFHsLOJFxngy9LrO8evDSu25VTKI6zlWU6/bMeqtztJPN0VOn
+NyUrJZvkxZ207Jg0T693BGSxNC1n+ihztXogql8950M/pEuUbDjylv5FFvlp6DSB
+dDT2MkutmyMCAwEAAaOCAeowggHmMAkGA1UdEwQCMAAwDgYDVR0PAQH/BAQDAgeA
+MH8GA1UdHwR4MHYwdKByoHCGbmh0dHA6Ly9vbnNpdGVjcmwudmVyaXNpZ24uY29t
+L1N1bk1pY3Jvc3lzdGVtc0luY0NvcnBvcmF0ZU9iamVjdFNpZ25pbmdKYXZhU2ln
+bmVkRXh0ZW5zaW9uc0NsYXNzQi9MYXRlc3RDUkwuY3JsMB8GA1UdIwQYMBaAFLNH
+K4J+U7Rzyri7Gbe+gU0HlcftMB0GA1UdDgQWBBTjgufVi3XJ3gx1ewsA6Rr7BR4Z
+zjA7BggrBgEFBQcBAQQvMC0wKwYIKwYBBQUHMAGGH2h0dHA6Ly9vbnNpdGUtb2Nz
+cC52ZXJpc2lnbi5jb20wgbUGA1UdIASBrTCBqjA5BgtghkgBhvhFAQcXAjAqMCgG
+CCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMG0GC2CGSAGG
+9wCDfZw/MF4wJwYIKwYBBQUHAgEWG2h0dHBzOi8vd3d3LnN1bi5jb20vcGtpL2Nw
+czAzBggrBgEFBQcCAjAnGiVWYWxpZGF0ZWQgRm9yIFN1biBCdXNpbmVzcyBPcGVy
+YXRpb25zMBMGA1UdJQQMMAoGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBQUAA4IBAQAB
+YVJTTVe7rzyTO4jc3zajErOT/COkdQTfNo0eIX1QbNynFieJvwY/jRzUZwjktIFR
+2p4JtbpHGAtKtjOAOTieQ8xdDOoC1djzpE7/AbMvuvlTavtUKT+F7tPdhfXgWXJV
+6Wbt8jryKyk3zZGiEhauIwZUkfjRkEtffEmZWLUd8c8rURJjfC/XHH2oyurscoxc
+CjX29c9ynxSiS/VvQp1an0HvErGh69N48wj7cj8mtZ1yHzd2XCzSSR1OfTPfk0Pt
+yg51p7yJaFiH21PTZegEL6zyVNOYBTKwwIi2OzpwYalD3uvK6e3OKDrfFCOxu17u
+4PveESbrdyrmvLe7IVez
+-----END CERTIFICATE-----
+
+// Subject: CN=JavaFX Runtime,
+//          OU=Java Signed Extensions,
+//          OU=Corporate Object Signing,
+//          O=Sun Microsystems Inc
+// Issuer:  CN=Object Signing CA,
+//          OU=Class 2 OnSite Subscriber CA,
+//          OU=VeriSign Trust Network,
+//          O=Sun Microsystems Inc
+// Serial:  47:f4:55:f1:da:4a:5e:f9:e3:f7:a8:03:62:17:c0:ff
+-----BEGIN CERTIFICATE-----
+MIIFdjCCBF6gAwIBAgIQR/RV8dpKXvnj96gDYhfA/zANBgkqhkiG9w0BAQUFADCB
+gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT
+aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj
+cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA5MDEyOTAw
+MDAwMFoXDTEyMDEyOTIzNTk1OVowfDEdMBsGA1UEChQUU3VuIE1pY3Jvc3lzdGVt
+cyBJbmMxITAfBgNVBAsUGENvcnBvcmF0ZSBPYmplY3QgU2lnbmluZzEfMB0GA1UE
+CxQWSmF2YSBTaWduZWQgRXh0ZW5zaW9uczEXMBUGA1UEAxQOSmF2YUZYIFJ1bnRp
+bWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCIzd0fAk8mI9ONc6RJ
+aGieioK2FLdXEwj8zL3vdGDVmBwyR1zwYkaOIFFgF9IW/8qc4iAYA5sGUY+0g8q3
+5DuYAxfTzBB5KdaYvbuq6GGnoHIWmTirXY+1friFp8lyXSvtuEaGB1VHaBoZchEg
+k+UgeVDA43dHwcT1Ov3DePczJRUes8T/QHzLX+BxUDG43vjyncCEO/AjqLZxXEz2
+xrNbKLcH3lGMJK7hdbfssUfF5BjC38Hn71HauYlA43b2no+2y0Sjulwzez2YPbDC
+0GLR3TnKtA8dqOrnl5t3DniDbfOBNtBE3VOydJO0XW57Ng1HRXD023nm9ECPY2xp
+0N/pAgMBAAGjggHqMIIB5jAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDB/BgNV
+HR8EeDB2MHSgcqBwhm5odHRwOi8vb25zaXRlY3JsLnZlcmlzaWduLmNvbS9TdW5N
+aWNyb3N5c3RlbXNJbmNDb3Jwb3JhdGVPYmplY3RTaWduaW5nSmF2YVNpZ25lZEV4
+dGVuc2lvbnNDbGFzc0IvTGF0ZXN0Q1JMLmNybDAfBgNVHSMEGDAWgBSzRyuCflO0
+c8q4uxm3voFNB5XH7TAdBgNVHQ4EFgQUvOdd0cKPj+Yik/iOBwTdphh5A+gwOwYI
+KwYBBQUHAQEELzAtMCsGCCsGAQUFBzABhh9odHRwOi8vb25zaXRlLW9jc3AudmVy
+aXNpZ24uY29tMIG1BgNVHSAEga0wgaowOQYLYIZIAYb4RQEHFwIwKjAoBggrBgEF
+BQcCARYcaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYTBtBgtghkgBhvcAg32c
+PzBeMCcGCCsGAQUFBwIBFhtodHRwczovL3d3dy5zdW4uY29tL3BraS9jcHMwMwYI
+KwYBBQUHAgIwJxolVmFsaWRhdGVkIEZvciBTdW4gQnVzaW5lc3MgT3BlcmF0aW9u
+czATBgNVHSUEDDAKBggrBgEFBQcDAzANBgkqhkiG9w0BAQUFAAOCAQEAbGcf2NjL
+AI93HG6ny2BbepaZA1a8xa/R6uUc7xV+Qw6MgLwFD4Q4i6LWUztQDvg9l68MM2/i
+Y9LEi1KM4lcNbK5+D+t9x98wXBiuojXhVdp5ZmC03EyEBbriopdBsmXVLDSu/Y3+
+zowOO5xwpMK3dbgsSDs2Vt0UosD3FTcRaD3GNfOhXMp+o1grHNiXF9YgkmdQbPPZ
+DQ2KBhFPCRJXBGvyKOqno/DTg0sQ3crGH/C4/4t7mnQXWldZotmJUZ0ONc9oD+Q1
+JAaguUKqIwn9yZ093ie+JWHbYNid9IIIPXYgtRxmf9a376WBhqhu56uJftBJ7x9g
+eQ7Lot6CSWCiFw==
+-----END CERTIFICATE-----
+
+// Subject: CN=Solaris INTERNAL DEVELOPMENT USE ONLY,
+//          OU=Solaris Cryptographic Framework,
+//          OU=Corporate Object Signing,
+//          O=Sun Microsystems Inc
+// Issuer:  CN=Object Signing CA,
+//          OU=Class 2 OnSite Subscriber CA,
+//          OU=VeriSign Trust Network,
+//          O=Sun Microsystems Inc
+// Serial:  77:29:77:52:6a:19:7b:9a:a6:a2:c7:99:a0:e1:cd:8c
+-----BEGIN CERTIFICATE-----
+MIIFHjCCBAagAwIBAgIQdyl3UmoZe5qmoseZoOHNjDANBgkqhkiG9w0BAQUFADCB
+gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT
+aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj
+cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA3MDEwNDAw
+MDAwMFoXDTEwMDEwMzIzNTk1OVowgZwxHTAbBgNVBAoUFFN1biBNaWNyb3N5c3Rl
+bXMgSW5jMSEwHwYDVQQLFBhDb3Jwb3JhdGUgT2JqZWN0IFNpZ25pbmcxKDAmBgNV
+BAsUH1NvbGFyaXMgQ3J5cHRvZ3JhcGhpYyBGcmFtZXdvcmsxLjAsBgNVBAMUJVNv
+bGFyaXMgSU5URVJOQUwgREVWRUxPUE1FTlQgVVNFIE9OTFkwgZ8wDQYJKoZIhvcN
+AQEBBQADgY0AMIGJAoGBALbNU4hf3mD5ArDI9pjgioAyvV3bjMPRQdCZniIeGJBp
+odFlSEH+Mh64W1DsY8coeZ7FvvGJkx9IpTMJW9k8w1oJK9UNqHyAQfaYjQyXi3xQ
+LJp62EvYdGfDlwOZejEcR/MbzZG+GOPMMvQj5+xyFDvLXNGfQNTnxw2qnBgCJXjj
+AgMBAAGjggH1MIIB8TAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDCBiQYDVR0f
+BIGBMH8wfaB7oHmGd2h0dHA6Ly9vbnNpdGVjcmwudmVyaXNpZ24uY29tL1N1bk1p
+Y3Jvc3lzdGVtc0luY0NvcnBvcmF0ZU9iamVjdFNpZ25pbmdTb2xhcmlzQ3J5cHRv
+Z3JhcGhpY0ZyYW1ld29ya0NsYXNzQi9MYXRlc3RDUkwuY3JsMB8GA1UdIwQYMBaA
+FLNHK4J+U7Rzyri7Gbe+gU0HlcftMB0GA1UdDgQWBBRpfiGYkehTnsIzuN2H6AFb
+VCZG8jA7BggrBgEFBQcBAQQvMC0wKwYIKwYBBQUHMAGGH2h0dHA6Ly9vbnNpdGUt
+b2NzcC52ZXJpc2lnbi5jb20wgbUGA1UdIASBrTCBqjA5BgtghkgBhvhFAQcXAjAq
+MCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMG0GC2CG
+SAGG9wCDfZw/MF4wJwYIKwYBBQUHAgEWG2h0dHBzOi8vd3d3LnN1bi5jb20vcGtp
+L2NwczAzBggrBgEFBQcCAjAnFiVWYWxpZGF0ZWQgRm9yIFN1biBCdXNpbmVzcyBP
+cGVyYXRpb25zMBMGA1UdJQQMMAoGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBQUAA4IB
+AQCG5soy3LFHTFbA8/5SzDRhQoJkHUnOP0t3b6nvX6vZYRp649fje7TQOPRm1pFd
+CZ17J+tggdZwgzTqY4aYpJ00jZaK6pV37q/vgFC/ia6jDs8Q+ly9cEcadBZ5loYg
+cmxp9p57W2MNWx8VA8oFdNtKfF0jUNXbLNtvwGHmgR6YcwLrGN1b6/9Lt9bO3ODl
+FO+ZDwkfQz5ClUVrTx2dGBvKRYFqSG5S8JAfsgYhPvcacUQkA7ExyKvfRXLWVrce
+ZiPpcElbx+819H2sAPvVvparVeAruZGMAtejHZp9NFoowKen5drJp9VxePS4eM49
+3DepB6lKRrNRw66LNQol4ZBz
+-----END CERTIFICATE-----
+
+// Subject: EMAILADDRESS=info@diginotar.nl, CN=DigiNotar Cyber CA,
+//          O=DigiNotar, C=NL
+// Issuer:  CN=GTE CyberTrust Global Root,
+//          OU=GTE CyberTrust Solutions, Inc.,
+//          O=GTE Corporation,
+//          C=US
+// Serial:  120000525 (07:27:10:0D)
+-----BEGIN CERTIFICATE-----
+MIIFWjCCBMOgAwIBAgIEBycQDTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV
+UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
+cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
+b2JhbCBSb290MB4XDTA2MTAwNDEwNTQxMVoXDTExMTAwNDEwNTMxMVowYDELMAkG
+A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy
+IEN5YmVyIENBMSAwHgYJKoZIhvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIw
+DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANLOFQotqF6EZ639vu9Gx8i5z3P8
+9DS5+SxD52ATPXrjss87Z2yQrcC5P4RS8DVC3HTcKDu9UrSnrHJFF8bwieu0qiXy
+XUte0dmHutZ9fPXOMp8QM8WxSrtekTHC0OlBwpFkfglBO9uLCDdqqspS3rU5HsCI
+A6U/i5kTYUO1m4Kz7iBvz6FEouova0CfjytXraFTwoUiaZ2gP1HfC0GRDaXhqKpc
+SQhdvd5wQbEPyWNr0380dAIvNFp4dRxoeoFnivPaQPBgY/SSINcDpj2jHmfEhBtB
+pcmM5r3qSLYFFgizNxJa92E89zhvLpfgb1Y4VNMota0Ubi5LZLUnZbd1JQm2Bz2V
+VgIKgmCyc0XgMyZRdJq51FAc9k1bW1JSE1qmf6cO4ehBVGeYjIfVydNsy9NUkgYJ
+NEH3gW8/nsl8dVWw58Gzd+jDxAA1lUBwEEoF3iW7n1mlZLxHYL9g43aLE1Xd4XR6
+uc8kpmp/3mQiRFhogmoQ+T3lPhu5vfwi9GAEibtVbShV+t6OjRshFNc3izR7Tfay
+shDPM7F9HGKZSMsrbHaWVb8ZDR0fu2WqG46ZtcYokOWCLXhQIJr9eS8kf/CJKWn0
+fc1zvrPtTsHR7VJej/e4142HrbLZG1ES/1az4a80fVykeIgQnp0DxqWqoiRR90kU
+xbHuWUOV36toKDA/AgMBAAGjggGGMIIBgjASBgNVHRMBAf8ECDAGAQH/AgEBMFMG
+A1UdIARMMEowSAYJKwYBBAGxPgEAMDswOQYIKwYBBQUHAgEWLWh0dHA6Ly93d3cu
+cHVibGljLXRydXN0LmNvbS9DUFMvT21uaVJvb3QuaHRtbDAOBgNVHQ8BAf8EBAMC
+AQYwgaAGA1UdIwSBmDCBlYAUpgwdn2H/Bxe1vzhG20Mw1Y6wUgaheaR3MHUxCzAJ
+BgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdU
+RSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVy
+VHJ1c3QgR2xvYmFsIFJvb3SCAgGlMEUGA1UdHwQ+MDwwOqA4oDaGNGh0dHA6Ly93
+d3cucHVibGljLXRydXN0LmNvbS9jZ2ktYmluL0NSTC8yMDE4L2NkcC5jcmwwHQYD
+VR0OBBYEFKv5aN/PSjfXe0WMX3LeQETDZbvCMA0GCSqGSIb3DQEBBQUAA4GBAI9o
+a6VbB7pEZg4cqFwwezPkCiYE/O+eGjjWLqEf0JlHwnVkJP2eOyh2uSYoYZEMbSz4
+BJ98UAHV42mv7xXSRZskCSpmBU8lgcpdvqrBWSeuM46C9990sFWzjvjnN8huqlZE
+9r1TgSOWPbT6MopTZkQloiXGpjwljPDgKAYityZB
+-----END CERTIFICATE-----
+
+// Subject: CN=DigiNotar Cyber CA, O=DigiNotar, C=NL
+// Issuer:  CN=GTE CyberTrust Global Root,
+//          OU=GTE CyberTrust Solutions, Inc.,
+//          O=GTE Corporation,
+//          C=US
+// Serial:  120000505 (07:27:0F:F9)
+-----BEGIN CERTIFICATE-----
+MIIFODCCBKGgAwIBAgIEBycP+TANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV
+UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
+cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
+b2JhbCBSb290MB4XDTA2MDkyMDA5NDUzMloXDTEzMDkyMDA5NDQwNlowPjELMAkG
+A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy
+IEN5YmVyIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0s4VCi2o
+XoRnrf2+70bHyLnPc/z0NLn5LEPnYBM9euOyzztnbJCtwLk/hFLwNULcdNwoO71S
+tKesckUXxvCJ67SqJfJdS17R2Ye61n189c4ynxAzxbFKu16RMcLQ6UHCkWR+CUE7
+24sIN2qqylLetTkewIgDpT+LmRNhQ7WbgrPuIG/PoUSi6i9rQJ+PK1etoVPChSJp
+naA/Ud8LQZENpeGoqlxJCF293nBBsQ/JY2vTfzR0Ai80Wnh1HGh6gWeK89pA8GBj
+9JIg1wOmPaMeZ8SEG0GlyYzmvepItgUWCLM3Elr3YTz3OG8ul+BvVjhU0yi1rRRu
+LktktSdlt3UlCbYHPZVWAgqCYLJzReAzJlF0mrnUUBz2TVtbUlITWqZ/pw7h6EFU
+Z5iMh9XJ02zL01SSBgk0QfeBbz+eyXx1VbDnwbN36MPEADWVQHAQSgXeJbufWaVk
+vEdgv2DjdosTVd3hdHq5zySman/eZCJEWGiCahD5PeU+G7m9/CL0YASJu1VtKFX6
+3o6NGyEU1zeLNHtN9rKyEM8zsX0cYplIyytsdpZVvxkNHR+7Zaobjpm1xiiQ5YIt
+eFAgmv15LyR/8IkpafR9zXO+s+1OwdHtUl6P97jXjYetstkbURL/VrPhrzR9XKR4
+iBCenQPGpaqiJFH3SRTFse5ZQ5Xfq2goMD8CAwEAAaOCAYYwggGCMBIGA1UdEwEB
+/wQIMAYBAf8CAQEwUwYDVR0gBEwwSjBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcC
+ARYtaHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL0NQUy9PbW5pUm9vdC5odG1s
+MA4GA1UdDwEB/wQEAwIBBjCBoAYDVR0jBIGYMIGVgBSmDB2fYf8HF7W/OEbbQzDV
+jrBSBqF5pHcwdTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD0dURSBDb3Jwb3JhdGlv
+bjEnMCUGA1UECxMeR1RFIEN5YmVyVHJ1c3QgU29sdXRpb25zLCBJbmMuMSMwIQYD
+VQQDExpHVEUgQ3liZXJUcnVzdCBHbG9iYWwgUm9vdIICAaUwRQYDVR0fBD4wPDA6
+oDigNoY0aHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL2NnaS1iaW4vQ1JMLzIw
+MTgvY2RwLmNybDAdBgNVHQ4EFgQUq/lo389KN9d7RYxfct5ARMNlu8IwDQYJKoZI
+hvcNAQEFBQADgYEACcpiD427SuDUejUrBi3RKGG2rAH7g0m8rtQvLYauGYOl1h0T
+4he+/jJ06XoUOMqUXvcpAWlxG5Ea/aO7qh3Ke+IW/aGjDvMMX7LhIDGUK16Sdu36
+6bUjpr8KOwOpb1JgVM1f6bcvfKIn/UGDdbYN+3gm87FF6TKVKho1IZXFonU=
+-----END CERTIFICATE-----
+
+// Subject: CN=DigiNotar Cyber CA, O=DigiNotar, C=NL
+// Issuer:  CN=GTE CyberTrust Global Root,
+//          OU=GTE CyberTrust Solutions, Inc.,
+//          O=GTE Corporation,
+//          C=US
+// Serial:  120000515 (07:27:10:03)
+-----BEGIN CERTIFICATE-----
+MIIFODCCBKGgAwIBAgIEBycQAzANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV
+UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
+cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
+b2JhbCBSb290MB4XDTA2MDkyNzEwNTMzMloXDTExMDkyNzEwNTIzMFowPjELMAkG
+A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy
+IEN5YmVyIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0s4VCi2o
+XoRnrf2+70bHyLnPc/z0NLn5LEPnYBM9euOyzztnbJCtwLk/hFLwNULcdNwoO71S
+tKesckUXxvCJ67SqJfJdS17R2Ye61n189c4ynxAzxbFKu16RMcLQ6UHCkWR+CUE7
+24sIN2qqylLetTkewIgDpT+LmRNhQ7WbgrPuIG/PoUSi6i9rQJ+PK1etoVPChSJp
+naA/Ud8LQZENpeGoqlxJCF293nBBsQ/JY2vTfzR0Ai80Wnh1HGh6gWeK89pA8GBj
+9JIg1wOmPaMeZ8SEG0GlyYzmvepItgUWCLM3Elr3YTz3OG8ul+BvVjhU0yi1rRRu
+LktktSdlt3UlCbYHPZVWAgqCYLJzReAzJlF0mrnUUBz2TVtbUlITWqZ/pw7h6EFU
+Z5iMh9XJ02zL01SSBgk0QfeBbz+eyXx1VbDnwbN36MPEADWVQHAQSgXeJbufWaVk
+vEdgv2DjdosTVd3hdHq5zySman/eZCJEWGiCahD5PeU+G7m9/CL0YASJu1VtKFX6
+3o6NGyEU1zeLNHtN9rKyEM8zsX0cYplIyytsdpZVvxkNHR+7Zaobjpm1xiiQ5YIt
+eFAgmv15LyR/8IkpafR9zXO+s+1OwdHtUl6P97jXjYetstkbURL/VrPhrzR9XKR4
+iBCenQPGpaqiJFH3SRTFse5ZQ5Xfq2goMD8CAwEAAaOCAYYwggGCMBIGA1UdEwEB
+/wQIMAYBAf8CAQEwUwYDVR0gBEwwSjBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcC
+ARYtaHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL0NQUy9PbW5pUm9vdC5odG1s
+MA4GA1UdDwEB/wQEAwIBBjCBoAYDVR0jBIGYMIGVgBSmDB2fYf8HF7W/OEbbQzDV
+jrBSBqF5pHcwdTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD0dURSBDb3Jwb3JhdGlv
+bjEnMCUGA1UECxMeR1RFIEN5YmVyVHJ1c3QgU29sdXRpb25zLCBJbmMuMSMwIQYD
+VQQDExpHVEUgQ3liZXJUcnVzdCBHbG9iYWwgUm9vdIICAaUwRQYDVR0fBD4wPDA6
+oDigNoY0aHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL2NnaS1iaW4vQ1JMLzIw
+MTgvY2RwLmNybDAdBgNVHQ4EFgQUq/lo389KN9d7RYxfct5ARMNlu8IwDQYJKoZI
+hvcNAQEFBQADgYEAWcyGZhizJlRP1jjNupZey+yZG6oMDW4Z11boriMHbYPCndBE
+bVh07zmPbZsihOw9w/vm5KbVX5CgxUv4Rhzh/20Faixf3P3bpWg0qgzHVVusNVR/
+P50aKkpdK3hp+QLl56e+lWOddSAINIpmcuyDI1hyuzB+GJEASm9tNU/6rs8=
+-----END CERTIFICATE-----
+
+// Subject: EMAILADDRESS=info@diginotar.nl,
+//          CN=DigiNotar Root CA,
+//          O=DigiNotar, C=NL
+// Issuer:  CN=Entrust.net Secure Server Certification Authority
+//          OU=(c) 1999 Entrust.net Limited,
+//          OU=www.entrust.net/CPS incorp. by ref. (limits liab.),
+//          O=Entrust.net,
+//          C=US,
+// Serial:  1184644297 (46:9C:3C:C9)
+-----BEGIN CERTIFICATE-----
+MIIFSDCCBLGgAwIBAgIERpw8yTANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
+VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
+ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
+KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
+ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA0
+MjYwNTAwMDBaFw0xMzA4MTQyMDEyMzZaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK
+EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI
+hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP
+ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt
+OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx
+hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7
+gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D
+IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T
+BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs
+Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8
+5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf
+DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX
+9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e
+7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj
+ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB
+BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF
+BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD
+VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy
+bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G
+A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob
+BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAI979rBep8tu3TeLunapgsZ0jtXp
+GDFjKWSk87dj1jCyYi+q/GyDyZ6ZQZNRP0sF+6twscq05lClWNy3TROMp7QeuoLO
+G7Utw3OJaswUtp4YglANMRTHEe3g9ltifUXRH5tSuy7u6yi4LD4WTm5ULP6r/g6l
+0CnjXYb0+b1Fmz6U
+-----END CERTIFICATE-----
+
+// Subject: EMAILADDRESS=info@diginotar.nl,
+//          CN=DigiNotar Root CA,
+//          O=DigiNotar, C=NL
+// Issuer:  CN=Entrust.net Secure Server Certification Authority
+//          OU=(c) 1999 Entrust.net Limited,
+//          OU=www.entrust.net/CPS incorp. by ref. (limits liab.),
+//          O=Entrust.net,
+//          C=US,
+// Serial:  1184640175 (46:9C:2C:AF)
+-----BEGIN CERTIFICATE-----
+MIIFSDCCBLGgAwIBAgIERpwsrzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
+VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
+ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
+KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
+ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3
+MjYxNTU3MzlaFw0xMzA4MjYxNjI3MzlaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK
+EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI
+hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP
+ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt
+OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx
+hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7
+gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D
+IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T
+BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs
+Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8
+5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf
+DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX
+9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e
+7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj
+ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB
+BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF
+BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD
+VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy
+bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G
+A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob
+BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAEa6RcDNcEIGUlkDJUY/pWTds4zh
+xbVkp3wSmpwPFhx5fxTyF4HD2L60jl3aqjTB7gPpsL2Pk5QZlNsi3t4UkCV70UOd
+ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP
+ZFdYf+hthc3m6IcJ
+-----END CERTIFICATE-----
+
+// Subject: CN=DigiNotar PKIoverheid CA Organisatie - G2,
+//          O=DigiNotar B.V.,
+//          C=NL
+// Issuer:  CN=Staat der Nederlanden Organisatie CA - G2,
+//          O=Staat der Nederlanden,
+//          C=NL
+// Serial:  20001983 (01:31:34:bf)
+-----BEGIN CERTIFICATE-----
+MIIGnDCCBISgAwIBAgIEATE0vzANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJO
+TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTIwMAYDVQQDDClTdGFh
+dCBkZXIgTmVkZXJsYW5kZW4gT3JnYW5pc2F0aWUgQ0EgLSBHMjAeFw0xMDA1MTIw
+ODUxMzhaFw0yMDAzMjMwOTUwMDRaMFoxCzAJBgNVBAYTAk5MMRcwFQYDVQQKDA5E
+aWdpTm90YXIgQi5WLjEyMDAGA1UEAwwpRGlnaU5vdGFyIFBLSW92ZXJoZWlkIENB
+IE9yZ2FuaXNhdGllIC0gRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
+AQCxExkPJ+Zs1FWGS9DsiYpFkXisR71HK+T8RetPtCZzWzfTw3/2497Xo/gtaMUI
+PkuU1uSHJTZrhLUYdPMoWHMvm2rPvAQe9t7dr/xLqvXbZmIlASWC3vKXWhBu3V2p
+IrEEqSNzOvhxrR3PhETrR9Gvbch8KKvH8jd6dF9fxQIUiqNa4xtsAeNdjtlo1vQJ
+GzLckbUs9SDrjANtJkm4k8SFXdjSm69WaswFM8ygQp40VUSca6DUEtArVM23iQ3l
+9uvo+4UBM096a/GdcjOWDveyhKWlJ8Qn8VFzKXe6Z27+TNy04qGhgS85SY1DOBPO
+0KVcwoc6AGdlQiPxNlkKHaNRyLyjlCox3+M88p0aPASw77EKMBNzttfzo0wBdRSF
+eMDXijlYhVD6LubFvs+LP6+PNtQlCS3SD6xyk/K/i9RQs/kVUJuZ9RTZ+4uRozIm
+JqD43ztggYaDeVsr6xM9KTrBbd29no6H1kquNJcF7hSm9tw4fkrpJFQHPZdoN0Zr
+DceoIa8TVOQJavFNRgrJXfubT73e+7dUy7g4nKc5+2otwHuNq6WnV+xKkoozxeEg
+XHPYkJIrgNUPhhhpfDlPhIa890xb89W0yqDC8DciynlSH1PmqvOQsDvd8ij9rOvF
+BiSgydQvD1j9tZ7sD8+yWdCiBHo4aq5y+73wJWKUCacFCwIDAQABo4IBYTCCAV0w
+SAYDVR0gBEEwPzA9BgRVHSAAMDUwMwYIKwYBBQUHAgEWJ2h0dHA6Ly93d3cuZGln
+aW5vdGFyLm5sL2Nwcy9wa2lvdmVyaGVpZDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
+DwEB/wQEAwIBBjCBhQYDVR0jBH4wfIAUORCLSZJc22ESIM1JnRqO2pxnQLmhXqRc
+MFoxCzAJBgNVBAYTAk5MMR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4x
+KzApBgNVBAMMIlN0YWF0IGRlciBOZWRlcmxhbmRlbiBSb290IENBIC0gRzKCBACY
+lvQwSQYDVR0fBEIwQDA+oDygOoY4aHR0cDovL2NybC5wa2lvdmVyaGVpZC5ubC9E
+b21PcmdhbmlzYXRpZUxhdGVzdENSTC1HMi5jcmwwHQYDVR0OBBYEFLxdlDvZq3sD
+JXNhwtst7vyrj2WhMA0GCSqGSIb3DQEBCwUAA4ICAQCP/C1Mt9kt1R+978v0t2gX
+dZ1O1ffdnPEqJu2forYcA9VTs+wIzzTi48P0tRYvyMO+19NzqwA2+RpKftZj6V5G
+uqW2jhW3oyrYQx3vXcgfgYWzi/f/PPTZ9EYIP5y8HaDZqEzNJVJOCrEg9x/pQ9lU
+RoETmsBedGwqmDLq/He7DaWiMZgifnx859qkrey3LhoZcfhIUNpDjyyE3cFAJ+O1
+8BVOltT4XOOGKUYr1zsH6zh/yIZXl9PvKjPEF1DVZGlrK2tFXl0vF8paTs/D1zk8
+9TufRrmb5w5Jl53W1eMbD+qPAU6aE5RZCgIHSEsaYKt/T+0L2FUNaG9VnGllFULs
+wNzdbKzDFs4LHVabpMTE0i7gD+JEJytQaaTcYuiKISlCbMwAOpZ2m+9AwKRed4Qy
+bCYqOWauXeO5ubIsaB8empADOfCqs6TMSYsYNOk3yXspx4R8b0QVL+xhWQTJRcui
+1lKifH8pktZKxYtCqNT+6tjHhyMY5J16fXNAUpigrm7jBT8FD+Clxm1N7YM3iJzH
+89xCmmq21yFJNnfy7xhPxXDZnunetyuL9Lx+KN8NQMmFXK6dxTH/0FwOtah+8Okv
+uq+IruW10Vilr5xxpykBkINpN4IFuvwJwQhujHg7wzMCgD9EhQgd31VWCK0shS1d
+sQPhrqp0xaTzTro3mHuCuQ==
+-----END CERTIFICATE-----
+
+// Subject: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven,
+//          O=DigiNotar B.V.,
+//          C=NL
+// Issuer:  CN=Staat der Nederlanden Overheid CA
+//          O=Staat der Nederlanden,
+//          C=NL
+// Serial:  20015536 (01:31:69:b0)
+-----BEGIN CERTIFICATE-----
+MIIEiDCCA3CgAwIBAgIEATFpsDANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJO
+TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSowKAYDVQQDEyFTdGFh
+dCBkZXIgTmVkZXJsYW5kZW4gT3ZlcmhlaWQgQ0EwHhcNMDcwNzA1MDg0MjA3WhcN
+MTUwNzI3MDgzOTQ2WjBfMQswCQYDVQQGEwJOTDEXMBUGA1UEChMORGlnaU5vdGFy
+IEIuVi4xNzA1BgNVBAMTLkRpZ2lOb3RhciBQS0lvdmVyaGVpZCBDQSBPdmVyaGVp
+ZCBlbiBCZWRyaWp2ZW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDc
+vdKnTmoKuzuiheF/AK2+tDBomAfNoHrElM9x+Yo35FPrV3bMi+Zs/u6HVcg+uwQ5
+AKeAeKxbT370vbhUuHE7BzFJOZNUfCA7eSuPu2GQfbGs5h+QLp1FAalkLU3DL7nn
+UNVOKlyrdnY3Rtd57EKZ96LspIlw3Dgrh6aqJOadkiQbvvb91C8ZF3rmMgeUVAVT
+Q+lsvK9Hy7zL/b07RBKB8WtLu+20z6slTxjSzAL8o0+1QjPLWc0J3NNQ/aB2jKx+
+ZopC9q0ckvO2+xRG603XLzDgbe5bNr5EdLcgBVeFTegAGaL2DOauocBC36esgl3H
+aLcY5olLmmv6znn58yynAgMBAAGjggFQMIIBTDBIBgNVHSAEQTA/MD0GBFUdIAAw
+NTAzBggrBgEFBQcCARYnaHR0cDovL3d3dy5kaWdpbm90YXIubmwvY3BzL3BraW92
+ZXJoZWlkMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMIGABgNVHSME
+eTB3gBQLhtYPd6NosftkCcOIblwEHFfpPaFZpFcwVTELMAkGA1UEBhMCTkwxHjAc
+BgNVBAoTFVN0YWF0IGRlciBOZWRlcmxhbmRlbjEmMCQGA1UEAxMdU3RhYXQgZGVy
+IE5lZGVybGFuZGVuIFJvb3QgQ0GCBACYmnkwPQYDVR0fBDYwNDAyoDCgLoYsaHR0
+cDovL2NybC5wa2lvdmVyaGVpZC5ubC9Eb21PdkxhdGVzdENSTC5jcmwwHQYDVR0O
+BBYEFEwIyY128ZjHPt881y91DbF2eZfMMA0GCSqGSIb3DQEBBQUAA4IBAQAMlIca
+v03jheLu19hjeQ5Q38aEW9K72fUxCho1l3TfFPoqDz7toOMI9tVOW6+mriXiRWsi
+D7dUKH6S3o0UbNEc5W50BJy37zRERd/Jgx0ZH8Apad+J1T/CsFNt5U4X5HNhIxMm
+cUP9TFnLw98iqiEr2b+VERqKpOKrp11Lbyn1UtHk0hWxi/7wA8+nfemZhzizDXMU
+5HIs4c71rQZIZPrTKbmi2Lv01QulQERDjqC/zlqlUkxk0xcxYczopIro5Ij76eUv
+BjMzm5RmZrGrUDqhCYF0U1onuabSJc/Tw6f/ltAv6uAejVLpGBwgCkegllYOQJBR
+RKwa/fHuhR/3Qlpl
+-----END CERTIFICATE-----
+
+// Subject: CN=DigiNotar PKIoverheid CA Overheid
+//          O=DigiNotar B.V.,
+//          C=NL
+// Issuer:  CN=Staat der Nederlanden Overheid CA
+//          O=Staat der Nederlanden,
+//          C=NL
+// Serial:  20006006 (01:31:44:76)
+-----BEGIN CERTIFICATE-----
+MIIEezCCA2OgAwIBAgIEATFEdjANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJO
+TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSowKAYDVQQDEyFTdGFh
+dCBkZXIgTmVkZXJsYW5kZW4gT3ZlcmhlaWQgQ0EwHhcNMDQwNjI0MDgxOTMyWhcN
+MTAwNjIzMDgxNzM2WjBSMQswCQYDVQQGEwJOTDEXMBUGA1UEChMORGlnaU5vdGFy
+IEIuVi4xKjAoBgNVBAMTIURpZ2lOb3RhciBQS0lvdmVyaGVpZCBDQSBPdmVyaGVp
+ZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANSlrubta5tlOjVCi/gb
+yLCvRqfBjxG8H594VcKHu0WAYc99SPZF9cycj5mw2GyfQvy/WIrGrL4iyNq1gSqR
+0QA/mTXKZIaPqzpDhdm+VvrKkmjrbZfaQxgMSs3ChtBsjcP9Lc0X1zXZ4Q8nBe3k
+BTp+zehINfmbjoEgXLxsMR5RQ6GxzKjuC04PQpbJQgTIakglKaqYcDDZbEscWgPV
+Hgj/2aoHlj6leW/ThHZ+O41jUguEmBLZA3mu3HrCfrHntb5dPt0ihzSx7GtD/SaX
+5HBLxnP189YuqMk5iRA95CtiSdKauvon/xRKRLNgG6XAz0ctSoY7xLDdiBVU5kJd
+FScCAwEAAaOCAVAwggFMMEgGA1UdIARBMD8wPQYEVR0gADA1MDMGCCsGAQUFBwIB
+FidodHRwOi8vd3d3LmRpZ2lub3Rhci5ubC9jcHMvcGtpb3ZlcmhlaWQwDwYDVR0T
+AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgYAGA1UdIwR5MHeAFAuG1g93o2ix
++2QJw4huXAQcV+k9oVmkVzBVMQswCQYDVQQGEwJOTDEeMBwGA1UEChMVU3RhYXQg
+ZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g
+Um9vdCBDQYIEAJiaeTA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnBraW92
+ZXJoZWlkLm5sL0RvbU92TGF0ZXN0Q1JMLmNybDAdBgNVHQ4EFgQUvRaYQh2+kdE9
+wpcl4CjXWOC1f+IwDQYJKoZIhvcNAQEFBQADggEBAGhQsCWLiaN2EOhPAW+JQP6o
+XBOrLv5w6joahzBFVn1BiefzmlMKjibqKYxURRvMAsMkh82/MfL8V0w6ugxl81lu
+i42dcxl9cKSVXKMw4bbBzJ2VQI5HTIABwefeNuy/eX6idVwYdt3ajAH7fUA8Q9Cq
+vr6H8B+8mwoEqTVTEVlCSsC/EXsokYEUr06PPzRudKjDmijgj7zFaIioZNc8hk7g
+ufEgrs/tmcNGylrwRHgCXjCRBt2NHlZ08l7A1AGU8HcHlSbG9Un/2q9kVHUkps0D
+gtUaEK+x6jpAu/R8Ojezu/+ZEcwwjI/KOhG+84+ejFmtyEkrUdsAdEdLf/2dKsw=
+-----END CERTIFICATE-----
+
+// Subject: EMAILADDRESS=info@diginotar.nl,
+//          CN=DigiNotar Services 1024 CA
+//          O=DigiNotar, C=NL
+// Issuer:  CN=Entrust.net Secure Server Certification Authority,
+//          OU=(c) 1999 Entrust.net Limited,
+//          OU=www.entrust.net/CPS incorp. by ref. (limits liab.),
+//          O=Entrust.net,
+//          C=US
+// Serial:  1184640176 (46:9c:2c:b0)
+-----BEGIN CERTIFICATE-----
+MIIDzTCCAzagAwIBAgIERpwssDANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
+VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
+ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
+KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
+ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3
+MjYxNTU5MDBaFw0xMzA4MjYxNjI5MDBaMGgxCzAJBgNVBAYTAk5MMRIwEAYDVQQK
+EwlEaWdpTm90YXIxIzAhBgNVBAMTGkRpZ2lOb3RhciBTZXJ2aWNlcyAxMDI0IENB
+MSAwHgYJKoZIhvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCBnzANBgkqhkiG9w0B
+AQEFAAOBjQAwgYkCgYEA2ptNXTz50eKLxsYIIMXZHkjsZlhneWIrQWP0iY1o2q+4
+lDaLGSSkoJPSmQ+yrS01Tc0vauH5mxkrvAQafi09UmTN8T5nD4ku6PJPrqYIoYX+
+oakJ5sarPkP8r3oDkdqmOaZh7phPGKjTs69mgumfvN1y+QYEvRLZGCTnq5NTi1kC
+AwEAAaOCASYwggEiMBIGA1UdEwEB/wQIMAYBAf8CAQAwJwYDVR0lBCAwHgYIKwYB
+BQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDBDARBgNVHSAECjAIMAYGBFUdIAAwMwYI
+KwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5lbnRydXN0Lm5l
+dDAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3JsLmVudHJ1c3QubmV0L3NlcnZl
+cjEuY3JsMB0GA1UdDgQWBBT+3JRJDG/vXH/G8RKZTxZJrfuCZTALBgNVHQ8EBAMC
+AQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7UISX8+1i0BowGQYJKoZIhvZ9B0EA
+BAwwChsEVjcuMQMCAIEwDQYJKoZIhvcNAQEFBQADgYEAY3RqN6k/lpxmyFisCcnv
+9WWUf6MCxDgxvV0jh+zUVrLJsm7kBQb87PX6iHBZ1O7m3bV6oKNgLwIMq94SXa/w
+NUuqikeRGvWFLELHHe+VQ7NeuJWTpdrFKKqtci0xrZlrbP+MISevrZqRK8fdWMNu
+B8WfedLHjFW/TMcnXlEWKz4=
+-----END CERTIFICATE-----
+
+// Subject: CN=Buster Paper Comercial Ltda,
+//          O=Buster Paper Comercial Ltda,
+//          L=S?o Jos? Dos Campos,
+//          ST=S?o Paulo,
+//          C=BR
+// Issuer:  CN=DigiCert Assured ID Code Signing CA-1,
+//          OU=www.digicert.com,
+//          O=DigiCert Inc,
+//          C=US
+// Serial:  07:b4:4c:db:ff:fb:78:de:05:f4:26:16:72:a6:73:12
+-----BEGIN CERTIFICATE-----
+MIIGwzCCBaugAwIBAgIQB7RM2//7eN4F9CYWcqZzEjANBgkqhkiG9w0BAQUFADBv
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv
+ZGUgU2lnbmluZyBDQS0xMB4XDTEzMDExNzAwMDAwMFoXDTE0MDEyMjEyMDAwMFow
+gY4xCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMR4wHAYDVQQHDBVT
+w6NvIEpvc8OpIERvcyBDYW1wb3MxJDAiBgNVBAoTG0J1c3RlciBQYXBlciBDb21l
+cmNpYWwgTHRkYTEkMCIGA1UEAxMbQnVzdGVyIFBhcGVyIENvbWVyY2lhbCBMdGRh
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzO0l6jWIpEfO2oUpVHpL
+HETj5lzivNb0S9jKHgGJax917czh81PnGTxwxFXd6gLJuy/XFHvmiSi8g8jzlymn
+2Ji5zQ3CPaz7nomJokSUDlMVJ2qYWtctw4jrdjuI4qtn+koXXUFkWjkf8h8251I4
+tUs7S49HE2Go5owCYP3byajj7fsFAYR/Xb7TdVtndkZsUB/YgOjHovyACjouaNCi
+mDiRyQ6zLLjZGiyeD65Yiseuhp5b8/BL5h1p7w76QYMYMVQNAdtDKut2R8MBpuWf
+Ny7Eoi0x/gm1p9X5Rcl5aN7K0G4UtTAJKbkuUfXddsyFoM0Nx8uo8SgNQ8Y/X5Jx
+BwIDAQABo4IDOTCCAzUwHwYDVR0jBBgwFoAUe2jOKarAF75JeuHlP9an90WPNTIw
+HQYDVR0OBBYEFFLZ3n5nt/Eer7n1bvtOqMb1qKO5MA4GA1UdDwEB/wQEAwIHgDAT
+BgNVHSUEDDAKBggrBgEFBQcDAzBzBgNVHR8EbDBqMDOgMaAvhi1odHRwOi8vY3Js
+My5kaWdpY2VydC5jb20vYXNzdXJlZC1jcy0yMDExYS5jcmwwM6AxoC+GLWh0dHA6
+Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9hc3N1cmVkLWNzLTIwMTFhLmNybDCCAcQGA1Ud
+IASCAbswggG3MIIBswYJYIZIAYb9bAMBMIIBpDA6BggrBgEFBQcCARYuaHR0cDov
+L3d3dy5kaWdpY2VydC5jb20vc3NsLWNwcy1yZXBvc2l0b3J5Lmh0bTCCAWQGCCsG
+AQUFBwICMIIBVh6CAVIAQQBuAHkAIAB1AHMAZQAgAG8AZgAgAHQAaABpAHMAIABD
+AGUAcgB0AGkAZgBpAGMAYQB0AGUAIABjAG8AbgBzAHQAaQB0AHUAdABlAHMAIABh
+AGMAYwBlAHAAdABhAG4AYwBlACAAbwBmACAAdABoAGUAIABEAGkAZwBpAEMAZQBy
+AHQAIABDAFAALwBDAFAAUwAgAGEAbgBkACAAdABoAGUAIABSAGUAbAB5AGkAbgBn
+ACAAUABhAHIAdAB5ACAAQQBnAHIAZQBlAG0AZQBuAHQAIAB3AGgAaQBjAGgAIABs
+AGkAbQBpAHQAIABsAGkAYQBiAGkAbABpAHQAeQAgAGEAbgBkACAAYQByAGUAIABp
+AG4AYwBvAHIAcABvAHIAYQB0AGUAZAAgAGgAZQByAGUAaQBuACAAYgB5ACAAcgBl
+AGYAZQByAGUAbgBjAGUALjCBggYIKwYBBQUHAQEEdjB0MCQGCCsGAQUFBzABhhho
+dHRwOi8vb2NzcC5kaWdpY2VydC5jb20wTAYIKwYBBQUHMAKGQGh0dHA6Ly9jYWNl
+cnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEFzc3VyZWRJRENvZGVTaWduaW5nQ0Et
+MS5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQUFAAOCAQEAPTTQvpOIikXI
+hTLnNbajaFRR5GhQpTzUNgBfF9VYSlNw/wMjpGsrh5RxaJCip52jbehmTgjMRhft
+jRYyml44PAVsCcR9uEoDpCZYpI1fHI1R+F8jd1C9rqprbSwwOG4xlg4SmvTHYs6e
+gBItQ/1p9XY+Sf4Wv1qOuOFL1qvV/5VyR2zdlOQCmKCeMgxt6a/tHLBDiAA67D44
+/vfdoNJl0CU2It0PO60jdCPFNWIRcxL+OSDqAoePeUC7xQ+JsTEIxuUE8+d6w6fc
+BV2mYb1flh22t46GLjh4gyo7xw3aL6L0L0jzlTT6IcEw6NIbaPbIKj/npQnHobYj
+XMuKLxbh7g==
+-----END CERTIFICATE-----
+
+// Subject: CN=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME,
+//          O=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME,
+//          L=S?o Paulo,
+//          ST=S?o Paulo,
+//          C=BR
+// Issuer:  CN=DigiCert Assured ID Code Signing CA-1,
+//          OU=www.digicert.com,
+//          O=DigiCert Inc,
+//          C=US
+// Serial:  0a:38:9b:95:ee:73:6d:d1:3b:c0:ed:74:3f:d7:4d:2f
+-----BEGIN CERTIFICATE-----
+MIIG4DCCBcigAwIBAgIQCjible5zbdE7wO10P9dNLzANBgkqhkiG9w0BAQUFADBv
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv
+ZGUgU2lnbmluZyBDQS0xMB4XDTEyMTEwOTAwMDAwMFoXDTEzMTExNDEyMDAwMFow
+gasxCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMRMwEQYDVQQHDApT
+w6NvIFBhdWxvMTgwNgYDVQQKEy9CVVNURVIgQVNTSVNURU5DSUEgVEVDTklDQSBF
+TEVUUk9OSUNBIExUREEgLSBNRTE4MDYGA1UEAxMvQlVTVEVSIEFTU0lTVEVOQ0lB
+IFRFQ05JQ0EgRUxFVFJPTklDQSBMVERBIC0gTUUwggEiMA0GCSqGSIb3DQEBAQUA
+A4IBDwAwggEKAoIBAQDAqNeEs5/B2CTXGjTOkUIdu6jV6qulOZwdw4sefHWYj1UR
+4z6zPk9kjpUgbnb402RFq88QtfInwddZ/wXn9OxMtDd/3TnC7HrhNS7ga79ZFL2V
+JnmzKHum2Yvh0q82QEJ9tHBR2X9VdKpUIH08Zs3k6cWWM1H0YX0cxA/HohhesQJW
+kwJ3urOIJiH/HeByDk8a1NS8safcCxk5vxvW4WvCg43iT09LeHY5Aa8abKw8lqVb
+0tD5ZSIjdmdj3TT1U37iAHLLRM2DXbxfdbhouUX1c5U1ZHAMA67HwjKiseOiDaHj
+NUGbC37C+cgbc9VVM/cURD8WvS0Kj6fQv7F2QtJDAgMBAAGjggM5MIIDNTAfBgNV
+HSMEGDAWgBR7aM4pqsAXvkl64eU/1qf3RY81MjAdBgNVHQ4EFgQU88EXKAyDsh30
+o9+Gu9a4xUy+FSMwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMD
+MHMGA1UdHwRsMGowM6AxoC+GLWh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9hc3N1
+cmVkLWNzLTIwMTFhLmNybDAzoDGgL4YtaHR0cDovL2NybDQuZGlnaWNlcnQuY29t
+L2Fzc3VyZWQtY3MtMjAxMWEuY3JsMIIBxAYDVR0gBIIBuzCCAbcwggGzBglghkgB
+hv1sAwEwggGkMDoGCCsGAQUFBwIBFi5odHRwOi8vd3d3LmRpZ2ljZXJ0LmNvbS9z
+c2wtY3BzLXJlcG9zaXRvcnkuaHRtMIIBZAYIKwYBBQUHAgIwggFWHoIBUgBBAG4A
+eQAgAHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEMAZQByAHQAaQBmAGkAYwBhAHQA
+ZQAgAGMAbwBuAHMAdABpAHQAdQB0AGUAcwAgAGEAYwBjAGUAcAB0AGEAbgBjAGUA
+IABvAGYAIAB0AGgAZQAgAEQAaQBnAGkAQwBlAHIAdAAgAEMAUAAvAEMAUABTACAA
+YQBuAGQAIAB0AGgAZQAgAFIAZQBsAHkAaQBuAGcAIABQAGEAcgB0AHkAIABBAGcA
+cgBlAGUAbQBlAG4AdAAgAHcAaABpAGMAaAAgAGwAaQBtAGkAdAAgAGwAaQBhAGIA
+aQBsAGkAdAB5ACAAYQBuAGQAIABhAHIAZQAgAGkAbgBjAG8AcgBwAG8AcgBhAHQA
+ZQBkACAAaABlAHIAZQBpAG4AIABiAHkAIAByAGUAZgBlAHIAZQBuAGMAZQAuMIGC
+BggrBgEFBQcBAQR2MHQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0
+LmNvbTBMBggrBgEFBQcwAoZAaHR0cDovL2NhY2VydHMuZGlnaWNlcnQuY29tL0Rp
+Z2lDZXJ0QXNzdXJlZElEQ29kZVNpZ25pbmdDQS0xLmNydDAMBgNVHRMBAf8EAjAA
+MA0GCSqGSIb3DQEBBQUAA4IBAQAei1QmiXepje8OIfo/WonD4MIXgpPr2dfRaquQ
+A8q63OpTRSveyqdQDCSPpDRF/nvO1Y30yksZvIH1tNBsW5LBdxAKN3lFdBlqBwtE
+Q3jHc0KVVYRJ0FBaGE/PJHmRajscdAhYIcMPhTga0u0tDK+wOHEq3993dfl6yHjA
+XHU2iW5pnk75ZoE39zALD5eKXT8ZXrET5c3XUFJKWA+XuGmdmyzqo0Au49PanBv9
+UlZnabYfqoMArqMS0tGSX4cGgi9/2E+pHG9BX4sFW+ZDumroOA2pxyMWEKjxePEL
+zCOfhbsRWdMLYepauaNZOIMZXmFwcrIl0TGMkTAtATz+XmZc
+-----END CERTIFICATE-----
+
+// Subject: CN=CLEARESULT CONSULTING INC., OU=Corporate IT,
+//          O=CLEARESULT CONSULTING INC., L=Austin, ST=TX, C=US
+// Issuer:  SERIALNUMBER=07969287,
+//          CN=Go Daddy Secure Certification Authority,
+//          OU=http://certificates.godaddy.com/repository,
+//          O="GoDaddy.com, Inc.",
+//          L=Scottsdale,
+//          ST=Arizona,
+//          C=US
+// Serial:  2b:73:43:2a:a8:4f:44
+-----BEGIN CERTIFICATE-----
+MIIFYjCCBEqgAwIBAgIHK3NDKqhPRDANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
+BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY
+BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm
+aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5
+IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky
+ODcwHhcNMTIwMjE1MjEwOTA2WhcNMTQwMjE1MjEwOTA2WjCBjDELMAkGA1UEBgwC
+VVMxCzAJBgNVBAgMAlRYMQ8wDQYDVQQHDAZBdXN0aW4xIzAhBgNVBAoMGkNMRUFS
+RVNVTFQgQ09OU1VMVElORyBJTkMuMRUwEwYDVQQLDAxDb3Jwb3JhdGUgSVQxIzAh
+BgNVBAMMGkNMRUFSRVNVTFQgQ09OU1VMVElORyBJTkMuMIIBIjANBgkqhkiG9w0B
+AQEFAAOCAQ8AMIIBCgKCAQEAtIOjCKeAicull+7ZIzt0/4ya3IeXUFlfypqKMLkU
+IbKjn0P5uMj6VE3rlbZr44RCegxvdnR6umBh1c0ZXoN3o+yc0JKcKcLiApmJJ277
+p7IbLwYDhBXRQNoIJm187IOMRPIxsKN4hL91txn9jGBmW+9zKlJlNhR5R7vjwU2E
+jrH/6oqsc9EM2yYpfjlNv6+3jSwAYZCkSWr+27PQOV+YHKmIxtJjX0upFz5FdIrV
+9CCX+L2Kji1THOkSgG4QTbYxmEcHqGViWz8hXLeNXjcbEsPuIiAu3hknxRHfUTE/
+U0Lh0Ug1e3LrJu+WnxM2SmUY4krsZ22c0yWUW9hzWITIjQIDAQABo4IBhzCCAYMw
+DwYDVR0TAQH/BAUwAwEBADATBgNVHSUEDDAKBggrBgEFBQcDAzAOBgNVHQ8BAf8E
+BAMCB4AwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5LmNvbS9n
+ZHM1LTE2LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcCMDkwNwYIKwYBBQUH
+AgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8w
+gYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZ29kYWRk
+eS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdvZGFkZHku
+Y29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSMEGDAWgBT9
+rGEyk2xF1uLuhV+auud2mWjM5zAdBgNVHQ4EFgQUDtdeKqeN2QkcbEp1HovFieNB
+XiowDQYJKoZIhvcNAQEFBQADggEBAD74Agw5tvi2aBl4/f/s7/VE/BClzDsKMb9K
+v9qpeC45ZA/jelxV11HKbQnVF194gDb7D2H9OsAsRUy8HVKbXEcc/8dKvwOqb+BC
+2i/EmfjLgmCfezNFtLq8xcPxF3zIRc44vPrK0z4YZsaHdH+yTEJ51p5EMdTqaLaP
+4n5m8LX3RfqlQB9dYFe6dUoYZjKm9d/pIRww3VqfOzjl42Edi1w6dWmBVMx1NZuR
+DBabJH1vJ9Gd+KwxMCmBZ6pQPl28JDimhJhI2LNqU349uADQVV0HJosddN/ARyyI
+LSIQO7BnNVKVG9Iujf33bvPNeg0qNz5qw+rKKq97Pqeum+L5oKU=
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/gendata/GendataBlacklistedCerts.gmk	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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.
+#
+
+GENDATA_BLACKLISTED_CERTS_SRC := $(JDK_TOPDIR)/make/data/blacklistedcertsconverter/blacklisted.certs.pem
+GENDATA_BLACKLISTED_CERTS := $(JDK_OUTPUTDIR)/lib/security/blacklisted.certs
+
+ifndef OPENJDK
+	GENDATA_BLACKLISTED_CERTS_SRC += $(wildcard $(JDK_TOPDIR)/make/closed/data/blacklistedcertsconverter/blacklisted.certs.pem)
+endif
+ 
+$(GENDATA_BLACKLISTED_CERTS): $(BUILD_TOOLS) $(GENDATA_BLACKLISTED_CERTS_SRC)
+	$(ECHO) "Generating blacklisted certs"
+	$(MKDIR) -p $(@D)
+	($(CAT) $(GENDATA_BLACKLISTED_CERTS_SRC) | $(TOOL_BLACKLISTED_CERTS) > $@) || exit 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/src/classes/build/tools/blacklistedcertsconverter/BlacklistedCertsConverter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 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.
+ */
+
+package build.tools.blacklistedcertsconverter;
+
+import java.security.MessageDigest;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.Collection;
+import java.util.Set;
+import java.util.TreeSet;
+
+
+/**
+ * Converts blacklisted.certs.pem from System.in to blacklisted.certs in
+ * System.out. The input must start with a #! line including the fingerprint
+ * algorithm. The output is sorted and unique.
+ */
+public class BlacklistedCertsConverter {
+
+    public static void main(String[] args) throws Exception {
+
+        byte[] pattern = "#! java BlacklistedCertsConverter ".getBytes();
+        String mdAlg = "";
+
+        for (int i=0; ; i++) {
+            int n = System.in.read();
+            if (n < 0) {
+                throw new Exception("Unexpected EOF");
+            }
+            if (i < pattern.length) {
+                if (n != pattern[i]) {
+                    throw new Exception("The first line must start with \""
+                            + new String(pattern) + "\"");
+                }
+            } else if (i < pattern.length + 100) {
+                if (n < 32) {
+                    break;
+                } else {
+                    mdAlg = mdAlg + String.format("%c", n);
+                }
+            }
+        }
+
+        mdAlg = mdAlg.trim();
+        System.out.println("Algorithm=" + mdAlg);
+
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+        Collection<? extends Certificate> certs
+                = cf.generateCertificates(System.in);
+
+        // Output sorted so that it's easy to locate an entry.
+        Set<String> fingerprints = new TreeSet<>();
+        for (Certificate cert: certs) {
+            fingerprints.add(
+                    getCertificateFingerPrint(mdAlg, (X509Certificate)cert));
+        }
+
+        for (String s: fingerprints) {
+            System.out.println(s);
+        }
+    }
+
+    /**
+     * Converts a byte to hex digit and writes to the supplied buffer
+     */
+    private static void byte2hex(byte b, StringBuffer buf) {
+        char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
+                '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+        int high = ((b & 0xf0) >> 4);
+        int low = (b & 0x0f);
+        buf.append(hexChars[high]);
+        buf.append(hexChars[low]);
+    }
+
+    /**
+     * Gets the requested finger print of the certificate.
+     */
+    private static String getCertificateFingerPrint(
+            String mdAlg, X509Certificate cert) throws Exception {
+        byte[] encCertInfo = cert.getEncoded();
+        MessageDigest md = MessageDigest.getInstance(mdAlg);
+        byte[] digest = md.digest(encCertInfo);
+        StringBuffer buf = new StringBuffer();
+        for (int i = 0; i < digest.length; i++) {
+            byte2hex(digest[i], buf);
+        }
+        return buf.toString();
+    }
+}
--- a/jdk/src/share/classes/com/sun/crypto/provider/JceKeyStore.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/crypto/provider/JceKeyStore.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -107,7 +107,7 @@
     {
         Key key = null;
 
-        Object entry = entries.get(alias.toLowerCase());
+        Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
 
         if (!((entry instanceof PrivateKeyEntry) ||
               (entry instanceof SecretKeyEntry))) {
@@ -150,7 +150,7 @@
     {
         Certificate[] chain = null;
 
-        Object entry = entries.get(alias.toLowerCase());
+        Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
 
         if ((entry instanceof PrivateKeyEntry)
             && (((PrivateKeyEntry)entry).chain != null)) {
@@ -178,7 +178,7 @@
     public Certificate engineGetCertificate(String alias) {
         Certificate cert = null;
 
-        Object entry = entries.get(alias.toLowerCase());
+        Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
 
         if (entry != null) {
             if (entry instanceof TrustedCertEntry) {
@@ -203,7 +203,7 @@
     public Date engineGetCreationDate(String alias) {
         Date date = null;
 
-        Object entry = entries.get(alias.toLowerCase());
+        Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
 
         if (entry != null) {
             // We have to create a new instance of java.util.Date because
@@ -266,7 +266,7 @@
                     }
 
                     // store the entry
-                    entries.put(alias.toLowerCase(), entry);
+                    entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
 
                 } else {
                     SecretKeyEntry entry = new SecretKeyEntry();
@@ -274,7 +274,7 @@
 
                     // seal and store the key
                     entry.sealedKey = keyProtector.seal(key);
-                    entries.put(alias.toLowerCase(), entry);
+                    entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
                 }
 
             } catch (Exception e) {
@@ -322,7 +322,7 @@
                 entry.chain = null;
             }
 
-            entries.put(alias.toLowerCase(), entry);
+            entries.put(alias.toLowerCase(Locale.ENGLISH), entry);
         }
     }
 
@@ -345,7 +345,7 @@
     {
         synchronized(entries) {
 
-            Object entry = entries.get(alias.toLowerCase());
+            Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
             if (entry != null) {
                 if (entry instanceof PrivateKeyEntry) {
                     throw new KeyStoreException("Cannot overwrite own "
@@ -358,7 +358,7 @@
             TrustedCertEntry trustedCertEntry = new TrustedCertEntry();
             trustedCertEntry.cert = cert;
             trustedCertEntry.date = new Date();
-            entries.put(alias.toLowerCase(), trustedCertEntry);
+            entries.put(alias.toLowerCase(Locale.ENGLISH), trustedCertEntry);
         }
     }
 
@@ -373,7 +373,7 @@
         throws KeyStoreException
     {
         synchronized(entries) {
-            entries.remove(alias.toLowerCase());
+            entries.remove(alias.toLowerCase(Locale.ENGLISH));
         }
     }
 
@@ -394,7 +394,7 @@
      * @return true if the alias exists, false otherwise
      */
     public boolean engineContainsAlias(String alias) {
-        return entries.containsKey(alias.toLowerCase());
+        return entries.containsKey(alias.toLowerCase(Locale.ENGLISH));
     }
 
     /**
@@ -416,7 +416,7 @@
     public boolean engineIsKeyEntry(String alias) {
         boolean isKey = false;
 
-        Object entry = entries.get(alias.toLowerCase());
+        Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if ((entry instanceof PrivateKeyEntry)
             || (entry instanceof SecretKeyEntry)) {
             isKey = true;
@@ -434,7 +434,7 @@
      */
     public boolean engineIsCertificateEntry(String alias) {
         boolean isCert = false;
-        Object entry = entries.get(alias.toLowerCase());
+        Object entry = entries.get(alias.toLowerCase(Locale.ENGLISH));
         if (entry instanceof TrustedCertEntry) {
             isCert = true;
         }
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBEKey.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEKey.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -27,6 +27,7 @@
 
 import java.security.KeyRep;
 import java.security.spec.InvalidKeySpecException;
+import java.util.Locale;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.PBEKeySpec;
 
@@ -91,7 +92,7 @@
         for (int i = 1; i < this.key.length; i++) {
             retval += this.key[i] * i;
         }
-        return(retval ^= getAlgorithm().toLowerCase().hashCode());
+        return(retval ^= getAlgorithm().toLowerCase(Locale.ENGLISH).hashCode());
     }
 
     public boolean equals(Object obj) {
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -32,6 +32,7 @@
 import javax.crypto.SecretKeyFactorySpi;
 import javax.crypto.spec.PBEKeySpec;
 import java.util.HashSet;
+import java.util.Locale;
 
 /**
  * This class implements a key factory for PBE keys according to PKCS#5,
@@ -56,24 +57,24 @@
 
     static {
         validTypes = new HashSet<String>(17);
-        validTypes.add("PBEWithMD5AndDES".toUpperCase());
-        validTypes.add("PBEWithSHA1AndDESede".toUpperCase());
-        validTypes.add("PBEWithSHA1AndRC2_40".toUpperCase());
-        validTypes.add("PBEWithSHA1AndRC2_128".toUpperCase());
-        validTypes.add("PBEWithSHA1AndRC4_40".toUpperCase());
-        validTypes.add("PBEWithSHA1AndRC4_128".toUpperCase());
+        validTypes.add("PBEWithMD5AndDES".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithSHA1AndDESede".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithSHA1AndRC2_40".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithSHA1AndRC2_128".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithSHA1AndRC4_40".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithSHA1AndRC4_128".toUpperCase(Locale.ENGLISH));
         // Proprietary algorithm.
-        validTypes.add("PBEWithMD5AndTripleDES".toUpperCase());
-        validTypes.add("PBEWithHmacSHA1AndAES_128".toUpperCase());
-        validTypes.add("PBEWithHmacSHA224AndAES_128".toUpperCase());
-        validTypes.add("PBEWithHmacSHA256AndAES_128".toUpperCase());
-        validTypes.add("PBEWithHmacSHA384AndAES_128".toUpperCase());
-        validTypes.add("PBEWithHmacSHA512AndAES_128".toUpperCase());
-        validTypes.add("PBEWithHmacSHA1AndAES_256".toUpperCase());
-        validTypes.add("PBEWithHmacSHA224AndAES_256".toUpperCase());
-        validTypes.add("PBEWithHmacSHA256AndAES_256".toUpperCase());
-        validTypes.add("PBEWithHmacSHA384AndAES_256".toUpperCase());
-        validTypes.add("PBEWithHmacSHA512AndAES_256".toUpperCase());
+        validTypes.add("PBEWithMD5AndTripleDES".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA1AndAES_128".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA224AndAES_128".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA256AndAES_128".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA384AndAES_128".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA512AndAES_128".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA1AndAES_256".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA224AndAES_256".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA256AndAES_256".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA384AndAES_256".toUpperCase(Locale.ENGLISH));
+        validTypes.add("PBEWithHmacSHA512AndAES_256".toUpperCase(Locale.ENGLISH));
     }
 
     public static final class PBEWithMD5AndDES
@@ -237,7 +238,7 @@
     protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
         throws InvalidKeySpecException {
         if ((key instanceof SecretKey)
-            && (validTypes.contains(key.getAlgorithm().toUpperCase()))
+            && (validTypes.contains(key.getAlgorithm().toUpperCase(Locale.ENGLISH)))
             && (key.getFormat().equalsIgnoreCase("RAW"))) {
 
             // Check if requested key spec is amongst the valid ones
@@ -279,7 +280,7 @@
     {
         try {
             if ((key != null) &&
-                (validTypes.contains(key.getAlgorithm().toUpperCase())) &&
+                (validTypes.contains(key.getAlgorithm().toUpperCase(Locale.ENGLISH))) &&
                 (key.getFormat().equalsIgnoreCase("RAW"))) {
 
                 // Check if key originates from this factory
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -30,6 +30,7 @@
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.util.Arrays;
+import java.util.Locale;
 import java.security.KeyRep;
 import java.security.GeneralSecurityException;
 import java.security.NoSuchAlgorithmException;
@@ -143,7 +144,7 @@
                 @Override
                 public int hashCode() {
                     return Arrays.hashCode(password) * 41 +
-                            prf.getAlgorithm().toLowerCase().hashCode();
+                      prf.getAlgorithm().toLowerCase(Locale.ENGLISH).hashCode();
                 }
                 @Override
                 public boolean equals(Object obj) {
@@ -221,7 +222,7 @@
         for (int i = 1; i < this.key.length; i++) {
             retval += this.key[i] * i;
         }
-        return(retval ^= getAlgorithm().toLowerCase().hashCode());
+        return(retval ^= getAlgorithm().toLowerCase(Locale.ENGLISH).hashCode());
     }
 
     public boolean equals(Object obj) {
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Wed Jul 05 19:50:06 2017 +0200
@@ -111,6 +111,7 @@
 
     private static final boolean debug = false;
     private static final int dump = 0; // > 0 r, > 1 rw
+    public static final long DEFAULT_READ_TIMEOUT_MILLIS = 15 * 1000; // 15 second timeout;
 
 
     final private Thread worker;    // Initialized in constructor
@@ -460,7 +461,7 @@
                             // available
                             ldr.wait(readTimeout);
                         } else {
-                            ldr.wait(15 * 1000); // 15 second timeout
+                            ldr.wait(DEFAULT_READ_TIMEOUT_MILLIS);
                         }
                         waited = true;
                     } else {
--- a/jdk/src/share/classes/com/sun/security/ntlm/Client.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/security/ntlm/Client.java	Wed Jul 05 19:50:06 2017 +0200
@@ -46,7 +46,7 @@
     final private String hostname;
     final private String username;
 
-    private String domain;    // might be updated by Type 2 msg
+    private String domain;
     private byte[] pw1, pw2;
 
     /**
@@ -82,7 +82,7 @@
         }
         this.hostname = hostname;
         this.username = username;
-        this.domain = domain;
+        this.domain = domain == null ? "" : domain;
         this.pw1 = getP1(password);
         this.pw2 = getP2(password);
         debug("NTLM Client: (h,u,t,version(v)) = (%s,%s,%s,%s(%s))\n",
@@ -95,19 +95,13 @@
      */
     public byte[] type1() {
         Writer p = new Writer(1, 32);
-        int flags = 0x8203;
-        if (hostname != null) {
-            flags |= 0x2000;
-        }
-        if (domain != null) {
-            flags |= 0x1000;
-        }
+        // Negotiate always sign, Negotiate NTLM,
+        // Request Target, Negotiate OEM, Negotiate unicode
+        int flags = 0x8207;
         if (v != Version.NTLM) {
             flags |= 0x80000;
         }
         p.writeInt(12, flags);
-        p.writeSecurityBuffer(24, hostname, false);
-        p.writeSecurityBuffer(16, domain, false);
         debug("NTLM Client: Type 1 created\n");
         debug(p.getBytes());
         return p.getBytes();
@@ -133,13 +127,10 @@
         byte[] challenge = r.readBytes(24, 8);
         int inputFlags = r.readInt(20);
         boolean unicode = (inputFlags & 1) == 1;
-        String domainFromServer = r.readSecurityBuffer(12, unicode);
-        if (domainFromServer != null) {
-            domain = domainFromServer;
-        }
-        if (domain == null) {
-            domain = "";
-        }
+
+        // IE uses domainFromServer to generate an alist if server has not
+        // provided one. Firefox/WebKit do not. Neither do we.
+        //String domainFromServer = r.readSecurityBuffer(12, unicode);
 
         int flags = 0x88200 | (inputFlags & 3);
         Writer p = new Writer(3, 64);
@@ -163,7 +154,9 @@
             if (writeLM) lm = calcV2(nthash,
                     username.toUpperCase(Locale.US)+domain, nonce, challenge);
             if (writeNTLM) {
-                byte[] alist = type2.length > 48 ?
+                // Some client create a alist even if server does not send
+                // one: (i16)2 (i16)len target_in_unicode (i16)0 (i16) 0
+                byte[] alist = ((inputFlags & 0x800000) != 0) ?
                     r.readSecurityBuffer(40) : new byte[0];
                 byte[] blob = new byte[32+alist.length];
                 System.arraycopy(new byte[]{1,1,0,0,0,0,0,0}, 0, blob, 0, 8);
--- a/jdk/src/share/classes/com/sun/security/ntlm/Server.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/security/ntlm/Server.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -92,7 +93,9 @@
         debug("NTLM Server: Type 1 received\n");
         if (type1 != null) debug(type1);
         Writer p = new Writer(2, 32);
-        int flags = 0x80205;
+        // Negotiate NTLM2 Key, Target Type Domain,
+        // Negotiate NTLM, Request Target, Negotiate unicode
+        int flags = 0x90205;
         p.writeSecurityBuffer(12, domain, true);
         p.writeInt(20, flags);
         p.writeBytes(24, nonce);
@@ -127,8 +130,9 @@
                     "Wrong domain: " + incomingDomain +
                     " vs " + domain); // Needed?
         }*/
+
         boolean verified = false;
-        char[] password = getPassword(domain, username);
+        char[] password = getPassword(incomingDomain, username);
         if (password == null) {
             throw new NTLMException(NTLMException.USER_UNKNOWN,
                     "Unknown user");
@@ -179,6 +183,8 @@
                 }
             }
             if (incomingNTLM.length > 0) {
+                // We didn't sent alist in type2(), so there
+                // is nothing to check here.
                 byte[] clientBlob = Arrays.copyOfRange(
                         incomingNTLM, 16, incomingNTLM.length);
                 byte[] ntlmresponse = calcV2(nthash,
--- a/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Base.java	Wed Jul 05 19:50:06 2017 +0200
@@ -26,11 +26,14 @@
 
 package com.sun.security.sasl.gsskerb;
 
+import java.util.Locale;
 import java.util.Map;
 import java.util.logging.Level;
 import javax.security.sasl.*;
 import com.sun.security.sasl.util.AbstractSaslImpl;
 import org.ietf.jgss.*;
+import com.sun.security.jgss.ExtendedGSSContext;
+import com.sun.security.jgss.InquireType;
 
 abstract class GssKrb5Base extends AbstractSaslImpl {
 
@@ -61,6 +64,36 @@
         return "GSSAPI";
     }
 
+    @Override
+    public Object getNegotiatedProperty(String propName) {
+        if (!completed) {
+            throw new IllegalStateException("Authentication incomplete");
+        }
+        String xprefix = "com.sun.security.jgss.inquiretype.";
+        if (propName.startsWith(xprefix)) {
+            String type = propName.substring(xprefix.length());
+            if (logger.isLoggable(Level.FINEST)) {
+                logger.logp(Level.FINE, "GssKrb5Base",
+                        "getNegotiatedProperty", propName);
+            }
+            for (InquireType t: InquireType.values()) {
+                if (t.name().toLowerCase(Locale.US).equals(type)) {
+                    try {
+                        return ((ExtendedGSSContext)secCtx).inquireSecContext(t);
+                    } catch (GSSException e) {
+                        if (logger.isLoggable(Level.FINEST)) {
+                            logger.log(Level.WARNING, "inquireSecContext error", e);
+                        }
+                        return null;
+                    }
+                }
+            }
+            // No such InquireType. Although not likely to be defined
+            // as a property in a parent class, still try it.
+        }
+        return super.getNegotiatedProperty(propName);
+    }
+
     public byte[] unwrap(byte[] incoming, int start, int len)
         throws SaslException {
         if (!completed) {
--- a/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMClient.java	Wed Jul 05 19:50:06 2017 +0200
@@ -160,9 +160,17 @@
             }
         }
         try {
+            String name = ncb.getName();
+            if (name == null) {
+                name = authzid;
+            }
+            String domain = dcb.getText();
+            if (domain == null) {
+                domain = serverName;
+            }
             client = new Client(version, hostname,
-                    ncb.getName(),
-                    dcb.getText(),
+                    name,
+                    domain,
                     pcb.getPassword());
         } catch (NTLMException ne) {
             throw new SaslException(
--- a/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/com/sun/security/sasl/ntlm/NTLMServer.java	Wed Jul 05 19:50:06 2017 +0200
@@ -141,8 +141,10 @@
             server = new Server(version, domain) {
                 public char[] getPassword(String ntdomain, String username) {
                     try {
-                        RealmCallback rcb = new RealmCallback(
-                                "Domain: ", ntdomain);
+                        RealmCallback rcb =
+                                (ntdomain == null || ntdomain.isEmpty())
+                                    ? new RealmCallback("Domain: ")
+                                    : new RealmCallback("Domain: ", ntdomain);
                         NameCallback ncb = new NameCallback(
                                 "Name: ", username);
                         PasswordCallback pcb = new PasswordCallback(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/awt/font/JavaAWTFontAccessImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.awt.font;
+
+import java.lang.reflect.Field;
+import sun.misc.JavaAWTFontAccess;
+
+class JavaAWTFontAccessImpl implements sun.misc.JavaAWTFontAccess {
+
+    // java.awt.font.TextAttribute constants
+    public Object getTextAttributeConstant(String name) {
+        switch (name) {
+        case "RUN_DIRECTION":
+        case "NUMERIC_SHAPING":
+        case "BIDI_EMBEDDING":
+        case "RUN_DIRECTION_LTR":
+            try {
+                Field f = TextAttribute.class.getField(name);
+                return f.get(null);
+            } catch (NoSuchFieldException | IllegalAccessException x) {
+                throw new AssertionError(x);
+            }
+        }
+
+        throw new AssertionError("Constant name is not recognized");
+    }
+
+    // java.awt.font.NumericShaper
+    public void shape(Object shaper, char[] text, int start, int count) {
+        assert shaper instanceof NumericShaper;
+        ((NumericShaper)shaper).shape(text, start,count);
+    }
+
+}
--- a/jdk/src/share/classes/java/awt/font/NumericShaper.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/java/awt/font/NumericShaper.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -31,6 +31,7 @@
 import java.util.Comparator;
 import java.util.EnumSet;
 import java.util.Set;
+import sun.misc.SharedSecrets;
 
 /**
  * The <code>NumericShaper</code> class is used to convert Latin-1 (European)
@@ -134,6 +135,14 @@
  */
 
 public final class NumericShaper implements java.io.Serializable {
+
+    // For access from java.text.Bidi
+    static {
+        if (SharedSecrets.getJavaAWTFontAccess() == null) {
+            SharedSecrets.setJavaAWTFontAccess(new JavaAWTFontAccessImpl());
+        }
+    }
+
     /**
      * A {@code NumericShaper.Range} represents a Unicode range of a
      * script having its own decimal digits. For example, the {@link
--- a/jdk/src/share/classes/java/awt/font/TextAttribute.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/java/awt/font/TextAttribute.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -44,6 +44,7 @@
 import java.text.AttributedCharacterIterator.Attribute;
 import java.util.Map;
 import java.util.HashMap;
+import sun.misc.SharedSecrets;
 
 /**
  * The <code>TextAttribute</code> class defines attribute keys and
@@ -257,6 +258,13 @@
     private static final Map<String, TextAttribute>
             instanceMap = new HashMap<String, TextAttribute>(29);
 
+    // For access from java.text.Bidi
+    static {
+        if (SharedSecrets.getJavaAWTFontAccess() == null) {
+            SharedSecrets.setJavaAWTFontAccess(new JavaAWTFontAccessImpl());
+        }
+    }
+
     /**
      * Constructs a <code>TextAttribute</code> with the specified name.
      * @param name the attribute name to assign to this
--- a/jdk/src/share/classes/java/lang/Class.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/java/lang/Class.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -130,11 +130,15 @@
     }
 
     /*
-     * Constructor. Only the Java Virtual Machine creates Class
-     * objects.
+     * Private constructor. Only the Java Virtual Machine creates Class objects.
+     * This constructor is not used and prevents the default constructor being
+     * generated.
      */
-    private Class() {}
-
+    private Class(ClassLoader loader) {
+        // Initialize final field for classLoader.  The initialization value of non-null
+        // prevents future JIT optimizations from assuming this final field is null.
+        classLoader = loader;
+    }
 
     /**
      * Converts the object to a string. The string representation is the
@@ -677,8 +681,10 @@
     }
 
     // Package-private to allow ClassLoader access
-    native ClassLoader getClassLoader0();
-
+    ClassLoader getClassLoader0() { return classLoader; }
+
+    // Initialized in JVM not by private constructor
+    private final ClassLoader classLoader;
 
     /**
      * Returns an array of {@code TypeVariable} objects that represent the
--- a/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/java/lang/reflect/AccessibleObject.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -129,16 +129,24 @@
         setAccessible0(this, flag);
     }
 
-    /* Check that you aren't exposing java.lang.Class.<init>. */
+    /* Check that you aren't exposing java.lang.Class.<init> or sensitive
+       fields in java.lang.Class. */
     private static void setAccessible0(AccessibleObject obj, boolean flag)
         throws SecurityException
     {
         if (obj instanceof Constructor && flag == true) {
             Constructor<?> c = (Constructor<?>)obj;
             if (c.getDeclaringClass() == Class.class) {
-                throw new SecurityException("Can not make a java.lang.Class" +
+                throw new SecurityException("Cannot make a java.lang.Class" +
                                             " constructor accessible");
             }
+        } else if (obj instanceof Field && flag == true) {
+            Field f = (Field)obj;
+            if (f.getDeclaringClass() == Class.class &&
+                f.getName().equals("classLoader")) {
+                throw new SecurityException("Cannot make java.lang.Class.classLoader" +
+                                            " accessible");
+            }
         }
         obj.override = flag;
     }
--- a/jdk/src/share/classes/java/net/URL.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/java/net/URL.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1071,7 +1071,7 @@
     /**
      * The URLStreamHandler factory.
      */
-    static URLStreamHandlerFactory factory;
+    private static volatile URLStreamHandlerFactory factory;
 
     /**
      * Sets an application's {@code URLStreamHandlerFactory}.
@@ -1106,6 +1106,7 @@
                 security.checkSetFactory();
             }
             handlers.clear();
+            // safe publication of URLStreamHandlerFactory with volatile write
             factory = fac;
         }
     }
@@ -1127,9 +1128,11 @@
 
             boolean checkedWithFactory = false;
 
-            // Use the factory (if any)
-            if (factory != null) {
-                handler = factory.createURLStreamHandler(protocol);
+            // Use the factory (if any). Volatile read makes
+            // URLStreamHandlerFactory appear fully initialized to current thread.
+            URLStreamHandlerFactory fac = factory;
+            if (fac != null) {
+                handler = fac.createURLStreamHandler(protocol);
                 checkedWithFactory = true;
             }
 
@@ -1193,8 +1196,8 @@
 
                 // Check with factory if another thread set a
                 // factory since our last check
-                if (!checkedWithFactory && factory != null) {
-                    handler2 = factory.createURLStreamHandler(protocol);
+                if (!checkedWithFactory && (fac = factory) != null) {
+                    handler2 = fac.createURLStreamHandler(protocol);
                 }
 
                 if (handler2 != null) {
--- a/jdk/src/share/classes/java/util/IdentityHashMap.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/java/util/IdentityHashMap.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -25,7 +25,6 @@
 
 package java.util;
 
-import java.io.*;
 import java.lang.reflect.Array;
 import java.util.function.BiConsumer;
 import java.util.function.BiFunction;
@@ -74,7 +73,7 @@
  * maximum size and the number of buckets is unspecified.
  *
  * <p>If the size of the map (the number of key-value mappings) sufficiently
- * exceeds the expected maximum size, the number of buckets is increased
+ * exceeds the expected maximum size, the number of buckets is increased.
  * Increasing the number of buckets ("rehashing") may be fairly expensive, so
  * it pays to create identity hash maps with a sufficiently large expected
  * maximum size.  On the other hand, iteration over collection views requires
@@ -160,6 +159,10 @@
      * The maximum capacity, used if a higher value is implicitly specified
      * by either of the constructors with arguments.
      * MUST be a power of two <= 1<<29.
+     *
+     * In fact, the map can hold no more than MAXIMUM_CAPACITY-1 items
+     * because it has to have at least one slot with the key == null
+     * in order to avoid infinite loops in get(), put(), remove()
      */
     private static final int MAXIMUM_CAPACITY = 1 << 29;
 
@@ -181,11 +184,6 @@
     transient int modCount;
 
     /**
-     * The next size value at which to resize (capacity * load factor).
-     */
-    private transient int threshold;
-
-    /**
      * Value representing null keys inside tables.
      */
     static final Object NULL_KEY = new Object();
@@ -229,27 +227,18 @@
     }
 
     /**
-     * Returns the appropriate capacity for the specified expected maximum
-     * size.  Returns the smallest power of two between MINIMUM_CAPACITY
-     * and MAXIMUM_CAPACITY, inclusive, that is greater than
-     * (3 * expectedMaxSize)/2, if such a number exists.  Otherwise
-     * returns MAXIMUM_CAPACITY.  If (3 * expectedMaxSize)/2 is negative, it
-     * is assumed that overflow has occurred, and MAXIMUM_CAPACITY is returned.
+     * Returns the appropriate capacity for the given expected maximum size.
+     * Returns the smallest power of two between MINIMUM_CAPACITY and
+     * MAXIMUM_CAPACITY, inclusive, that is greater than (3 *
+     * expectedMaxSize)/2, if such a number exists.  Otherwise returns
+     * MAXIMUM_CAPACITY.
      */
-    private int capacity(int expectedMaxSize) {
-        // Compute min capacity for expectedMaxSize given a load factor of 2/3
-        int minCapacity = (3 * expectedMaxSize)/2;
-
-        // Compute the appropriate capacity
-        int result;
-        if (minCapacity > MAXIMUM_CAPACITY || minCapacity < 0) {
-            result = MAXIMUM_CAPACITY;
-        } else {
-            result = MINIMUM_CAPACITY;
-            while (result < minCapacity)
-                result <<= 1;
-        }
-        return result;
+    private static int capacity(int expectedMaxSize) {
+        // assert expectedMaxSize >= 0;
+        return
+            (expectedMaxSize > MAXIMUM_CAPACITY / 3) ? MAXIMUM_CAPACITY :
+            (expectedMaxSize <= 2 * MINIMUM_CAPACITY / 3) ? MINIMUM_CAPACITY :
+            Integer.highestOneBit(expectedMaxSize + (expectedMaxSize << 1));
     }
 
     /**
@@ -262,7 +251,6 @@
         // assert initCapacity >= MINIMUM_CAPACITY;
         // assert initCapacity <= MAXIMUM_CAPACITY;
 
-        threshold = (initCapacity * 2)/3;
         table = new Object[2 * initCapacity];
     }
 
@@ -429,52 +417,58 @@
      * @see     #containsKey(Object)
      */
     public V put(K key, V value) {
-        Object k = maskNull(key);
-        Object[] tab = table;
-        int len = tab.length;
-        int i = hash(k, len);
+        final Object k = maskNull(key);
+
+        retryAfterResize: for (;;) {
+            final Object[] tab = table;
+            final int len = tab.length;
+            int i = hash(k, len);
 
-        Object item;
-        while ( (item = tab[i]) != null) {
-            if (item == k) {
-                @SuppressWarnings("unchecked")
-                    V oldValue = (V) tab[i + 1];
-                tab[i + 1] = value;
-                return oldValue;
+            for (Object item; (item = tab[i]) != null;
+                 i = nextKeyIndex(i, len)) {
+                if (item == k) {
+                    @SuppressWarnings("unchecked")
+                        V oldValue = (V) tab[i + 1];
+                    tab[i + 1] = value;
+                    return oldValue;
+                }
             }
-            i = nextKeyIndex(i, len);
-        }
+
+            final int s = size + 1;
+            // Use optimized form of 3 * s.
+            // Next capacity is len, 2 * current capacity.
+            if (s + (s << 1) > len && resize(len))
+                continue retryAfterResize;
 
-        modCount++;
-        tab[i] = k;
-        tab[i + 1] = value;
-        if (++size >= threshold)
-            resize(len); // len == 2 * current capacity.
-        return null;
+            modCount++;
+            tab[i] = k;
+            tab[i + 1] = value;
+            size = s;
+            return null;
+        }
     }
 
     /**
-     * Resize the table to hold given capacity.
+     * Resizes the table if necessary to hold given capacity.
      *
      * @param newCapacity the new capacity, must be a power of two.
+     * @return whether a resize did in fact take place
      */
-    private void resize(int newCapacity) {
+    private boolean resize(int newCapacity) {
         // assert (newCapacity & -newCapacity) == newCapacity; // power of 2
         int newLength = newCapacity * 2;
 
         Object[] oldTable = table;
         int oldLength = oldTable.length;
-        if (oldLength == 2*MAXIMUM_CAPACITY) { // can't expand any further
-            if (threshold == MAXIMUM_CAPACITY-1)
+        if (oldLength == 2 * MAXIMUM_CAPACITY) { // can't expand any further
+            if (size == MAXIMUM_CAPACITY - 1)
                 throw new IllegalStateException("Capacity exhausted.");
-            threshold = MAXIMUM_CAPACITY-1;  // Gigantic map!
-            return;
+            return false;
         }
         if (oldLength >= newLength)
-            return;
+            return false;
 
         Object[] newTable = new Object[newLength];
-        threshold = newLength / 3;
 
         for (int j = 0; j < oldLength; j += 2) {
             Object key = oldTable[j];
@@ -490,6 +484,7 @@
             }
         }
         table = newTable;
+        return true;
     }
 
     /**
@@ -504,8 +499,8 @@
         int n = m.size();
         if (n == 0)
             return;
-        if (n > threshold) // conservatively pre-expand
-            resize(capacity(n));
+        if (n > size)
+            resize(capacity(n)); // conservatively pre-expand
 
         for (Entry<? extends K, ? extends V> e : m.entrySet())
             put(e.getKey(), e.getValue());
@@ -542,7 +537,6 @@
                 return null;
             i = nextKeyIndex(i, len);
         }
-
     }
 
     /**
@@ -1266,8 +1260,8 @@
     private static final long serialVersionUID = 8188218128353913216L;
 
     /**
-     * Save the state of the <tt>IdentityHashMap</tt> instance to a stream
-     * (i.e., serialize it).
+     * Saves the state of the <tt>IdentityHashMap</tt> instance to a stream
+     * (i.e., serializes it).
      *
      * @serialData The <i>size</i> of the HashMap (the number of key-value
      *          mappings) (<tt>int</tt>), followed by the key (Object) and
@@ -1295,8 +1289,8 @@
     }
 
     /**
-     * Reconstitute the <tt>IdentityHashMap</tt> instance from a stream (i.e.,
-     * deserialize it).
+     * Reconstitutes the <tt>IdentityHashMap</tt> instance from a stream (i.e.,
+     * deserializes it).
      */
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException  {
@@ -1305,9 +1299,10 @@
 
         // Read in size (number of Mappings)
         int size = s.readInt();
-
-        // Allow for 33% growth (i.e., capacity is >= 2* size()).
-        init(capacity((size*4)/3));
+        if (size < 0)
+            throw new java.io.StreamCorruptedException
+                ("Illegal mappings count: " + size);
+        init(capacity(size));
 
         // Read the keys and values, and put the mappings in the table
         for (int i=0; i<size; i++) {
@@ -1324,7 +1319,7 @@
      * update modCount, etc.
      */
     private void putForCreate(K key, V value)
-        throws IOException
+        throws java.io.StreamCorruptedException
     {
         Object k = maskNull(key);
         Object[] tab = table;
--- a/jdk/src/share/classes/java/util/logging/FileHandler.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/java/util/logging/FileHandler.java	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 
 package java.util.logging;
 
+import static java.nio.file.StandardOpenOption.APPEND;
 import static java.nio.file.StandardOpenOption.CREATE_NEW;
 import static java.nio.file.StandardOpenOption.WRITE;
 
@@ -34,10 +35,17 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.channels.FileChannel;
+import java.nio.channels.OverlappingFileLockException;
 import java.nio.file.FileAlreadyExistsException;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * Simple file logging <tt>Handler</tt>.
@@ -149,7 +157,7 @@
     private FileChannel lockFileChannel;
     private File files[];
     private static final int MAX_LOCKS = 100;
-    private static final java.util.HashMap<String, String> locks = new java.util.HashMap<>();
+    private static final Set<String> locks = new HashSet<>();
 
     /**
      * A metered stream is a subclass of OutputStream that
@@ -428,34 +436,80 @@
             // between processes (and not within a process), we first check
             // if we ourself already have the file locked.
             synchronized(locks) {
-                if (locks.get(lockFileName) != null) {
+                if (locks.contains(lockFileName)) {
                     // We already own this lock, for a different FileHandler
                     // object.  Try again.
                     continue;
                 }
 
-                try {
-                    lockFileChannel = FileChannel.open(Paths.get(lockFileName),
-                            CREATE_NEW, WRITE);
-                } catch (FileAlreadyExistsException ix) {
-                    // try the next lock file name in the sequence
-                    continue;
+                final Path lockFilePath = Paths.get(lockFileName);
+                FileChannel channel = null;
+                int retries = -1;
+                boolean fileCreated = false;
+                while (channel == null && retries++ < 1) {
+                    try {
+                        channel = FileChannel.open(lockFilePath,
+                                CREATE_NEW, WRITE);
+                        fileCreated = true;
+                    } catch (FileAlreadyExistsException ix) {
+                        // This may be a zombie file left over by a previous
+                        // execution. Reuse it - but only if we can actually
+                        // write to its directory.
+                        // Note that this is a situation that may happen,
+                        // but not too frequently.
+                        if (Files.isRegularFile(lockFilePath, LinkOption.NOFOLLOW_LINKS)
+                            && Files.isWritable(lockFilePath.getParent())) {
+                            try {
+                                channel = FileChannel.open(lockFilePath,
+                                    WRITE, APPEND);
+                            } catch (NoSuchFileException x) {
+                                // Race condition - retry once, and if that
+                                // fails again just try the next name in
+                                // the sequence.
+                                continue;
+                            } catch(IOException x) {
+                                // the file may not be writable for us.
+                                // try the next name in the sequence
+                                break;
+                            }
+                        } else {
+                            // at this point channel should still be null.
+                            // break and try the next name in the sequence.
+                            break;
+                        }
+                    }
                 }
 
+                if (channel == null) continue; // try the next name;
+                lockFileChannel = channel;
+
                 boolean available;
                 try {
                     available = lockFileChannel.tryLock() != null;
                     // We got the lock OK.
+                    // At this point we could call File.deleteOnExit().
+                    // However, this could have undesirable side effects
+                    // as indicated by JDK-4872014. So we will instead
+                    // rely on the fact that close() will remove the lock
+                    // file and that whoever is creating FileHandlers should
+                    // be responsible for closing them.
                 } catch (IOException ix) {
                     // We got an IOException while trying to get the lock.
                     // This normally indicates that locking is not supported
                     // on the target directory.  We have to proceed without
-                    // getting a lock.   Drop through.
-                    available = true;
+                    // getting a lock.   Drop through, but only if we did
+                    // create the file...
+                    available = fileCreated;
+                } catch (OverlappingFileLockException x) {
+                    // someone already locked this file in this VM, through
+                    // some other channel - that is - using something else
+                    // than new FileHandler(...);
+                    // continue searching for an available lock.
+                    available = false;
                 }
                 if (available) {
                     // We got the lock.  Remember it.
-                    locks.put(lockFileName, lockFileName);
+                    locks.add(lockFileName);
                     break;
                 }
 
--- a/jdk/src/share/classes/javax/crypto/spec/SecretKeySpec.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/crypto/spec/SecretKeySpec.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -26,6 +26,7 @@
 package javax.crypto.spec;
 
 import java.security.spec.KeySpec;
+import java.util.Locale;
 import javax.crypto.SecretKey;
 
 /**
@@ -194,7 +195,8 @@
         if (this.algorithm.equalsIgnoreCase("TripleDES"))
             return (retval ^= "desede".hashCode());
         else
-            return (retval ^= this.algorithm.toLowerCase().hashCode());
+            return (retval ^=
+                    this.algorithm.toLowerCase(Locale.ENGLISH).hashCode());
     }
 
    /**
--- a/jdk/src/share/classes/javax/security/sasl/SaslClient.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/security/sasl/SaslClient.java	Wed Jul 05 19:50:06 2017 +0200
@@ -204,6 +204,10 @@
      * This method can be called only after the authentication exchange has
      * completed (i.e., when {@code isComplete()} returns true); otherwise, an
      * {@code IllegalStateException} is thrown.
+     * <p>
+     * The {@link Sasl} class includes several well-known property names
+     * (For example, {@link Sasl#QOP}). A SASL provider can support other
+     * properties which are specific to the vendor and/or a mechanism.
      *
      * @param propName The non-null property name.
      * @return The value of the negotiated property. If null, the property was
--- a/jdk/src/share/classes/javax/security/sasl/SaslServer.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/security/sasl/SaslServer.java	Wed Jul 05 19:50:06 2017 +0200
@@ -196,6 +196,10 @@
      * This method can be called only after the authentication exchange has
      * completed (i.e., when {@code isComplete()} returns true); otherwise, an
      * {@code IllegalStateException} is thrown.
+     * <p>
+     * The {@link Sasl} class includes several well-known property names
+     * (For example, {@link Sasl#QOP}). A SASL provider can support other
+     * properties which are specific to the vendor and/or a mechanism.
      *
      * @param propName the property
      * @return The value of the negotiated property. If null, the property was
--- a/jdk/src/share/classes/javax/swing/AbstractListModel.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/AbstractListModel.java	Wed Jul 05 19:50:06 2017 +0200
@@ -202,6 +202,7 @@
      * If no such listeners exist,
      * this method returns an empty array.
      *
+     * @param <T> the type of {@code EventListener} class being requested
      * @param listenerType  the type of listeners requested;
      *          this parameter should specify an interface
      *          that descends from <code>java.util.EventListener</code>
--- a/jdk/src/share/classes/javax/swing/CellRendererPane.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/CellRendererPane.java	Wed Jul 05 19:50:06 2017 +0200
@@ -190,8 +190,12 @@
 // Accessibility support
 ////////////////
 
+    /**
+     * {@code AccessibleContext} associated with this {@code CellRendererPan}
+     */
     protected AccessibleContext accessibleContext = null;
 
+
     /**
      * Gets the AccessibleContext associated with this CellRendererPane.
      * For CellRendererPanes, the AccessibleContext takes the form of an
--- a/jdk/src/share/classes/javax/swing/DefaultCellEditor.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/DefaultCellEditor.java	Wed Jul 05 19:50:06 2017 +0200
@@ -353,6 +353,7 @@
         * Returns true to indicate that editing has begun.
         *
         * @param anEvent          the event
+        * @return true to indicate editing has begun
         */
         public boolean startCellEditing(EventObject anEvent) {
             return true;
--- a/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/DefaultDesktopManager.java	Wed Jul 05 19:50:06 2017 +0200
@@ -462,7 +462,12 @@
         f.revalidate();
     }
 
-    /** Convenience method to remove the desktopIcon of <b>f</b> is necessary. */
+    /**
+     * Convenience method to remove the desktopIcon of <b>f</b> is necessary.
+     *
+     * @param f the {@code JInternalFrame} for which to remove the
+     *          {@code desktopIcon}
+     */
     protected void removeIconFor(JInternalFrame f) {
         JInternalFrame.JDesktopIcon di = f.getDesktopIcon();
         Container c = di.getParent();
@@ -472,10 +477,13 @@
         }
     }
 
-    /** The iconifyFrame() code calls this to determine the proper bounds
-      * for the desktopIcon.
-      */
-
+    /**
+     * The {@code iconifyFrame()} code calls this to determine the proper bounds
+     * for the desktopIcon.
+     *
+     * @param f the {@code JInternalFrame} of interest
+     * @return a {@code Rectangle} containing bounds for the {@code desktopIcon}
+     */
     protected Rectangle getBoundsForIconOf(JInternalFrame f) {
       //
       // Get the icon for this internal frame and its preferred size
@@ -592,6 +600,9 @@
     /**
      * Sets that the component has been iconized and the bounds of the
      * <code>desktopIcon</code> are valid.
+     *
+     * @param f     the {@code JInternalFrame} of interest
+     * @param value a {@code Boolean} signifying if component has been iconized
      */
     protected void setWasIcon(JInternalFrame f, Boolean value)  {
         if (value != null) {
--- a/jdk/src/share/classes/javax/swing/DefaultListModel.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/DefaultListModel.java	Wed Jul 05 19:50:06 2017 +0200
@@ -444,6 +444,7 @@
      * (<code>index &lt; 0 || index &gt;= size()</code>).
      *
      * @param index index of element to return
+     * @return the element at the specified position in this list
      */
     public E get(int index) {
         return delegate.elementAt(index);
--- a/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/DefaultListSelectionModel.java	Wed Jul 05 19:50:06 2017 +0200
@@ -160,6 +160,9 @@
      * Notifies <code>ListSelectionListeners</code> that the value
      * of the selection, in the closed interval <code>firstIndex</code>,
      * <code>lastIndex</code>, has changed.
+     *
+     * @param firstIndex the first index in the interval
+     * @param lastIndex the last index in the interval
      */
     protected void fireValueChanged(int firstIndex, int lastIndex) {
         fireValueChanged(firstIndex, lastIndex, getValueIsAdjusting());
@@ -231,6 +234,7 @@
      * If no such listeners exist,
      * this method returns an empty array.
      *
+     * @param <T> the type of {@code EventListener} class being requested
      * @param listenerType  the type of listeners requested;
      *          this parameter should specify an interface
      *          that descends from <code>java.util.EventListener</code>
@@ -332,6 +336,8 @@
 
     /**
      * Sets the value of the leadAnchorNotificationEnabled flag.
+     *
+     * @param flag boolean value for {@code leadAnchorNotificationEnabled}
      * @see             #isLeadAnchorNotificationEnabled()
      */
     public void setLeadAnchorNotificationEnabled(boolean flag) {
--- a/jdk/src/share/classes/javax/swing/DefaultRowSorter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/DefaultRowSorter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -712,6 +712,8 @@
      *
      * @param column the index of the column to test, in terms of the
      *        underlying model
+     * @return true if values are to be converted to strings before doing
+     *              comparisons when sorting
      * @throws IndexOutOfBoundsException if <code>column</code> is not valid
      */
     protected boolean useToString(int column) {
--- a/jdk/src/share/classes/javax/swing/InputMap.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/InputMap.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -32,15 +32,12 @@
 import java.util.Set;
 
 /**
- * <code>InputMap</code> provides a binding between an input event
- * (currently only <code>KeyStroke</code>s are used)
- * and an <code>Object</code>. <code>InputMap</code>s
- * are usually used with an <code>ActionMap</code>,
- * to determine an <code>Action</code> to perform
- * when a key is pressed.
- * An <code>InputMap</code> can have a parent
- * that is searched for bindings not defined in the <code>InputMap</code>.
- * <p>As with <code>ActionMap</code> if you create a cycle, eg:
+ * {@code InputMap} provides a binding between an input event (currently only
+ * {@code KeyStroke}s are used) and an {@code Object}. {@code InputMap}s are
+ * usually used with an {@code ActionMap}, to determine an {@code Action} to
+ * perform when a key is pressed. An {@code InputMap} can have a parent that
+ * is searched for bindings not defined in the {@code InputMap}.
+ * <p>As with {@code ActionMap} if you create a cycle, eg:
  * <pre>
  *   InputMap am = new InputMap();
  *   InputMap bm = new InputMap():
@@ -61,34 +58,37 @@
 
 
     /**
-     * Creates an <code>InputMap</code> with no parent and no mappings.
+     * Creates an {@code InputMap} with no parent and no mappings.
      */
     public InputMap() {
     }
 
     /**
-     * Sets this <code>InputMap</code>'s parent.
+     * Sets this {@code InputMap}'s parent.
      *
-     * @param map  the <code>InputMap</code> that is the parent of this one
+     * @param map the {@code InputMap} that is the parent of this one
      */
     public void setParent(InputMap map) {
         this.parent = map;
     }
 
     /**
-     * Gets this <code>InputMap</code>'s parent.
+     * Gets this {@code InputMap}'s parent.
      *
-     * @return map  the <code>InputMap</code> that is the parent of this one,
-     *              or null if this <code>InputMap</code> has no parent
+     * @return map the {@code InputMap} that is the parent of this one,
+     *             or null if this {@code InputMap} has no parent
      */
     public InputMap getParent() {
         return parent;
     }
 
     /**
-     * Adds a binding for <code>keyStroke</code> to <code>actionMapKey</code>.
-     * If <code>actionMapKey</code> is null, this removes the current binding
-     * for <code>keyStroke</code>.
+     * Adds a binding for {@code keyStroke} to {@code actionMapKey}.
+     * If {@code actionMapKey} is null, this removes the current binding
+     * for {@code keyStroke}.
+     *
+     * @param keyStroke a {@code KeyStroke}
+     * @param actionMapKey an action map key
      */
     public void put(KeyStroke keyStroke, Object actionMapKey) {
         if (keyStroke == null) {
@@ -106,8 +106,11 @@
     }
 
     /**
-     * Returns the binding for <code>keyStroke</code>, messaging the
-     * parent <code>InputMap</code> if the binding is not locally defined.
+     * Returns the binding for {@code keyStroke}, messaging the
+     * parent {@code InputMap} if the binding is not locally defined.
+     *
+     * @param keyStroke the {@code KeyStroke} for which to get the binding
+     * @return the binding for {@code keyStroke}
      */
     public Object get(KeyStroke keyStroke) {
         if (arrayTable == null) {
@@ -131,8 +134,9 @@
     }
 
     /**
-     * Removes the binding for <code>key</code> from this
-     * <code>InputMap</code>.
+     * Removes the binding for {@code key} from this {@code InputMap}.
+     *
+     * @param key the {@code KeyStroke} for which to remove the binding
      */
     public void remove(KeyStroke key) {
         if (arrayTable != null) {
@@ -141,7 +145,7 @@
     }
 
     /**
-     * Removes all the mappings from this <code>InputMap</code>.
+     * Removes all the mappings from this {@code InputMap}.
      */
     public void clear() {
         if (arrayTable != null) {
@@ -150,7 +154,10 @@
     }
 
     /**
-     * Returns the <code>KeyStroke</code>s that are bound in this <code>InputMap</code>.
+     * Returns the {@code KeyStroke}s that are bound in this {@code InputMap}.
+     *
+     * @return an array of the {@code KeyStroke}s that are bound in this
+     *         {@code InputMap}
      */
     public KeyStroke[] keys() {
         if (arrayTable == null) {
@@ -162,7 +169,9 @@
     }
 
     /**
-     * Returns the number of <code>KeyStroke</code> bindings.
+     * Returns the number of {@code KeyStroke} bindings.
+     *
+     * @return the number of {@code KeyStroke} bindings
      */
     public int size() {
         if (arrayTable == null) {
@@ -172,9 +181,12 @@
     }
 
     /**
-     * Returns an array of the <code>KeyStroke</code>s defined in this
-     * <code>InputMap</code> and its parent. This differs from <code>keys()</code> in that
-     * this method includes the keys defined in the parent.
+     * Returns an array of the {@code KeyStroke}s defined in this
+     * {@code InputMap} and its parent. This differs from {@code keys()}
+     * in that this method includes the keys defined in the parent.
+     *
+     * @return an array of the {@code KeyStroke}s defined in this
+     *         {@code InputMap} and its parent
      */
     public KeyStroke[] allKeys() {
         int             count = size();
--- a/jdk/src/share/classes/javax/swing/JCheckBox.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JCheckBox.java	Wed Jul 05 19:50:06 2017 +0200
@@ -132,6 +132,7 @@
      * Creates a check box where properties are taken from the
      * Action supplied.
      *
+     * @param a the {@code Action} used to specify the new check box
      * @since 1.3
      */
     public JCheckBox(Action a) {
--- a/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JCheckBoxMenuItem.java	Wed Jul 05 19:50:06 2017 +0200
@@ -109,7 +109,7 @@
     /**
      * Creates an initially unselected check box menu item with an icon.
      *
-     * @param icon the icon of the CheckBoxMenuItem.
+     * @param icon the icon of the {@code JCheckBoxMenuItem}.
      */
     public JCheckBoxMenuItem(Icon icon) {
         this(null, icon, false);
@@ -118,7 +118,7 @@
     /**
      * Creates an initially unselected check box menu item with text.
      *
-     * @param text the text of the CheckBoxMenuItem
+     * @param text the text of the {@code JCheckBoxMenuItem}
      */
     public JCheckBoxMenuItem(String text) {
         this(text, null, false);
@@ -128,6 +128,7 @@
      * Creates a menu item whose properties are taken from the
      * Action supplied.
      *
+     * @param a the action of the {@code JCheckBoxMenuItem}
      * @since 1.3
      */
     public JCheckBoxMenuItem(Action a) {
@@ -138,8 +139,8 @@
     /**
      * Creates an initially unselected check box menu item with the specified text and icon.
      *
-     * @param text the text of the CheckBoxMenuItem
-     * @param icon the icon of the CheckBoxMenuItem
+     * @param text the text of the {@code JCheckBoxMenuItem}
+     * @param icon the icon of the {@code JCheckBoxMenuItem}
      */
     public JCheckBoxMenuItem(String text, Icon icon) {
         this(text, icon, false);
--- a/jdk/src/share/classes/javax/swing/JEditorPane.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JEditorPane.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1251,11 +1251,12 @@
     }
 
     /**
-     * Returns the currently registered <code>EditorKit</code>
-     * class name for the type <code>type</code>.
+     * Returns the currently registered {@code EditorKit} class name for the
+     * type {@code type}.
      *
-     * @param type  the non-<code>null</code> content type
-     *
+     * @param type  the non-{@code null} content type
+     * @return a {@code String} containing the {@code EditorKit} class name
+     *         for {@code type}
      * @since 1.3
      */
     public static String getEditorKitClassNameForContentType(String type) {
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java	Wed Jul 05 19:50:06 2017 +0200
@@ -330,6 +330,8 @@
     /**
      * Constructs a <code>JFileChooser</code> using the given
      * <code>FileSystemView</code>.
+     *
+     * @param fsv a {@code FileSystemView}
      */
     public JFileChooser(FileSystemView fsv) {
         this((File) null, fsv);
@@ -339,6 +341,10 @@
     /**
      * Constructs a <code>JFileChooser</code> using the given current directory
      * and <code>FileSystemView</code>.
+     *
+     * @param currentDirectory a {@code File} object specifying the path to a
+     *                         file or directory
+     * @param fsv a {@code FileSystemView}
      */
     public JFileChooser(File currentDirectory, FileSystemView fsv) {
         setup(fsv);
@@ -348,6 +354,10 @@
     /**
      * Constructs a <code>JFileChooser</code> using the given current directory
      * path and <code>FileSystemView</code>.
+     *
+     * @param currentDirectoryPath a {@code String} specifying the path to a file
+     *                             or directory
+     * @param fsv a {@code FileSystemView}
      */
     public JFileChooser(String currentDirectoryPath, FileSystemView fsv) {
         setup(fsv);
@@ -360,6 +370,8 @@
 
     /**
      * Performs common constructor initialization and setup.
+     *
+     * @param view the {@code FileSystemView} used for setup
      */
     protected void setup(FileSystemView view) {
         installShowFilesListener();
@@ -512,6 +524,8 @@
     /**
      * Returns a list of selected files if the file chooser is
      * set to allow multiple selection.
+     *
+     * @return an array of selected {@code File}s
      */
     public File[] getSelectedFiles() {
         if(selectedFiles == null) {
@@ -525,6 +539,7 @@
      * Sets the list of selected files if the file chooser is
      * set to allow multiple selection.
      *
+     * @param selectedFiles an array {@code File}s to be selected
      * @beaninfo
      *       bound: true
      * description: The list of selected files if the chooser is in multiple selection mode.
@@ -971,6 +986,7 @@
     /**
      * Gets the string that goes in the <code>JFileChooser</code>'s titlebar.
      *
+     * @return the string from the {@code JFileChooser} window's title bar
      * @see #setDialogTitle
      */
     public String getDialogTitle() {
@@ -1158,6 +1174,8 @@
      * Removes a filter from the list of user choosable file filters. Returns
      * true if the file filter was removed.
      *
+     * @param f the file filter to be removed
+     * @return true if the file filter was removed, false otherwise
      * @see #addChoosableFileFilter
      * @see #getChoosableFileFilters
      * @see #resetChoosableFileFilters
@@ -1215,6 +1233,8 @@
     /**
      * Returns the <code>AcceptAll</code> file filter.
      * For example, on Microsoft Windows this would be All Files (*.*).
+     *
+     * @return the {@code AcceptAll} file filter
      */
     public FileFilter getAcceptAllFileFilter() {
         FileFilter filter = null;
@@ -1240,8 +1260,10 @@
     * If false, the <code>AcceptAll</code> file filter is removed from
     * the list of available file filters.
     * If true, the <code>AcceptAll</code> file filter will become the
-    * the actively used file filter.
+    * actively used file filter.
     *
+    * @param b a {@code boolean} which determines whether the {@code AcceptAll}
+    *          file filter is an available choice in the choosable filter list
     * @beaninfo
     *   preferred: true
     *       bound: true
@@ -1284,6 +1306,7 @@
      * any listeners that the accessory might have registered with the
      * file chooser.
      *
+     * @param newAccessory the accessory component to be set
      * @beaninfo
      *   preferred: true
      *       bound: true
@@ -1355,6 +1378,7 @@
      * Convenience call that determines if files are selectable based on the
      * current file selection mode.
      *
+     * @return true if files are selectable, false otherwise
      * @see #setFileSelectionMode
      * @see #getFileSelectionMode
      */
@@ -1366,6 +1390,7 @@
      * Convenience call that determines if directories are selectable based
      * on the current file selection mode.
      *
+     * @return true if directories are selectable, false otherwise
      * @see #setFileSelectionMode
      * @see #getFileSelectionMode
      */
@@ -1487,9 +1512,10 @@
     }
 
     /**
-     * Sets the file view to used to retrieve UI information, such as
+     * Sets the file view to be used to retrieve UI information, such as
      * the icon that represents a file or the type description of a file.
      *
+     * @param fileView a {@code FileView} to be used to retrieve UI information
      * @beaninfo
      *   preferred: true
      *       bound: true
@@ -1506,6 +1532,7 @@
     /**
      * Returns the current file view.
      *
+     * @return the current file view
      * @see #setFileView
      */
     public FileView getFileView() {
@@ -1765,6 +1792,8 @@
      * notification on this event type. The event instance
      * is lazily created using the <code>command</code> parameter.
      *
+     * @param command a string that may specify a command associated with
+     *                the event
      * @see EventListenerList
      */
     protected void fireActionPerformed(String command) {
@@ -1973,6 +2002,9 @@
 // Accessibility support
 ////////////////
 
+    /**
+     * {@code AccessibleContext} associated with this {@code JFileChooser}
+     */
     protected AccessibleContext accessibleContext = null;
 
     /**
--- a/jdk/src/share/classes/javax/swing/JFrame.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JFrame.java	Wed Jul 05 19:50:06 2017 +0200
@@ -275,6 +275,8 @@
     /**
      * Called by the constructor methods to create the default
      * <code>rootPane</code>.
+     *
+     * @return a new {@code JRootPane}
      */
     protected JRootPane createRootPane() {
         JRootPane rp = new JRootPane();
@@ -874,7 +876,9 @@
 // Accessibility support
 ////////////////
 
-    /** The accessible context property. */
+    /**
+     * The accessible context property.
+     */
     protected AccessibleContext accessibleContext = null;
 
     /**
--- a/jdk/src/share/classes/javax/swing/JMenu.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JMenu.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -608,16 +608,18 @@
      * it to the end of this menu.
      *
      * @param s the string for the menu item to be added
+     * @return the new {@code JMenuItem}
      */
     public JMenuItem add(String s) {
         return add(new JMenuItem(s));
     }
 
     /**
-     * Creates a new menu item attached to the specified
-     * <code>Action</code> object and appends it to the end of this menu.
+     * Creates a new menu item attached to the specified {@code Action} object
+     * and appends it to the end of this menu.
      *
-     * @param a the <code>Action</code> for the menu item to be added
+     * @param a the {@code Action} for the menu item to be added
+     * @return the new {@code JMenuItem}
      * @see Action
      */
     public JMenuItem add(Action a) {
@@ -653,8 +655,11 @@
     }
 
     /**
-     * Returns a properly configured <code>PropertyChangeListener</code>
-     * which updates the control as changes to the <code>Action</code> occur.
+     * Returns a properly configured {@code PropertyChangeListener}
+     * which updates the control as changes to the {@code Action} occur.
+     *
+     * @param b a menu item for which to create a {@code PropertyChangeListener}
+     * @return a {@code PropertyChangeListener} for {@code b}
      */
     protected PropertyChangeListener createActionChangeListener(JMenuItem b) {
         return b.createActionPropertyChangeListener0(b.getAction());
@@ -714,6 +719,7 @@
      * @param a the <code>Action</code> object for the menu item to add
      * @param pos an integer specifying the position at which to add the
      *               new menu item
+     * @return the new menu item
      * @exception IllegalArgumentException if the value of
      *                  <code>pos</code> &lt; 0
      */
@@ -748,16 +754,16 @@
     }
 
     /**
-     * Returns the <code>JMenuItem</code> at the specified position.
-     * If the component at <code>pos</code> is not a menu item,
-     * <code>null</code> is returned.
+     * Returns the {@code JMenuItem} at the specified position.
+     * If the component at {@code pos} is not a menu item,
+     * {@code null} is returned.
      * This method is included for AWT compatibility.
      *
-     * @param pos    an integer specifying the position
-     * @exception   IllegalArgumentException if the value of
-     *                       <code>pos</code> &lt; 0
+     * @param pos  an integer specifying the position
      * @return  the menu item at the specified position; or <code>null</code>
      *          if the item as the specified position is not a menu item
+     * @exception  IllegalArgumentException if the value of
+     *             {@code pos} &lt; 0
      */
     public JMenuItem getItem(int pos) {
         if (pos < 0) {
@@ -975,6 +981,8 @@
     /**
      * Returns the popupmenu associated with this menu.  If there is
      * no popupmenu, it will create one.
+     *
+     * @return the {@code JPopupMenu} associated with this menu
      */
     public JPopupMenu getPopupMenu() {
         ensurePopupMenuCreated();
@@ -1159,6 +1167,8 @@
         JPopupMenu popupMenu;
         /**
          *  Create the window listener for the specified popup.
+         *
+         * @param p the popup menu for which to create a listener
          * @since 1.4
          */
         public WinListener(JPopupMenu p) {
--- a/jdk/src/share/classes/javax/swing/JMenuBar.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JMenuBar.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -124,6 +124,8 @@
 
     /**
      * Returns the menubar's current UI.
+     *
+     * @return a {@code MenuBarUI} which is the menubar's current L&amp;F object
      * @see #setUI
      */
     public MenuBarUI getUI() {
--- a/jdk/src/share/classes/javax/swing/JSlider.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JSlider.java	Wed Jul 05 19:50:06 2017 +0200
@@ -281,6 +281,8 @@
     /**
      * Creates a horizontal slider using the specified
      * BoundedRangeModel.
+     *
+     * @param brm a {@code BoundedRangeModel} for the slider
      */
     public JSlider(BoundedRangeModel brm)
     {
@@ -363,6 +365,8 @@
      * {@code fireStateChanged} method to forward {@code ChangeEvent}s
      * to the {@code ChangeListener}s that have been added directly to the
      * slider.
+     *
+     * @return a instance of new {@code ChangeListener}
      * @see #changeListener
      * @see #fireStateChanged
      * @see javax.swing.event.ChangeListener
--- a/jdk/src/share/classes/javax/swing/JTabbedPane.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JTabbedPane.java	Wed Jul 05 19:50:06 2017 +0200
@@ -278,6 +278,7 @@
      * can override this to return a subclass of <code>ModelListener</code> or
      * another <code>ChangeListener</code> implementation.
      *
+     * @return a {@code ChangeListener}
      * @see #fireStateChanged
      */
     protected ChangeListener createChangeListener() {
@@ -423,6 +424,7 @@
     /**
      * Returns the model associated with this tabbedpane.
      *
+     * @return the {@code SingleSelectionModel} associated with this tabbedpane
      * @see #setModel
      */
     public SingleSelectionModel getModel() {
@@ -459,6 +461,8 @@
 
     /**
      * Returns the placement of the tabs for this tabbedpane.
+     *
+     * @return an {@code int} specifying the placement for the tabs
      * @see #setTabPlacement
      */
     public int getTabPlacement() {
@@ -507,6 +511,8 @@
     /**
      * Returns the policy used by the tabbedpane to layout the tabs when all the
      * tabs will not fit within a single run.
+     *
+     * @return an {@code int} specifying the policy used to layout the tabs
      * @see #setTabLayoutPolicy
      * @since 1.4
      */
@@ -664,6 +670,7 @@
      * will automatically set the <code>selectedIndex</code> to the index
      * corresponding to the specified component.
      *
+     * @param c the selected {@code Component} for this {@code TabbedPane}
      * @exception IllegalArgumentException if component not found in tabbed
      *          pane
      * @see #getSelectedComponent
--- a/jdk/src/share/classes/javax/swing/JTable.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/JTable.java	Wed Jul 05 19:50:06 2017 +0200
@@ -865,6 +865,8 @@
     /**
      * Equivalent to <code>new JScrollPane(aTable)</code>.
      *
+     * @param aTable a {@code JTable} to be used for the scroll pane
+     * @return a {@code JScrollPane} created using {@code aTable}
      * @deprecated As of Swing version 1.0.2,
      * replaced by <code>new JScrollPane(aTable)</code>.
      */
@@ -1961,6 +1963,7 @@
      * <code>JList</code>. See the <code>setSelectionMode</code> method
      * in <code>JList</code> for details about the modes.
      *
+     * @param selectionMode the mode used by the row and column selection models
      * @see JList#setSelectionMode
      * @beaninfo
      * description: The selection mode used by the row and column selection models.
@@ -2321,6 +2324,7 @@
      * Returns true if the specified index is in the valid range of rows,
      * and the row at that index is selected.
      *
+     * @param row a row in the row model
      * @return true if <code>row</code> is a valid index and the row at
      *              that index is selected (where 0 is the first row)
      */
@@ -3174,6 +3178,8 @@
 
     /**
      * Sizes the table columns to fit the available space.
+     *
+     * @param lastColumnOnly determines whether to resize last column only
      * @deprecated As of Swing version 1.0.3,
      * replaced by <code>doLayout()</code>.
      * @see #doLayout
@@ -6692,7 +6698,7 @@
 
     // Listeners to echo changes to the AccessiblePropertyChange mechanism
 
-        /*
+        /**
          * Describes a change in the accessible table model.
          */
         protected class AccessibleJTableModelChange
@@ -6737,6 +6743,8 @@
 
         /**
          * Track changes to the table contents
+         *
+         * @param e a {@code TableModelEvent} describing the event
          */
         public void tableChanged(TableModelEvent e) {
            firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
@@ -6764,6 +6772,8 @@
 
         /**
          * Track changes to the table contents (row insertions)
+         *
+         * @param e a {@code TableModelEvent} describing the event
          */
         public void tableRowsInserted(TableModelEvent e) {
            firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
@@ -6789,6 +6799,8 @@
 
         /**
          * Track changes to the table contents (row deletions)
+         *
+         * @param e a {@code TableModelEvent} describing the event
          */
         public void tableRowsDeleted(TableModelEvent e) {
            firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY,
@@ -7922,6 +7934,11 @@
 
             /**
              *  Constructs an <code>AccessibleJTableHeaderEntry</code>.
+             *
+             * @param t a {@code JTable}
+             * @param r an {@code int} specifying a row
+             * @param c an {@code int} specifying a column
+             * @param i an {@code int} specifying the index to this cell
              * @since 1.4
              */
             public AccessibleJTableCell(JTable t, int r, int c, int i) {
--- a/jdk/src/share/classes/javax/swing/MenuElement.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/MenuElement.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -29,7 +29,7 @@
 
 /**
  * Any component that can be placed into a menu should implement this interface.
- * This interface is used by <code>MenuSelectionManager</code>
+ * This interface is used by {@code MenuSelectionManager}
  * to handle selection and navigation in menu hierarchies.
  *
  * @author Arnaud Weber
@@ -39,46 +39,56 @@
 public interface MenuElement {
 
     /**
-     * Processes a mouse event. <code>event</code> is a <code>MouseEvent</code>
-     * with source being the receiving element's component.
-     * <code>path</code> is the path of the receiving element in the menu
-     * hierarchy including the receiving element itself.
-     * <code>manager</code> is the <code>MenuSelectionManager</code>
-     * for the menu hierarchy.
-     * This method should process the <code>MouseEvent</code> and change
-     * the menu selection if necessary
-     * by using <code>MenuSelectionManager</code>'s API
-     * Note: you do not have to forward the event to sub-components.
-     * This is done automatically by the <code>MenuSelectionManager</code>.
+     * Processes a mouse event. {@code event} is a {@code MouseEvent} with
+     * source being the receiving element's component. {@code path} is the
+     * path of the receiving element in the menu hierarchy including the
+     * receiving element itself. {@code manager} is the
+     * {@code MenuSelectionManager}for the menu hierarchy. This method should
+     * process the {@code MouseEvent} and change the menu selection if necessary
+     * by using {@code MenuSelectionManager}'s API Note: you do not have to
+     * forward the event to sub-components. This is done automatically by the
+     * {@code MenuSelectionManager}.
+     *
+     * @param event a {@code MouseEvent} to be processed
+     * @param path the path of the receiving element in the menu hierarchy
+     * @param manager the {@code MenuSelectionManager} for the menu hierarchy
      */
-    public void processMouseEvent(MouseEvent event,MenuElement path[],MenuSelectionManager manager);
+    public void processMouseEvent(MouseEvent event, MenuElement path[], MenuSelectionManager manager);
 
 
     /**
      *  Process a key event.
+     *
+     * @param event a {@code KeyEvent} to be processed
+     * @param path the path of the receiving element in the menu hierarchy
+     * @param manager the {@code MenuSelectionManager} for the menu hierarchy
      */
-    public void processKeyEvent(KeyEvent event,MenuElement path[],MenuSelectionManager manager);
+    public void processKeyEvent(KeyEvent event, MenuElement path[], MenuSelectionManager manager);
 
     /**
-     * Call by the <code>MenuSelectionManager</code> when the
-     * <code>MenuElement</code> is added or remove from
-     * the menu selection.
+     * Call by the {@code MenuSelectionManager} when the {@code MenuElement} is
+     * added or removed from the menu selection.
+     *
+     * @param isIncluded can be used to indicate if this {@code MenuElement} is
+     *        active (if it is a menu) or is on the part of the menu path that
+     *        changed (if it is a menu item).
      */
     public void menuSelectionChanged(boolean isIncluded);
 
     /**
-     * This method should return an array containing the sub-elements for the receiving menu element
+     * This method should return an array containing the sub-elements for the
+     * receiving menu element.
      *
-     * @return an array of MenuElements
+     * @return an array of {@code MenuElement}s
      */
     public MenuElement[] getSubElements();
 
     /**
-     * This method should return the java.awt.Component used to paint the receiving element.
-     * The returned component will be used to convert events and detect if an event is inside
-     * a MenuElement's component.
+     * This method should return the {@code java.awt.Component} used to paint the
+     * receiving element. The returned component will be used to convert events
+     * and detect if an event is inside a {@code MenuElement}'s component.
      *
-     * @return the Component value
+     * @return the {@code Component} value
      */
     public Component getComponent();
 }
--- a/jdk/src/share/classes/javax/swing/MenuSelectionManager.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/MenuSelectionManager.java	Wed Jul 05 19:50:06 2017 +0200
@@ -80,6 +80,7 @@
      * generated is always "this".
      */
     protected transient ChangeEvent changeEvent = null;
+    /** The collection of registered listeners */
     protected EventListenerList listenerList = new EventListenerList();
 
     /**
@@ -477,7 +478,11 @@
     }
 
     /**
-     * Return true if c is part of the currently used menu
+     * Return true if {@code c} is part of the currently used menu
+     *
+     * @param c a {@code Component}
+     * @return true if {@code c} is part of the currently used menu,
+     *         false otherwise
      */
     public boolean isComponentPartOfCurrentMenu(Component c) {
         if(selection.size() > 0) {
--- a/jdk/src/share/classes/javax/swing/RowFilter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/RowFilter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -159,6 +159,8 @@
      * {@link java.util.regex.Pattern} for a complete description of
      * the supported regular-expression constructs.
      *
+     * @param <M> the type of the model to which the {@code RowFilter} applies
+     * @param <I> the type of the identifier passed to the {@code RowFilter}
      * @param regex the regular expression to filter on
      * @param indices the indices of the values to check.  If not supplied all
      *               values are evaluated
@@ -186,6 +188,8 @@
      *   RowFilter.dateFilter(ComparisonType.AFTER, new Date());
      * </pre>
      *
+     * @param <M> the type of the model to which the {@code RowFilter} applies
+     * @param <I> the type of the identifier passed to the {@code RowFilter}
      * @param type the type of comparison to perform
      * @param date the date to compare against
      * @param indices the indices of the values to check.  If not supplied all
@@ -214,7 +218,10 @@
      *   RowFilter.numberFilter(ComparisonType.EQUAL, 10);
      * </pre>
      *
+     * @param <M> the type of the model to which the {@code RowFilter} applies
+     * @param <I> the type of the identifier passed to the {@code RowFilter}
      * @param type the type of comparison to perform
+     * @param number a {@code Number} value to compare against
      * @param indices the indices of the values to check.  If not supplied all
      *               values are evaluated
      * @return a <code>RowFilter</code> implementing the specified criteria
@@ -241,6 +248,8 @@
      *   RowFilter&lt;Object,Object&gt; fooBarFilter = RowFilter.orFilter(filters);
      * </pre>
      *
+     * @param <M> the type of the model to which the {@code RowFilter} applies
+     * @param <I> the type of the identifier passed to the {@code RowFilter}
      * @param filters the <code>RowFilter</code>s to test
      * @throws IllegalArgumentException if any of the filters
      *         are <code>null</code>
@@ -267,6 +276,8 @@
      *   RowFilter&lt;Object,Object&gt; fooBarFilter = RowFilter.andFilter(filters);
      * </pre>
      *
+     * @param <M> the type of the model the {@code RowFilter} applies to
+     * @param <I> the type of the identifier passed to the {@code RowFilter}
      * @param filters the <code>RowFilter</code>s to test
      * @return a <code>RowFilter</code> implementing the specified criteria
      * @throws IllegalArgumentException if any of the filters
@@ -283,6 +294,8 @@
      * Returns a <code>RowFilter</code> that includes entries if the
      * supplied filter does not include the entry.
      *
+     * @param <M> the type of the model to which the {@code RowFilter} applies
+     * @param <I> the type of the identifier passed to the {@code RowFilter}
      * @param filter the <code>RowFilter</code> to negate
      * @return a <code>RowFilter</code> implementing the specified criteria
      * @throws IllegalArgumentException if <code>filter</code> is
--- a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java	Wed Jul 05 19:50:06 2017 +0200
@@ -100,6 +100,8 @@
 
     /**
      * Constructs a SortingFocusTraversalPolicy with the specified Comparator.
+     *
+     * @param comparator the {@code Comparator} to sort by
      */
     public SortingFocusTraversalPolicy(Comparator<? super Component> comparator) {
         this.comparator = comparator;
--- a/jdk/src/share/classes/javax/swing/Spring.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/Spring.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -547,9 +547,10 @@
 
 
     /**
-     * Returns <code>-s</code>: a spring running in the opposite direction to <code>s</code>.
+     * Returns {@code -s}: a spring running in the opposite direction to {@code s}.
      *
-     * @return <code>-s</code>: a spring running in the opposite direction to <code>s</code>
+     * @param s a {@code Spring} object
+     * @return {@code -s}: a spring running in the opposite direction to {@code s}
      *
      * @see Spring
      */
@@ -582,6 +583,8 @@
      * the <em>value</em>s of <code>s1</code> and <code>s2</code> is exactly equal to
      * the <em>value</em> of <code>s3</code>.
      *
+     * @param s1 a {@code Spring} object
+     * @param s2 a {@code Spring} object
      * @return <code>s1+s2</code>: a spring representing <code>s1</code> and <code>s2</code> in series
      *
      * @see Spring
@@ -591,11 +594,13 @@
      }
 
     /**
-     * Returns <code>max(s1, s2)</code>: a spring whose value is always greater than (or equal to)
-     *         the values of both <code>s1</code> and <code>s2</code>.
+     * Returns {@code max(s1, s2)}: a spring whose value is always greater than (or equal to)
+     *         the values of both {@code s1} and {@code s2}.
      *
-     * @return <code>max(s1, s2)</code>: a spring whose value is always greater than (or equal to)
-     *         the values of both <code>s1</code> and <code>s2</code>
+     * @param s1 a {@code Spring} object
+     * @param s2 a {@code Spring} object
+     * @return {@code max(s1, s2)}: a spring whose value is always greater than (or equal to)
+     *         the values of both {@code s1} and {@code s2}
      * @see Spring
      */
     public static Spring max(Spring s1, Spring s2) {
--- a/jdk/src/share/classes/javax/swing/UIManager.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/javax/swing/UIManager.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1107,6 +1107,8 @@
      * UI class is created or when the default look and feel is changed
      * on a component instance.
      * <p>Note these are not the same as the installed look and feels.
+     *
+     * @param laf the {@code LookAndFeel} to be removed
      * @return true if the <code>LookAndFeel</code> was removed from the list
      * @see #removeAuxiliaryLookAndFeel
      * @see #getAuxiliaryLookAndFeels
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Wed Jul 05 19:50:06 2017 +0200
@@ -221,8 +221,17 @@
         }
 
         OutputStream os = new UnsyncBufferedOutputStream(bos);
+
+        DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
         try {
-            os.close();
+            ((DOMCanonicalizationMethod)
+                canonicalizationMethod).canonicalize(subTree, context, os);
+        } catch (TransformException te) {
+            throw new XMLSignatureException(te);
+        }
+
+        try {
+            os.flush();
         } catch (IOException e) {
             if (log.isLoggable(java.util.logging.Level.FINE)) {
                 log.log(java.util.logging.Level.FINE, e.getMessage(), e);
@@ -230,15 +239,6 @@
             // Impossible
         }
 
-        DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
-
-        try {
-            ((DOMCanonicalizationMethod)
-                canonicalizationMethod).canonicalize(subTree, context, bos);
-        } catch (TransformException te) {
-            throw new XMLSignatureException(te);
-        }
-
         byte[] signedInfoBytes = bos.toByteArray();
 
         // this whole block should only be done if logging is enabled
@@ -253,6 +253,15 @@
         }
 
         this.canonData = new ByteArrayInputStream(signedInfoBytes);
+
+        try {
+            os.close();
+        } catch (IOException e) {
+            if (log.isLoggable(java.util.logging.Level.FINE)) {
+                log.log(java.util.logging.Level.FINE, e.getMessage(), e);
+            }
+            // Impossible
+        }
     }
 
     public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
--- a/jdk/src/share/classes/sun/jvmstat/monitor/event/MonitorStatusChangeEvent.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/monitor/event/MonitorStatusChangeEvent.java	Wed Jul 05 19:50:06 2017 +0200
@@ -27,6 +27,7 @@
 
 import java.util.List;
 import sun.jvmstat.monitor.MonitoredVm;
+import sun.jvmstat.monitor.Monitor;
 
 /**
  * Provides a description of a change in status of the instrumentation
@@ -42,13 +43,13 @@
      * List of instrumentation objects inserted since the last event.
      * Elements of this list will always be of type Monitor.
      */
-    protected List inserted;
+    protected List<Monitor> inserted;
 
     /**
      * List of instrumentation objects removed since the last event.
      * Elements of this list will always be of type Monitor.
      */
-    protected List removed;
+    protected List<Monitor> removed;
 
     /**
      * Construct a new MonitorStatusChangeEvent.
@@ -59,8 +60,8 @@
      * @param removed the list of instrumentation objects removed since
      *                the last event.
      */
-    public MonitorStatusChangeEvent(MonitoredVm vm, List inserted,
-                                    List removed) {
+    public MonitorStatusChangeEvent(MonitoredVm vm, List<Monitor> inserted,
+                                    List<Monitor> removed) {
         super(vm);
         this.inserted = inserted;
         this.removed = removed;
@@ -75,7 +76,7 @@
      *                new instrumentation was inserted, an emply List is
      *                returned.
      */
-    public List getInserted() {
+    public List<Monitor> getInserted() {
         return inserted;
     }
 
@@ -87,7 +88,7 @@
      *                instrumentation exported by the MonitoredHost. If no
      *                instrumentation was removed, an emply List is returned.
      */
-    public List getRemoved() {
+    public List<Monitor> getRemoved() {
         return removed;
     }
 }
--- a/jdk/src/share/classes/sun/jvmstat/monitor/event/VmStatusChangeEvent.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/monitor/event/VmStatusChangeEvent.java	Wed Jul 05 19:50:06 2017 +0200
@@ -44,7 +44,7 @@
      * active Java Virtual Machine on the MonitoredHost. This Set will only
      * contain Integer objects.
      */
-    protected Set active;
+    protected Set<Integer> active;
 
     /**
      * The set of Java Virtual Machines started on MonitoredHost since the
@@ -52,7 +52,7 @@
      * <em>lvmid</em> for each Java Virtual Machine started on the
      * MonitoredHost. This Set will only contain Integer objects.
      */
-    protected Set started;
+    protected Set<Integer> started;
 
     /**
      * The set of Java Virtual Machines terminated on MonitoredHost since the
@@ -60,7 +60,7 @@
      * <em>lvmid</em> for each Java Virtual Machine started on the
      * MonitoredHost. This Set will only contain Integer objects.
      */
-    protected Set terminated;
+    protected Set<Integer> terminated;
 
     /**
      * Construct a new VmStatusChangeEvent instance.
@@ -72,8 +72,8 @@
      * @param terminated the set of Java Virtual Machines terminated since
      *                   the last event.
      */
-    public VmStatusChangeEvent(MonitoredHost host, Set active,
-                               Set started, Set terminated) {
+    public VmStatusChangeEvent(MonitoredHost host, Set<Integer> active,
+                               Set<Integer> started, Set<Integer> terminated) {
         super(host);
         this.active = active;
         this.started = started;
@@ -90,7 +90,7 @@
      *               there are no active Java Virtual Machines on the host,
      *               an empty Set is returned.
      */
-    public Set getActive() {
+    public Set<Integer> getActive() {
         return active;
     }
 
@@ -105,7 +105,7 @@
      *               no Java Virtual Machines were recently started on the
      *               host, an empty Set is returned.
      */
-    public Set getStarted() {
+    public Set<Integer> getStarted() {
         return started;
     }
 
@@ -120,7 +120,7 @@
      *               no Java Virtual Machines were recently terminated on the
      *               host, an empty Set is returned.
      */
-    public Set getTerminated() {
+    public Set<Integer> getTerminated() {
         return terminated;
     }
 }
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/AbstractPerfDataBuffer.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -169,7 +169,7 @@
 
         try {
             Class<?> implClass = Class.forName(classname);
-            Constructor cons = implClass.getConstructor(new Class[] {
+            Constructor<?> cons = implClass.getConstructor(new Class<?>[] {
                     Class.forName("java.nio.ByteBuffer"),
                     Integer.TYPE
             });
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/MonitorStatus.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/MonitorStatus.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -26,6 +26,7 @@
 package sun.jvmstat.perfdata.monitor;
 
 import java.util.List;
+import sun.jvmstat.monitor.Monitor;
 
 /**
  * Immutable class containing the list of inserted and deleted
@@ -39,12 +40,12 @@
     /**
      * The list of Monitors inserted since the last query.
      */
-    protected List inserted;
+    protected List<Monitor> inserted;
 
     /**
      * The list of Monitors removed since the last query.
      */
-    protected List removed;
+    protected List<Monitor> removed;
 
     /**
      * Create a MonitorStatus instance.
@@ -52,7 +53,7 @@
      * @param inserted the list of Monitors inserted
      * @param removed the list of Monitors removed
      */
-    public MonitorStatus(List inserted, List removed) {
+    public MonitorStatus(List<Monitor> inserted, List<Monitor> removed) {
         this.inserted = inserted;
         this.removed = removed;
     }
@@ -62,7 +63,7 @@
      *
      * @return List - the List of Monitor objects inserted or an empty List.
      */
-    public List getInserted() {
+    public List<Monitor> getInserted() {
         return inserted;
     }
 
@@ -71,7 +72,7 @@
      *
      * @return List - the List of Monitor objects removed or an empty List.
      */
-    public List getRemoved() {
+    public List<Monitor> getRemoved() {
         return removed;
     }
 }
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -66,7 +66,7 @@
     /**
      * A cache of resolved monitor aliases.
      */
-    protected Map aliasCache;
+    protected Map<String, Monitor> aliasCache;
 
 
     /**
@@ -79,9 +79,9 @@
     protected PerfDataBufferImpl(ByteBuffer buffer, int lvmid) {
         this.buffer = buffer;
         this.lvmid = lvmid;
-        this.monitors = new TreeMap<String, Monitor>();
-        this.aliasMap = new HashMap<String, ArrayList<String>>();
-        this.aliasCache = new HashMap();
+        this.monitors = new TreeMap<>();
+        this.aliasMap = new HashMap<>();
+        this.aliasCache = new HashMap<>();
     }
 
     /**
@@ -200,12 +200,12 @@
     protected Monitor findByAlias(String name) {
         assert Thread.holdsLock(this);
 
-        Monitor  m = (Monitor)aliasCache.get(name);
+        Monitor  m = aliasCache.get(name);
         if (m == null) {
-            ArrayList al = aliasMap.get(name);
+            ArrayList<String> al = aliasMap.get(name);
             if (al != null) {
-                for (Iterator i = al.iterator(); i.hasNext() && m == null; ) {
-                    String alias = (String)i.next();
+                for (Iterator<String> i = al.iterator(); i.hasNext() && m == null; ) {
+                    String alias = i.next();
                     m = monitors.get(alias);
                 }
             }
@@ -287,21 +287,21 @@
 
         Pattern pattern = Pattern.compile(patternString);
         Matcher matcher = pattern.matcher("");
-        List<Monitor> matches = new ArrayList<Monitor>();
+        List<Monitor> matches = new ArrayList<>();
 
-        Set monitorSet = monitors.entrySet();
+        Set<Map.Entry<String,Monitor>> monitorSet = monitors.entrySet();
 
-        for (Iterator i = monitorSet.iterator(); i.hasNext(); /* empty */) {
-            Map.Entry me = (Map.Entry)i.next();
-            String name = (String)me.getKey();
-            Monitor m = (Monitor)me.getValue();
+        for (Iterator<Map.Entry<String, Monitor>> i = monitorSet.iterator(); i.hasNext(); /* empty */) {
+            Map.Entry<String, Monitor> me = i.next();
+            String name = me.getKey();
+            Monitor m = me.getValue();
 
             // apply pattern to monitor item name
             matcher.reset(name);
 
             // if the pattern matches, then add monitor to list
             if (matcher.lookingAt()) {
-                 matches.add((Monitor)me.getValue());
+                 matches.add(me.getValue());
             }
         }
         return matches;
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalMonitoredVm.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -143,16 +143,17 @@
      * @param inserted List of Monitor objects inserted.
      * @param removed List of Monitor objects removed.
      */
-    void fireMonitorStatusChangedEvents(List inserted, List removed) {
+    @SuppressWarnings("unchecked") // Cast of result of clone
+    void fireMonitorStatusChangedEvents(List<Monitor> inserted, List<Monitor> removed) {
         MonitorStatusChangeEvent ev = null;
-        ArrayList registered = null;
+        ArrayList<VmListener> registered = null;
 
         synchronized (listeners) {
             registered = (ArrayList)listeners.clone();
         }
 
-        for (Iterator i = registered.iterator(); i.hasNext(); /* empty */) {
-            VmListener l = (VmListener)i.next();
+        for (Iterator<VmListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            VmListener l = i.next();
             // lazily create the event object;
             if (ev == null) {
                 ev = new MonitorStatusChangeEvent(this, inserted, removed);
@@ -190,8 +191,8 @@
             super.run();
             try {
                 MonitorStatus status = getMonitorStatus();
-                List inserted = status.getInserted();
-                List removed = status.getRemoved();
+                List<Monitor> inserted = status.getInserted();
+                List<Monitor> removed = status.getRemoved();
 
                 if (!inserted.isEmpty() || !removed.isEmpty()) {
                     fireMonitorStatusChangedEvents(inserted, removed);
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostProvider.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/MonitoredHostProvider.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -160,17 +160,18 @@
      * @param terminated a set of Integer objects containing the vmid of
      *                   terminated Vms since last interval.
      */
-    private void fireVmStatusChangedEvents(Set active, Set started,
-                                           Set terminated) {
-        ArrayList registered = null;
+    @SuppressWarnings("unchecked") // Cast of result of clone
+    private void fireVmStatusChangedEvents(Set<Integer> active, Set<Integer> started,
+                                           Set<Integer> terminated) {
+        ArrayList<HostListener> registered = null;
         VmStatusChangeEvent ev = null;
 
         synchronized(listeners) {
             registered = (ArrayList)listeners.clone();
         }
 
-        for (Iterator i = registered.iterator(); i.hasNext(); /* empty */) {
-            HostListener l = (HostListener)i.next();
+        for (Iterator<HostListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            HostListener l = i.next();
             if (ev == null) {
                 ev = new VmStatusChangeEvent(this, active, started, terminated);
             }
@@ -186,7 +187,7 @@
             super.run();
 
             // save the last set of active JVMs
-            Set lastActiveVms = activeVms;
+            Set<Integer> lastActiveVms = activeVms;
 
             // get the current set of active JVMs
             activeVms = (HashSet<Integer>)vmManager.activeVms();
@@ -194,20 +195,20 @@
             if (activeVms.isEmpty()) {
                 return;
             }
-            Set<Integer> startedVms = new HashSet<Integer>();
-            Set<Object> terminatedVms = new HashSet<Object>();
+            Set<Integer> startedVms = new HashSet<>();
+            Set<Integer> terminatedVms = new HashSet<>();
 
-            for (Iterator i = activeVms.iterator(); i.hasNext(); /* empty */) {
-                Integer vmid = (Integer)i.next();
+            for (Iterator<Integer> i = activeVms.iterator(); i.hasNext(); /* empty */) {
+                Integer vmid = i.next();
                 if (!lastActiveVms.contains(vmid)) {
                     // a new file has been detected, add to set
                     startedVms.add(vmid);
                 }
             }
 
-            for (Iterator i = lastActiveVms.iterator(); i.hasNext();
+            for (Iterator<Integer> i = lastActiveVms.iterator(); i.hasNext();
                     /* empty */) {
-                Object o = i.next();
+                Integer o = i.next();
                 if (!activeVms.contains(o)) {
                     // JVM has terminated, remove it from the active list
                     terminatedVms.add(o);
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostProvider.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/MonitoredHostProvider.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -246,17 +246,18 @@
      *                   Vm Identifiers of terminated JVMs since last
      *                   interval.
      */
-    private void fireVmStatusChangedEvents(Set active, Set started,
-                                           Set terminated) {
-        ArrayList registered = null;
+    @SuppressWarnings("unchecked") // Cast of result of clone
+    private void fireVmStatusChangedEvents(Set<Integer> active, Set<Integer> started,
+                                           Set<Integer> terminated) {
+        ArrayList<HostListener> registered = null;
         VmStatusChangeEvent ev = null;
 
         synchronized(listeners) {
             registered = (ArrayList)listeners.clone();
         }
 
-        for (Iterator i = registered.iterator(); i.hasNext(); /* empty */) {
-            HostListener l = (HostListener)i.next();
+        for (Iterator<HostListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            HostListener l = i.next();
             if (ev == null) {
                 ev = new VmStatusChangeEvent(this, active, started, terminated);
             }
@@ -267,16 +268,17 @@
     /**
      * Fire hostDisconnectEvent events.
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     void fireDisconnectedEvents() {
-        ArrayList registered = null;
+        ArrayList<HostListener> registered = null;
         HostEvent ev = null;
 
         synchronized(listeners) {
             registered = (ArrayList)listeners.clone();
         }
 
-        for (Iterator i = registered.iterator(); i.hasNext(); /* empty */) {
-            HostListener l = (HostListener)i.next();
+        for (Iterator<HostListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            HostListener l = i.next();
             if (ev == null) {
                 ev = new HostEvent(this);
             }
@@ -292,7 +294,7 @@
             super.run();
 
             // save the last set of active JVMs
-            Set lastActiveVms = activeVms;
+            Set<Integer> lastActiveVms = activeVms;
 
             try {
                 // get the current set of active JVMs
@@ -313,20 +315,20 @@
                 return;
             }
 
-            Set<Integer> startedVms = new HashSet<Integer>();
-            Set<Object> terminatedVms = new HashSet<Object>();
+            Set<Integer> startedVms = new HashSet<>();
+            Set<Integer> terminatedVms = new HashSet<>();
 
-            for (Iterator i = activeVms.iterator(); i.hasNext(); /* empty */ ) {
-                Integer vmid = (Integer)i.next();
+            for (Iterator<Integer> i = activeVms.iterator(); i.hasNext(); /* empty */ ) {
+                Integer vmid = i.next();
                 if (!lastActiveVms.contains(vmid)) {
                     // a new file has been detected, add to set
                     startedVms.add(vmid);
                 }
             }
 
-            for (Iterator i = lastActiveVms.iterator(); i.hasNext();
+            for (Iterator<Integer> i = lastActiveVms.iterator(); i.hasNext();
                     /* empty */ ) {
-                Object o = i.next();
+                Integer o = i.next();
                 if (!activeVms.contains(o)) {
                     // JVM has terminated, remove it from the active list
                     terminatedVms.add(o);
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/protocol/rmi/RemoteMonitoredVm.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -198,16 +198,17 @@
      * @param inserted List of Monitor objects inserted.
      * @param removed List of Monitor objects removed.
      */
-    void fireMonitorStatusChangedEvents(List inserted, List removed) {
-        ArrayList registered = null;
+    @SuppressWarnings("unchecked") // Cast of result of clone
+    void fireMonitorStatusChangedEvents(List<Monitor> inserted, List<Monitor> removed) {
+        ArrayList<VmListener> registered = null;
         MonitorStatusChangeEvent ev = null;
 
         synchronized(listeners) {
             registered = (ArrayList)listeners.clone();
         }
 
-        for (Iterator i = registered.iterator(); i.hasNext(); /* empty */) {
-            VmListener l = (VmListener)i.next();
+        for (Iterator<VmListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            VmListener l = i.next();
             if (ev == null) {
                 ev = new MonitorStatusChangeEvent(this, inserted, removed);
             }
@@ -218,16 +219,17 @@
     /**
      * Fire MonitoredVmStructureChanged events.
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     void fireMonitorsUpdatedEvents() {
-        ArrayList registered = null;
+        ArrayList<VmListener> registered = null;
         VmEvent ev = null;
 
         synchronized(listeners) {
             registered = (ArrayList)listeners.clone();
         }
 
-        for (Iterator i = registered.iterator(); i.hasNext(); /* empty */) {
-            VmListener l = (VmListener)i.next();
+        for (Iterator<VmListener> i = registered.iterator(); i.hasNext(); /* empty */) {
+            VmListener l = i.next();
             if (ev == null) {
                 ev = new VmEvent(this);
             }
@@ -256,8 +258,8 @@
             try {
                 MonitorStatus status = getMonitorStatus();
 
-                List inserted = status.getInserted();
-                List removed = status.getRemoved();
+                List<Monitor> inserted = status.getInserted();
+                List<Monitor> removed = status.getRemoved();
 
                 if (!inserted.isEmpty() || !removed.isEmpty()) {
                     fireMonitorStatusChangedEvents(inserted, removed);
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -47,7 +47,7 @@
     private static final boolean DEBUG = false;
     private static final int syncWaitMs =
             Integer.getInteger("sun.jvmstat.perdata.syncWaitMs", 5000);
-    private static final ArrayList EMPTY_LIST = new ArrayList(0);
+    private static final ArrayList<Monitor> EMPTY_LIST = new ArrayList<Monitor>(0);
 
     /*
      * the following constants must be kept in sync with struct
@@ -190,8 +190,8 @@
         getNewMonitors(map);
 
         // current implementation doesn't support deletion or reuse of entries
-        ArrayList removed = EMPTY_LIST;
-        ArrayList inserted = insertedMonitors;
+        ArrayList<Monitor> removed = EMPTY_LIST;
+        ArrayList<Monitor> inserted = insertedMonitors;
 
         insertedMonitors = new ArrayList<Monitor>();
         return new MonitorStatus(inserted, removed);
@@ -618,14 +618,14 @@
     /**
      * Method to dump debugging information
      */
-    private void dumpAll(Map map, int lvmid) {
+    private void dumpAll(Map<String, Monitor> map, int lvmid) {
         if (DEBUG) {
-            Set keys = map.keySet();
+            Set<String> keys = map.keySet();
 
             System.err.println("Dump for " + lvmid);
             int j = 0;
-            for (Iterator i = keys.iterator(); i.hasNext(); j++) {
-                Monitor monitor = (Monitor)map.get(i.next());
+            for (Iterator<String> i = keys.iterator(); i.hasNext(); j++) {
+                Monitor monitor = map.get(i.next());
                 System.err.println(j + "\t" + monitor.getName()
                                    + "=" + monitor.getValue());
             }
--- a/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -65,7 +65,7 @@
     private static final boolean DEBUG = false;
     private static final int syncWaitMs =
             Integer.getInteger("sun.jvmstat.perdata.syncWaitMs", 5000);
-    private static final ArrayList EMPTY_LIST = new ArrayList(0);
+    private static final ArrayList<Monitor> EMPTY_LIST = new ArrayList<>(0);
 
     /*
      * These are primarily for documentary purposes and the match up
@@ -198,10 +198,10 @@
         getNewMonitors(map);
 
         // current implementation doesn't support deletion of reuse of entries
-        ArrayList removed = EMPTY_LIST;
-        ArrayList inserted = insertedMonitors;
+        ArrayList<Monitor> removed = EMPTY_LIST;
+        ArrayList<Monitor> inserted = insertedMonitors;
 
-        insertedMonitors = new ArrayList<Monitor>();
+        insertedMonitors = new ArrayList<>();
         return new MonitorStatus(inserted, removed);
     }
 
@@ -524,7 +524,7 @@
 
             System.err.println("Dump for " + lvmid);
             int j = 0;
-            for (Iterator i = keys.iterator(); i.hasNext(); j++) {
+            for (Iterator<String> i = keys.iterator(); i.hasNext(); j++) {
                 Monitor monitor = map.get(i.next());
                 System.err.println(j + "\t" + monitor.getName()
                                    + "=" + monitor.getValue());
--- a/jdk/src/share/classes/sun/management/DiagnosticCommandImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/management/DiagnosticCommandImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -84,10 +84,10 @@
             Exception cause = null;
             if (info.getPermissionClass() != null) {
                 try {
-                    Class c = Class.forName(info.getPermissionClass());
+                    Class<?> c = Class.forName(info.getPermissionClass());
                     if (info.getPermissionAction() == null) {
                         try {
-                            Constructor constructor = c.getConstructor(String.class);
+                            Constructor<?> constructor = c.getConstructor(String.class);
                             permission = (Permission) constructor.newInstance(info.getPermissionName());
 
                         } catch (InstantiationException | IllegalAccessException
@@ -98,7 +98,7 @@
                     }
                     if (permission == null) {
                         try {
-                            Constructor constructor = c.getConstructor(String.class, String.class);
+                            Constructor<?> constructor = c.getConstructor(String.class, String.class);
                             permission = (Permission) constructor.newInstance(
                                     info.getPermissionName(),
                                     info.getPermissionAction());
@@ -158,7 +158,7 @@
         SortedSet<MBeanOperationInfo> operations = new TreeSet<>(new OperationInfoComparator());
         Map<String, Wrapper> wrappersmap;
         if (!isSupported) {
-            wrappersmap = (Map<String, Wrapper>) Collections.EMPTY_MAP;
+            wrappersmap = Collections.emptyMap();
         } else {
             try {
                 String[] command = getDiagnosticCommands();
@@ -189,7 +189,7 @@
                     }
                 }
             } catch (IllegalArgumentException | UnsupportedOperationException e) {
-                wrappersmap = (Map<String, Wrapper>) Collections.EMPTY_MAP;
+                wrappersmap = Collections.emptyMap();
             }
         }
         wrappers =  Collections.unmodifiableMap(wrappersmap);
--- a/jdk/src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -65,7 +65,7 @@
         final GcInfoBuilder builder = AccessController.doPrivileged (new PrivilegedAction<GcInfoBuilder>() {
                 public GcInfoBuilder run() {
                     try {
-                        Class cl = Class.forName("com.sun.management.GcInfo");
+                        Class<?> cl = Class.forName("com.sun.management.GcInfo");
                         Field f = cl.getDeclaredField("builder");
                         f.setAccessible(true);
                         return (GcInfoBuilder)f.get(gcNotifInfo.getGcInfo());
--- a/jdk/src/share/classes/sun/management/GcInfoBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/management/GcInfoBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -98,7 +98,7 @@
 
         // First, fill with the attributes in the GcInfo
         String[] gcInfoItemNames = GcInfoCompositeData.getBaseGcInfoItemNames();
-        OpenType[] gcInfoItemTypes = GcInfoCompositeData.getBaseGcInfoItemTypes();
+        OpenType<?>[] gcInfoItemTypes = GcInfoCompositeData.getBaseGcInfoItemTypes();
         int numGcInfoItems = gcInfoItemNames.length;
 
         int itemCount = numGcInfoItems + gcExtItemCount;
--- a/jdk/src/share/classes/sun/management/GcInfoCompositeData.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/management/GcInfoCompositeData.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -72,7 +72,7 @@
         final GcInfoBuilder builder = AccessController.doPrivileged (new PrivilegedAction<GcInfoBuilder>() {
                         public GcInfoBuilder run() {
                             try {
-                                Class cl = Class.forName("com.sun.management.GcInfo");
+                                Class<?> cl = Class.forName("com.sun.management.GcInfo");
                                 Field f = cl.getDeclaredField("builder");
                                 f.setAccessible(true);
                                 return (GcInfoBuilder)f.get(info);
@@ -84,7 +84,7 @@
         final Object[] extAttr = AccessController.doPrivileged (new PrivilegedAction<Object[]>() {
                         public Object[] run() {
                             try {
-                                Class cl = Class.forName("com.sun.management.GcInfo");
+                                Class<?> cl = Class.forName("com.sun.management.GcInfo");
                                 Field f = cl.getDeclaredField("extAttributes");
                                 f.setAccessible(true);
                                 return (Object[])f.get(info);
@@ -182,8 +182,8 @@
         return baseGcInfoItemNames;
     }
 
-    private static OpenType[] baseGcInfoItemTypes = null;
-    static synchronized OpenType[] getBaseGcInfoItemTypes() {
+    private static OpenType<?>[] baseGcInfoItemTypes = null;
+    static synchronized OpenType<?>[] getBaseGcInfoItemTypes() {
         if (baseGcInfoItemTypes == null) {
             OpenType<?> memoryUsageOpenType = memoryUsageMapType.getOpenType();
             baseGcInfoItemTypes = new OpenType<?>[] {
--- a/jdk/src/share/classes/sun/management/MappedMXBeanType.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/management/MappedMXBeanType.java	Wed Jul 05 19:50:06 2017 +0200
@@ -227,6 +227,7 @@
     //   Enum <-> enum's name
     //
     static class EnumMXBeanType extends MappedMXBeanType {
+        @SuppressWarnings("rawtypes")
         final Class enumClass;
         EnumMXBeanType(Class<?> c) {
             this.enumClass = c;
@@ -754,7 +755,7 @@
         }
     }
 
-    private static class InProgress extends OpenType {
+    private static class InProgress<T> extends OpenType<T> {
         private static final String description =
                   "Marker to detect recursive type use -- internal use only!";
 
@@ -783,7 +784,7 @@
     static {
         OpenType<?> t;
         try {
-            t = new InProgress();
+            t = new InProgress<>();
         } catch (OpenDataException e) {
             // Should not reach here
             throw new AssertionError(e);
@@ -791,7 +792,7 @@
         inProgress = t;
     }
 
-    private static final OpenType[] simpleTypes = {
+    private static final OpenType<?>[] simpleTypes = {
         BIGDECIMAL, BIGINTEGER, BOOLEAN, BYTE, CHARACTER, DATE,
         DOUBLE, FLOAT, INTEGER, LONG, OBJECTNAME, SHORT, STRING,
         VOID,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/misc/JavaAWTFontAccess.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.
+ */
+
+/**
+ * SharedSecrets interface used for the access from java.text.Bidi
+ */
+
+package sun.misc;
+
+public interface JavaAWTFontAccess {
+
+    // java.awt.font.TextAttribute constants
+    public Object getTextAttributeConstant(String name);
+
+    // java.awt.font.NumericShaper
+    public void shape(Object shaper, char[] text, int start, int count);
+}
--- a/jdk/src/share/classes/sun/misc/SharedSecrets.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/misc/SharedSecrets.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -55,6 +55,7 @@
     private static JavaSecurityAccess javaSecurityAccess;
     private static JavaUtilZipFileAccess javaUtilZipFileAccess;
     private static JavaAWTAccess javaAWTAccess;
+    private static JavaAWTFontAccess javaAWTFontAccess;
     private static JavaBeansIntrospectorAccess javaBeansIntrospectorAccess;
 
     public static JavaUtilJarAccess javaUtilJarAccess() {
@@ -180,12 +181,19 @@
     public static JavaAWTAccess getJavaAWTAccess() {
         // this may return null in which case calling code needs to
         // provision for.
-        if (javaAWTAccess == null) {
-            return null;
-        }
         return javaAWTAccess;
     }
 
+    public static void setJavaAWTFontAccess(JavaAWTFontAccess jafa) {
+        javaAWTFontAccess = jafa;
+    }
+
+    public static JavaAWTFontAccess getJavaAWTFontAccess() {
+        // this may return null in which case calling code needs to
+        // provision for.
+        return javaAWTFontAccess;
+    }
+
     public static JavaBeansIntrospectorAccess getJavaBeansIntrospectorAccess() {
         return javaBeansIntrospectorAccess;
     }
--- a/jdk/src/share/classes/sun/security/jca/ProviderConfig.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/security/jca/ProviderConfig.java	Wed Jul 05 19:50:06 2017 +0200
@@ -255,6 +255,14 @@
                         disableLoad();
                     }
                     return null;
+                } catch (ExceptionInInitializerError err) {
+                    // no sufficient permission to initialize provider class
+                    if (debug != null) {
+                        debug.println("Error loading provider " + ProviderConfig.this);
+                        err.printStackTrace();
+                    }
+                    disableLoad();
+                    return null;
                 }
             }
         });
--- a/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/security/pkcs12/PKCS12KeyStore.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -900,7 +900,7 @@
     private static ObjectIdentifier mapPBEAlgorithmToOID(String algorithm)
         throws NoSuchAlgorithmException {
         // Check for PBES2 algorithms
-        if (algorithm.toLowerCase().startsWith("pbewithhmacsha")) {
+        if (algorithm.toLowerCase(Locale.ENGLISH).startsWith("pbewithhmacsha")) {
             return pbes2_OID;
         }
         return AlgorithmId.get(algorithm).getOID();
--- a/jdk/src/share/classes/sun/security/provider/ConfigFile.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/ConfigFile.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -451,7 +451,7 @@
 
                 // controlFlag (required, optional, etc)
                 LoginModuleControlFlag controlFlag;
-                String sflag = match("controlFlag").toUpperCase();
+                String sflag = match("controlFlag").toUpperCase(Locale.ENGLISH);
                 switch (sflag) {
                     case "REQUIRED":
                         controlFlag = LoginModuleControlFlag.REQUIRED;
--- a/jdk/src/share/classes/sun/security/provider/PolicyParser.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/security/provider/PolicyParser.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -707,7 +707,7 @@
             } catch (PropertyExpander.ExpandException peee) {
                 throw new IOException(peee.getLocalizedMessage());
             }
-            properties.put(key.toLowerCase(), value);
+            properties.put(key.toLowerCase(Locale.ENGLISH), value);
         }
 
         return properties;
--- a/jdk/src/share/classes/sun/security/tools/keytool/Main.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/security/tools/keytool/Main.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1540,7 +1540,7 @@
         boolean useDefaultPBEAlgorithm = true;
         SecretKey secKey = null;
 
-        if (keyAlgName.toUpperCase().startsWith("PBE")) {
+        if (keyAlgName.toUpperCase(Locale.ENGLISH).startsWith("PBE")) {
             SecretKeyFactory factory = SecretKeyFactory.getInstance("PBE");
 
             // User is prompted for PBE credential
--- a/jdk/src/share/classes/sun/text/bidi/BidiBase.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/text/bidi/BidiBase.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -54,13 +54,12 @@
 
 import java.io.IOException;
 import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
 import java.text.AttributedCharacterIterator;
 import java.text.Bidi;
 import java.util.Arrays;
 import java.util.MissingResourceException;
+import sun.misc.JavaAWTFontAccess;
+import sun.misc.SharedSecrets;
 import sun.text.normalizer.UBiDiProps;
 import sun.text.normalizer.UCharacter;
 import sun.text.normalizer.UTF16;
@@ -3446,7 +3445,13 @@
      * java.awt.font.TextAttribute without creating a static dependency.
      */
     private static class TextAttributeConstants {
-        private static final Class<?> clazz = getClass("java.awt.font.TextAttribute");
+        // Make sure to load the AWT's TextAttribute class before using the constants, if any.
+        static {
+            try {
+                Class.forName("java.awt.font.TextAttribute", true, null);
+            } catch (ClassNotFoundException e) {}
+        }
+        static final JavaAWTFontAccess jafa = SharedSecrets.getJavaAWTFontAccess();
 
         /**
          * TextAttribute instances (or a fake Attribute type if
@@ -3462,88 +3467,41 @@
         /**
          * TextAttribute.RUN_DIRECTION_LTR
          */
-        static final Boolean RUN_DIRECTION_LTR = (clazz == null) ?
-            Boolean.FALSE : (Boolean)getStaticField(clazz, "RUN_DIRECTION_LTR");
-
-
-        private static Class<?> getClass(String name) {
-            try {
-                return Class.forName(name, true, null);
-            } catch (ClassNotFoundException e) {
-                return null;
-            }
-        }
-
-        private static Object getStaticField(Class<?> clazz, String name) {
-            try {
-                Field f = clazz.getField(name);
-                return f.get(null);
-            } catch (NoSuchFieldException | IllegalAccessException x) {
-                throw new AssertionError(x);
-            }
-        }
+        static final Boolean RUN_DIRECTION_LTR = (jafa == null) ?
+            Boolean.FALSE : (Boolean)jafa.getTextAttributeConstant("RUN_DIRECTION_LTR");
 
         @SuppressWarnings("serial")
         private static AttributedCharacterIterator.Attribute
             getTextAttribute(String name)
         {
-            if (clazz == null) {
+            if (jafa == null) {
                 // fake attribute
                 return new AttributedCharacterIterator.Attribute(name) { };
             } else {
-                return (AttributedCharacterIterator.Attribute)getStaticField(clazz, name);
+                return (AttributedCharacterIterator.Attribute)jafa.getTextAttributeConstant(name);
             }
         }
     }
 
     /**
-     * A class that provides access to java.awt.font.NumericShaping without
+     * A class that provides access to java.awt.font.NumericShaper without
      * creating a static dependency.
      */
     private static class NumericShapings {
-        private static final Class<?> clazz =
-            getClass("java.awt.font.NumericShaper");
-        private static final Method shapeMethod =
-            getMethod(clazz, "shape", char[].class, int.class, int.class);
-
-        private static Class<?> getClass(String name) {
+        // Make sure to load the AWT's NumericShaper class before calling shape, if any.
+        static {
             try {
-                return Class.forName(name, true, null);
-            } catch (ClassNotFoundException e) {
-                return null;
-            }
+                Class.forName("java.awt.font.NumericShaper", true, null);
+            } catch (ClassNotFoundException e) {}
         }
-
-        private static Method getMethod(Class<?> clazz,
-                                        String name,
-                                        Class<?>... paramTypes)
-        {
-            if (clazz != null) {
-                try {
-                    return clazz.getMethod(name, paramTypes);
-                } catch (NoSuchMethodException e) {
-                    throw new AssertionError(e);
-                }
-            } else {
-                return null;
-            }
-        }
+        static final JavaAWTFontAccess jafa = SharedSecrets.getJavaAWTFontAccess();
 
         /**
          * Invokes NumericShaping shape(text,start,count) method.
          */
         static void shape(Object shaper, char[] text, int start, int count) {
-            if (shapeMethod == null)
-                throw new AssertionError("Should not get here");
-            try {
-                shapeMethod.invoke(shaper, text, start, count);
-            } catch (InvocationTargetException e) {
-                Throwable cause = e.getCause();
-                if (cause instanceof RuntimeException)
-                    throw (RuntimeException)cause;
-                throw new AssertionError(e);
-            } catch (IllegalAccessException iae) {
-                throw new AssertionError(iae);
+            if (jafa != null) {
+                jafa.shape(shaper, text, start, count);
             }
         }
     }
--- a/jdk/src/share/classes/sun/tracing/ProviderSkeleton.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/tracing/ProviderSkeleton.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -154,7 +154,7 @@
      * @return always null, if the method is a user-defined probe
      */
     public Object invoke(Object proxy, Method method, Object[] args) {
-        Class declaringClass = method.getDeclaringClass();
+        Class<?> declaringClass = method.getDeclaringClass();
         // not a provider subtype's own method
         if (declaringClass != providerType) {
             try {
--- a/jdk/src/share/classes/sun/tracing/dtrace/DTraceProvider.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/classes/sun/tracing/dtrace/DTraceProvider.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -50,7 +50,7 @@
     private Object proxy;
 
     // For proxy generation
-    private final static Class[] constructorParams = { InvocationHandler.class };
+    private final static Class<?>[] constructorParams = { InvocationHandler.class };
     private final String proxyClassNamePrefix = "$DTraceTracingProxy";
 
     static final String DEFAULT_MODULE = "java_tracing";
@@ -135,7 +135,7 @@
          * Invoke its constructor with the designated invocation handler.
          */
         try {
-            Constructor cons = proxyClass.getConstructor(constructorParams);
+            Constructor<?> cons = proxyClass.getConstructor(constructorParams);
             return (T)cons.newInstance(new Object[] { this });
         } catch (ReflectiveOperationException e) {
             throw new InternalError(e.toString(), e);
--- a/jdk/src/share/javavm/export/jvm.h	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/javavm/export/jvm.h	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -426,9 +426,6 @@
 JNIEXPORT jobjectArray JNICALL
 JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
 
-JNIEXPORT jobject JNICALL
-JVM_GetClassLoader(JNIEnv *env, jclass cls);
-
 JNIEXPORT jboolean JNICALL
 JVM_IsInterface(JNIEnv *env, jclass cls);
 
--- a/jdk/src/share/lib/security/BlacklistedCertsConverter.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 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.
- */
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.Collection;
-
-/**
- * This is the tool to convert blacklisted.certs.pem to blacklisted.certs.
- * Every time a new blacklisted certs is added, please append the PEM format
- * to the end of blacklisted.certs.pem (with proper comments) and then use
- * this tool to generate an updated blacklisted.certs. Make sure to include
- * changes to both in a changeset.
- */
-public class BlacklistedCertsConverter {
-    public static void main(String[] args) throws Exception {
-        if (args.length == 0) {
-            System.out.println("Usage: java BlacklistedCertsConverter SHA-256" +
-                    " < blacklisted.certs.pem > blacklisted.certs");
-            System.exit(1);
-        }
-        String mdAlg = args[0];
-        CertificateFactory cf = CertificateFactory.getInstance("X.509");
-        Collection<? extends Certificate> certs
-                = cf.generateCertificates(System.in);
-        System.out.println("Algorithm=" + mdAlg);
-        for (Certificate cert: certs) {
-            System.out.println(
-                    getCertificateFingerPrint(mdAlg, (X509Certificate)cert));
-        }
-    }
-
-    /**
-     * Converts a byte to hex digit and writes to the supplied buffer
-     */
-    private static void byte2hex(byte b, StringBuffer buf) {
-        char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
-                '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-        int high = ((b & 0xf0) >> 4);
-        int low = (b & 0x0f);
-        buf.append(hexChars[high]);
-        buf.append(hexChars[low]);
-    }
-
-    /**
-     * Gets the requested finger print of the certificate.
-     */
-    private static String getCertificateFingerPrint(String mdAlg,
-                                                    X509Certificate cert) {
-        String fingerPrint = "";
-        try {
-            byte[] encCertInfo = cert.getEncoded();
-            MessageDigest md = MessageDigest.getInstance(mdAlg);
-            byte[] digest = md.digest(encCertInfo);
-            StringBuffer buf = new StringBuffer();
-            for (int i = 0; i < digest.length; i++) {
-                byte2hex(digest[i], buf);
-            }
-            fingerPrint = buf.toString();
-        } catch (NoSuchAlgorithmException | CertificateEncodingException e) {
-            // ignored
-        }
-        return fingerPrint;
-    }
-}
--- a/jdk/src/share/lib/security/blacklisted.certs	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-Algorithm=SHA-256
-76A45A496031E4DD2D7ED23E8F6FF97DBDEA980BAAC8B0BA94D7EDB551348645
-4CBBF8256BC9888A8007B2F386940A2E394378B0D903CBB3863C5A6394B889CE
-D24566BF315F4E597D6E381C87119FB4198F5E9E2607F5F4AB362EF7E2E7672F
-14E6D2764A4B06701C6CBC376A253775F79C782FBCB6C0EE6F99DE4BA1024ADD
-D3A936E1A7775A45217C8296A1F22AC5631DCDEC45594099E78EEEBBEDCBA967
-5E83124D68D24E8E177E306DF643D5EA99C5A94D6FC34B072F7544A1CABB7C7B
-9ED8F9B0E8E42A1656B8E1DD18F42BA42DC06FE52686173BA2FC70E756F207DC
-FDEDB5BDFCB67411513A61AEE5CB5B5D7C52AF06028EFC996CC1B05B1D6CEA2B
-A686FEE577C88AB664D0787ECDFFF035F4806F3DE418DC9E4D516324FFF02083
-4FEE0163686ECBD65DB968E7494F55D84B25486D438E9DE558D629D28CD4D176
-8A1BD21661C60015065212CC98B1ABB50DFD14C872A208E66BAE890F25C448AF
-B8686723E415534BC0DBD16326F9486F85B0B0799BF6639334E61DAAE67F36CD
-3946901F46B0071E90D78279E82FABABCA177231A704BE72C5B0E8918566EA66
-31C8FD37DB9B56E708B03D1F01848B068C6DA66F36FB5D82C008C6040FA3E133
-450F1B421BB05C8609854884559C323319619E8B06B001EA2DCBB74A23AA3BE2
-FC02FD48DB92D4DCE6F11679D38354CF750CFC7F584A520EB90BDE80E241F2BD
-DF21016B00FC54F9FE3BC8B039911BB216E9162FAD2FD14D990AB96E951B49BE
-F5B6F88F75D391A4B1EB336F9E201239FB6B1377DB8CFA7B84736216E5AFFFD7
--- a/jdk/src/share/lib/security/blacklisted.certs.pem	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,721 +0,0 @@
-// Subject: CN=Digisign Server ID (Enrich),
-//          OU=457608-K,
-//          O=Digicert Sdn. Bhd.,
-//          C=MY
-// Issuer:  CN=GTE CyberTrust Global Root,
-//          OU=GTE CyberTrust Solutions, Inc.,
-//          O=GTE Corporation,
-//          C=US
-// Serial:  120001705 (07:27:14:a9)
------BEGIN CERTIFICATE-----
-MIIDyzCCAzSgAwIBAgIEBycUqTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV
-UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
-cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
-b2JhbCBSb290MB4XDTA3MDcxNzE1MTc0OFoXDTEyMDcxNzE1MTY1NFowYzELMAkG
-A1UEBhMCTVkxGzAZBgNVBAoTEkRpZ2ljZXJ0IFNkbi4gQmhkLjERMA8GA1UECxMI
-NDU3NjA4LUsxJDAiBgNVBAMTG0RpZ2lzaWduIFNlcnZlciBJRCAoRW5yaWNoKTCB
-nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArahkS02Hx4RZufuQRqCmicDx/tXa
-VII3DZkrRSYK6Fawf8qo9I5HhAGCKeOzarWR8/uVhbxyqGToCkCcxfRxrnt7agfq
-kBRPjYmvlKuyBtQCanuYH1m5Os1U+iDfsioK6bjdaZDAKdNO0JftZszFGUkGf/pe
-LHx7hRsyQt97lSUCAwEAAaOCAXgwggF0MBIGA1UdEwEB/wQIMAYBAf8CAQAwXAYD
-VR0gBFUwUzBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcCARYtaHR0cDovL2N5YmVy
-dHJ1c3Qub21uaXJvb3QuY29tL3JlcG9zaXRvcnkuY2ZtMAcGBWCDSgEBMA4GA1Ud
-DwEB/wQEAwIB5jCBiQYDVR0jBIGBMH+heaR3MHUxCzAJBgNVBAYTAlVTMRgwFgYD
-VQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdURSBDeWJlclRydXN0IFNv
-bHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVyVHJ1c3QgR2xvYmFsIFJv
-b3SCAgGlMEUGA1UdHwQ+MDwwOqA4oDaGNGh0dHA6Ly93d3cucHVibGljLXRydXN0
-LmNvbS9jZ2ktYmluL0NSTC8yMDE4L2NkcC5jcmwwHQYDVR0OBBYEFMYWk04WF+wW
-royUdvOGbcV0boR3MA0GCSqGSIb3DQEBBQUAA4GBAHYAe6Z4K2Ydjl42xqSOBfIj
-knyTZ9P0wAp9iy3Z6tVvGvPhSilaIoRNUC9LDPL/hcJ7VdREgr5trGeOvLQfkpxR
-gBoU9m6rYYgLrRx/90tQUdZlG6ZHcRVesHHzNRTyN71jyNXwk1o0X9g96F33xR7A
-5c8fhiSpPAdmzcHSNmNZ
------END CERTIFICATE-----
-
-// Subject: CN=Digisign Server ID - (Enrich),
-//          OU=457608-K,
-//          O=Digicert Sdn. Bhd.,
-//          C=MY
-// Issuer:  CN=Entrust.net Certification Authority (2048)
-//          OU=(c) 1999 Entrust.net Limited,
-//          OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.),
-//          O=Entrust.net
-// Serial:  1184644297 (4c:0e:63:6a)
------BEGIN CERTIFICATE-----
-MIIEzjCCA7agAwIBAgIETA5jajANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML
-RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp
-bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5
-IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp
-ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw0xMDA3MTYxNzIzMzdaFw0xNTA3
-MTYxNzUzMzdaMGUxCzAJBgNVBAYTAk1ZMRswGQYDVQQKExJEaWdpY2VydCBTZG4u
-IEJoZC4xETAPBgNVBAsTCDQ1NzYwOC1LMSYwJAYDVQQDEx1EaWdpc2lnbiBTZXJ2
-ZXIgSUQgLSAoRW5yaWNoKTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
-AMWJ5PQNBkCSWccaszXRDkwqM/n4r8qef+65p21g9FTob9Wb8xtjMQRoctE0Foy0
-FyyX3nPF2JAVoBor9cuzSIZE8B2ITM5BQhrv9Qze/kDaOSD3BlU6ap1GwdJvpbLI
-Vz4po5zg6YV3ZuiYpyR+vsBZIOVEb7ZX2L7OwmV3WMZhQdF0BMh/SULFcqlyFu6M
-3RJdtErU0a9Qt9iqdXZorT5dqjBtYairEFs+E78z4K9EnTgiW+9ML6ZxJhUmyiiM
-2fqOjqmiFDXimySItPR/hZ2DTwehthSQNsQ0HI0mYW0Tb3i+6I8nx0uElqOGaAwj
-vgvsjJQAqQSKE5D334VsDLECAwEAAaOCATQwggEwMA4GA1UdDwEB/wQEAwIBBjAS
-BgNVHRMBAf8ECDAGAQH/AgEAMCcGA1UdJQQgMB4GCCsGAQUFBwMBBggrBgEFBQcD
-AgYIKwYBBQUHAwQwMwYIKwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdodHRwOi8v
-b2NzcC5lbnRydXN0Lm5ldDBEBgNVHSAEPTA7MDkGBWCDSgEBMDAwLgYIKwYBBQUH
-AgEWImh0dHA6Ly93d3cuZGlnaWNlcnQuY29tLm15L2Nwcy5odG0wMgYDVR0fBCsw
-KTAnoCWgI4YhaHR0cDovL2NybC5lbnRydXN0Lm5ldC8yMDQ4Y2EuY3JsMBEGA1Ud
-DgQKBAhMTswlKAMpgTAfBgNVHSMEGDAWgBRV5IHREYC+2Im5CKMx+aEkCRa5cDAN
-BgkqhkiG9w0BAQUFAAOCAQEAl0zvSjpJrHL8MCBrtClbp8WVBJD5MtXChWreA6E3
-+YkAsFqsVX7bQzX/yQH4Ub7MJsrIaqTEVD4mHucMo82XZ5TdpkLrXM2POXlrM3kh
-Bnn6gkQVmczBtznTRmJ8snDrb84gqj4Zt+l0gpy0pUtNYQA35IfS8hQ6ZHy4qXth
-4JMi59WfPkfmNnagU9gAAzoPtTP+lsrT0oI6Lt3XSOHkp2nMHOmZSufKcEXXCwcO
-mnUb0C+Sb/akB8O9HEumhLZ9qJqp0qcp8QtXaR6XVybsK0Os1EWDBQDp4/BGQAf6
-6rFRc5Mcpd1TETfIKqcVJx20qsx/qjEw/LhFn0gJ7RDixQ==
------END CERTIFICATE-----
-
-// Subject: CN=Java Media APIs,
-//          OU=Java Signed Extensions,
-//          OU=Corporate Object Signing,
-//          O=Sun Microsystems Inc
-// Issuer:  CN=Object Signing CA,
-//          OU=Class 2 OnSite Subscriber CA,
-//          OU=VeriSign Trust Network,
-//          O=Sun Microsystems Inc
-// Serial:  6a:8b:99:91:37:59:4f:89:53:e2:97:18:9f:19:1e:4e
------BEGIN CERTIFICATE-----
-MIIFdzCCBF+gAwIBAgIQaouZkTdZT4lT4pcYnxkeTjANBgkqhkiG9w0BAQUFADCB
-gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT
-aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj
-cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA5MDUxMjAw
-MDAwMFoXDTEyMDUxMTIzNTk1OVowfTEdMBsGA1UEChQUU3VuIE1pY3Jvc3lzdGVt
-cyBJbmMxITAfBgNVBAsUGENvcnBvcmF0ZSBPYmplY3QgU2lnbmluZzEfMB0GA1UE
-CxQWSmF2YSBTaWduZWQgRXh0ZW5zaW9uczEYMBYGA1UEAxQPSmF2YSBNZWRpYSBB
-UElzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl5blzoKTVE8y4Hpz
-q6E15RZz1bF5HnYEyYqgHkZXnAKedmYCoMzm1XK8s+gQWShLEvGEAvs5yqarx9gE
-nnC21N28aEZgIJMa2/arKxCUkS4pxdGPYGexL9UzSRkUpoBShCZKEGdmX7gfJE2K
-/sd9MFvGV5/yZtWXrADzvm0Kd/9mg1KRv1gfrZIq0TJbupoXPYYqb73AkI9eT2ZD
-q9MdwD4E5+oojsDFXt8GU/D00fUhtXpYwuplU7D667WHYdJhIah0ST6JywyqcLXG
-XSuFTXOgITT2idSHluZVmx3dqJ72u9kPkO4JdJTMDfaK8zgNLaRkiU8Qcj+qhLYH
-ytaqcwIDAQABo4IB6jCCAeYwCQYDVR0TBAIwADAOBgNVHQ8BAf8EBAMCB4AwfwYD
-VR0fBHgwdjB0oHKgcIZuaHR0cDovL29uc2l0ZWNybC52ZXJpc2lnbi5jb20vU3Vu
-TWljcm9zeXN0ZW1zSW5jQ29ycG9yYXRlT2JqZWN0U2lnbmluZ0phdmFTaWduZWRF
-eHRlbnNpb25zQ2xhc3NCL0xhdGVzdENSTC5jcmwwHwYDVR0jBBgwFoAUs0crgn5T
-tHPKuLsZt76BTQeVx+0wHQYDVR0OBBYEFKS32mVx0gNWTeS4ProHEaeSpvvIMDsG
-CCsGAQUFBwEBBC8wLTArBggrBgEFBQcwAYYfaHR0cDovL29uc2l0ZS1vY3NwLnZl
-cmlzaWduLmNvbTCBtQYDVR0gBIGtMIGqMDkGC2CGSAGG+EUBBxcCMCowKAYIKwYB
-BQUHAgEWHGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9ycGEwbQYLYIZIAYb3AIN9
-nD8wXjAnBggrBgEFBQcCARYbaHR0cHM6Ly93d3cuc3VuLmNvbS9wa2kvY3BzMDMG
-CCsGAQUFBwICMCcaJVZhbGlkYXRlZCBGb3IgU3VuIEJ1c2luZXNzIE9wZXJhdGlv
-bnMwEwYDVR0lBAwwCgYIKwYBBQUHAwMwDQYJKoZIhvcNAQEFBQADggEBAAe6BO4W
-3TSNWfezyelJs6kE3HfulT6Bdyz4UUoh9ykXcV8nRwT+kh25I5MdyG2GfkJoADPR
-VhC5DYo13UFpIsTNVjq+hGYe2hML93bN7ad9SxCCyjHUo3yMz2qgBbHZI3VA9ZHA
-aWM4Tx0saMwbcnVvlbuGh+PXvStfypJqYT6lzcdFfjNVX4FI/QQNGhBswMY51tC8
-GTBCL2qhJon0gSCU4zaawDOf7+XxJWirLamYL1Aal1/h2z2sFrvA/1ftxtU3kZ6I
-7De8DyoHeZg7pYGdrj7g+lPhCga/WvEhN152I+aP08YbFcJHYmK05ngl/Ye4c6Bd
-cdrdfbw6QzEUIYY=
------END CERTIFICATE-----
-
-// Subject: CN=JavaFX 1.0 Runtime,
-//          OU=Java Signed Extensions,
-//          OU=Corporate Object Signing,
-//          O=Sun Microsystems Inc
-// Issuer:  CN=Object Signing CA,
-//          OU=Class 2 OnSite Subscriber CA,
-//          OU=VeriSign Trust Network,
-//          O=Sun Microsystems Inc
-// Serial:  55:c0:e6:44:59:59:79:9e:d9:26:f1:b0:4a:1e:f0:27
------BEGIN CERTIFICATE-----
-MIIFezCCBGOgAwIBAgIQVcDmRFlZeZ7ZJvGwSh7wJzANBgkqhkiG9w0BAQUFADCB
-gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT
-aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj
-cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA4MTAwOTAw
-MDAwMFoXDTExMTAwOTIzNTk1OVowgYAxHTAbBgNVBAoUFFN1biBNaWNyb3N5c3Rl
-bXMgSW5jMSEwHwYDVQQLFBhDb3Jwb3JhdGUgT2JqZWN0IFNpZ25pbmcxHzAdBgNV
-BAsUFkphdmEgU2lnbmVkIEV4dGVuc2lvbnMxGzAZBgNVBAMUEkphdmFGWCAxLjAg
-UnVudGltZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM+WDc6+bu+4
-tmAcS/lBtUc02WOt9QZpVsXg9cG2pu/8bUtmDELa8iiYBVFpIs8DU58HLrGQtCUY
-SIAGOVPsOJoN29UKCDWfY9j5JeVhfhMGqk9DwrWhzgsjy4cpZ1pIp+k/fJ8zT8Ul
-aYLpow1vg3UNddsmwz02tN7cOrMw9WYIG4CRYnY1OrtJSfe2pYzheC4zyvR+aiVl
-nang2OtqikSQsNFOFHsLOJFxngy9LrO8evDSu25VTKI6zlWU6/bMeqtztJPN0VOn
-NyUrJZvkxZ207Jg0T693BGSxNC1n+ihztXogql8950M/pEuUbDjylv5FFvlp6DSB
-dDT2MkutmyMCAwEAAaOCAeowggHmMAkGA1UdEwQCMAAwDgYDVR0PAQH/BAQDAgeA
-MH8GA1UdHwR4MHYwdKByoHCGbmh0dHA6Ly9vbnNpdGVjcmwudmVyaXNpZ24uY29t
-L1N1bk1pY3Jvc3lzdGVtc0luY0NvcnBvcmF0ZU9iamVjdFNpZ25pbmdKYXZhU2ln
-bmVkRXh0ZW5zaW9uc0NsYXNzQi9MYXRlc3RDUkwuY3JsMB8GA1UdIwQYMBaAFLNH
-K4J+U7Rzyri7Gbe+gU0HlcftMB0GA1UdDgQWBBTjgufVi3XJ3gx1ewsA6Rr7BR4Z
-zjA7BggrBgEFBQcBAQQvMC0wKwYIKwYBBQUHMAGGH2h0dHA6Ly9vbnNpdGUtb2Nz
-cC52ZXJpc2lnbi5jb20wgbUGA1UdIASBrTCBqjA5BgtghkgBhvhFAQcXAjAqMCgG
-CCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMG0GC2CGSAGG
-9wCDfZw/MF4wJwYIKwYBBQUHAgEWG2h0dHBzOi8vd3d3LnN1bi5jb20vcGtpL2Nw
-czAzBggrBgEFBQcCAjAnGiVWYWxpZGF0ZWQgRm9yIFN1biBCdXNpbmVzcyBPcGVy
-YXRpb25zMBMGA1UdJQQMMAoGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBQUAA4IBAQAB
-YVJTTVe7rzyTO4jc3zajErOT/COkdQTfNo0eIX1QbNynFieJvwY/jRzUZwjktIFR
-2p4JtbpHGAtKtjOAOTieQ8xdDOoC1djzpE7/AbMvuvlTavtUKT+F7tPdhfXgWXJV
-6Wbt8jryKyk3zZGiEhauIwZUkfjRkEtffEmZWLUd8c8rURJjfC/XHH2oyurscoxc
-CjX29c9ynxSiS/VvQp1an0HvErGh69N48wj7cj8mtZ1yHzd2XCzSSR1OfTPfk0Pt
-yg51p7yJaFiH21PTZegEL6zyVNOYBTKwwIi2OzpwYalD3uvK6e3OKDrfFCOxu17u
-4PveESbrdyrmvLe7IVez
------END CERTIFICATE-----
-
-// Subject: CN=JavaFX Runtime,
-//          OU=Java Signed Extensions,
-//          OU=Corporate Object Signing,
-//          O=Sun Microsystems Inc
-// Issuer:  CN=Object Signing CA,
-//          OU=Class 2 OnSite Subscriber CA,
-//          OU=VeriSign Trust Network,
-//          O=Sun Microsystems Inc
-// Serial:  47:f4:55:f1:da:4a:5e:f9:e3:f7:a8:03:62:17:c0:ff
------BEGIN CERTIFICATE-----
-MIIFdjCCBF6gAwIBAgIQR/RV8dpKXvnj96gDYhfA/zANBgkqhkiG9w0BAQUFADCB
-gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT
-aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj
-cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA5MDEyOTAw
-MDAwMFoXDTEyMDEyOTIzNTk1OVowfDEdMBsGA1UEChQUU3VuIE1pY3Jvc3lzdGVt
-cyBJbmMxITAfBgNVBAsUGENvcnBvcmF0ZSBPYmplY3QgU2lnbmluZzEfMB0GA1UE
-CxQWSmF2YSBTaWduZWQgRXh0ZW5zaW9uczEXMBUGA1UEAxQOSmF2YUZYIFJ1bnRp
-bWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCIzd0fAk8mI9ONc6RJ
-aGieioK2FLdXEwj8zL3vdGDVmBwyR1zwYkaOIFFgF9IW/8qc4iAYA5sGUY+0g8q3
-5DuYAxfTzBB5KdaYvbuq6GGnoHIWmTirXY+1friFp8lyXSvtuEaGB1VHaBoZchEg
-k+UgeVDA43dHwcT1Ov3DePczJRUes8T/QHzLX+BxUDG43vjyncCEO/AjqLZxXEz2
-xrNbKLcH3lGMJK7hdbfssUfF5BjC38Hn71HauYlA43b2no+2y0Sjulwzez2YPbDC
-0GLR3TnKtA8dqOrnl5t3DniDbfOBNtBE3VOydJO0XW57Ng1HRXD023nm9ECPY2xp
-0N/pAgMBAAGjggHqMIIB5jAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDB/BgNV
-HR8EeDB2MHSgcqBwhm5odHRwOi8vb25zaXRlY3JsLnZlcmlzaWduLmNvbS9TdW5N
-aWNyb3N5c3RlbXNJbmNDb3Jwb3JhdGVPYmplY3RTaWduaW5nSmF2YVNpZ25lZEV4
-dGVuc2lvbnNDbGFzc0IvTGF0ZXN0Q1JMLmNybDAfBgNVHSMEGDAWgBSzRyuCflO0
-c8q4uxm3voFNB5XH7TAdBgNVHQ4EFgQUvOdd0cKPj+Yik/iOBwTdphh5A+gwOwYI
-KwYBBQUHAQEELzAtMCsGCCsGAQUFBzABhh9odHRwOi8vb25zaXRlLW9jc3AudmVy
-aXNpZ24uY29tMIG1BgNVHSAEga0wgaowOQYLYIZIAYb4RQEHFwIwKjAoBggrBgEF
-BQcCARYcaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYTBtBgtghkgBhvcAg32c
-PzBeMCcGCCsGAQUFBwIBFhtodHRwczovL3d3dy5zdW4uY29tL3BraS9jcHMwMwYI
-KwYBBQUHAgIwJxolVmFsaWRhdGVkIEZvciBTdW4gQnVzaW5lc3MgT3BlcmF0aW9u
-czATBgNVHSUEDDAKBggrBgEFBQcDAzANBgkqhkiG9w0BAQUFAAOCAQEAbGcf2NjL
-AI93HG6ny2BbepaZA1a8xa/R6uUc7xV+Qw6MgLwFD4Q4i6LWUztQDvg9l68MM2/i
-Y9LEi1KM4lcNbK5+D+t9x98wXBiuojXhVdp5ZmC03EyEBbriopdBsmXVLDSu/Y3+
-zowOO5xwpMK3dbgsSDs2Vt0UosD3FTcRaD3GNfOhXMp+o1grHNiXF9YgkmdQbPPZ
-DQ2KBhFPCRJXBGvyKOqno/DTg0sQ3crGH/C4/4t7mnQXWldZotmJUZ0ONc9oD+Q1
-JAaguUKqIwn9yZ093ie+JWHbYNid9IIIPXYgtRxmf9a376WBhqhu56uJftBJ7x9g
-eQ7Lot6CSWCiFw==
------END CERTIFICATE-----
-
-// Subject: CN=Solaris INTERNAL DEVELOPMENT USE ONLY,
-//          OU=Solaris Cryptographic Framework,
-//          OU=Corporate Object Signing,
-//          O=Sun Microsystems Inc
-// Issuer:  CN=Object Signing CA,
-//          OU=Class 2 OnSite Subscriber CA,
-//          OU=VeriSign Trust Network,
-//          O=Sun Microsystems Inc
-// Serial:  77:29:77:52:6a:19:7b:9a:a6:a2:c7:99:a0:e1:cd:8c
------BEGIN CERTIFICATE-----
-MIIFHjCCBAagAwIBAgIQdyl3UmoZe5qmoseZoOHNjDANBgkqhkiG9w0BAQUFADCB
-gzEdMBsGA1UEChMUU3VuIE1pY3Jvc3lzdGVtcyBJbmMxHzAdBgNVBAsTFlZlcmlT
-aWduIFRydXN0IE5ldHdvcmsxJTAjBgNVBAsTHENsYXNzIDIgT25TaXRlIFN1YnNj
-cmliZXIgQ0ExGjAYBgNVBAMTEU9iamVjdCBTaWduaW5nIENBMB4XDTA3MDEwNDAw
-MDAwMFoXDTEwMDEwMzIzNTk1OVowgZwxHTAbBgNVBAoUFFN1biBNaWNyb3N5c3Rl
-bXMgSW5jMSEwHwYDVQQLFBhDb3Jwb3JhdGUgT2JqZWN0IFNpZ25pbmcxKDAmBgNV
-BAsUH1NvbGFyaXMgQ3J5cHRvZ3JhcGhpYyBGcmFtZXdvcmsxLjAsBgNVBAMUJVNv
-bGFyaXMgSU5URVJOQUwgREVWRUxPUE1FTlQgVVNFIE9OTFkwgZ8wDQYJKoZIhvcN
-AQEBBQADgY0AMIGJAoGBALbNU4hf3mD5ArDI9pjgioAyvV3bjMPRQdCZniIeGJBp
-odFlSEH+Mh64W1DsY8coeZ7FvvGJkx9IpTMJW9k8w1oJK9UNqHyAQfaYjQyXi3xQ
-LJp62EvYdGfDlwOZejEcR/MbzZG+GOPMMvQj5+xyFDvLXNGfQNTnxw2qnBgCJXjj
-AgMBAAGjggH1MIIB8TAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDCBiQYDVR0f
-BIGBMH8wfaB7oHmGd2h0dHA6Ly9vbnNpdGVjcmwudmVyaXNpZ24uY29tL1N1bk1p
-Y3Jvc3lzdGVtc0luY0NvcnBvcmF0ZU9iamVjdFNpZ25pbmdTb2xhcmlzQ3J5cHRv
-Z3JhcGhpY0ZyYW1ld29ya0NsYXNzQi9MYXRlc3RDUkwuY3JsMB8GA1UdIwQYMBaA
-FLNHK4J+U7Rzyri7Gbe+gU0HlcftMB0GA1UdDgQWBBRpfiGYkehTnsIzuN2H6AFb
-VCZG8jA7BggrBgEFBQcBAQQvMC0wKwYIKwYBBQUHMAGGH2h0dHA6Ly9vbnNpdGUt
-b2NzcC52ZXJpc2lnbi5jb20wgbUGA1UdIASBrTCBqjA5BgtghkgBhvhFAQcXAjAq
-MCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMG0GC2CG
-SAGG9wCDfZw/MF4wJwYIKwYBBQUHAgEWG2h0dHBzOi8vd3d3LnN1bi5jb20vcGtp
-L2NwczAzBggrBgEFBQcCAjAnFiVWYWxpZGF0ZWQgRm9yIFN1biBCdXNpbmVzcyBP
-cGVyYXRpb25zMBMGA1UdJQQMMAoGCCsGAQUFBwMDMA0GCSqGSIb3DQEBBQUAA4IB
-AQCG5soy3LFHTFbA8/5SzDRhQoJkHUnOP0t3b6nvX6vZYRp649fje7TQOPRm1pFd
-CZ17J+tggdZwgzTqY4aYpJ00jZaK6pV37q/vgFC/ia6jDs8Q+ly9cEcadBZ5loYg
-cmxp9p57W2MNWx8VA8oFdNtKfF0jUNXbLNtvwGHmgR6YcwLrGN1b6/9Lt9bO3ODl
-FO+ZDwkfQz5ClUVrTx2dGBvKRYFqSG5S8JAfsgYhPvcacUQkA7ExyKvfRXLWVrce
-ZiPpcElbx+819H2sAPvVvparVeAruZGMAtejHZp9NFoowKen5drJp9VxePS4eM49
-3DepB6lKRrNRw66LNQol4ZBz
------END CERTIFICATE-----
-
-// Subject: EMAILADDRESS=info@diginotar.nl, CN=DigiNotar Cyber CA,
-//          O=DigiNotar, C=NL
-// Issuer:  CN=GTE CyberTrust Global Root,
-//          OU=GTE CyberTrust Solutions, Inc.,
-//          O=GTE Corporation,
-//          C=US
-// Serial:  120000525 (07:27:10:0D)
------BEGIN CERTIFICATE-----
-MIIFWjCCBMOgAwIBAgIEBycQDTANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV
-UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
-cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
-b2JhbCBSb290MB4XDTA2MTAwNDEwNTQxMVoXDTExMTAwNDEwNTMxMVowYDELMAkG
-A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy
-IEN5YmVyIENBMSAwHgYJKoZIhvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIw
-DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANLOFQotqF6EZ639vu9Gx8i5z3P8
-9DS5+SxD52ATPXrjss87Z2yQrcC5P4RS8DVC3HTcKDu9UrSnrHJFF8bwieu0qiXy
-XUte0dmHutZ9fPXOMp8QM8WxSrtekTHC0OlBwpFkfglBO9uLCDdqqspS3rU5HsCI
-A6U/i5kTYUO1m4Kz7iBvz6FEouova0CfjytXraFTwoUiaZ2gP1HfC0GRDaXhqKpc
-SQhdvd5wQbEPyWNr0380dAIvNFp4dRxoeoFnivPaQPBgY/SSINcDpj2jHmfEhBtB
-pcmM5r3qSLYFFgizNxJa92E89zhvLpfgb1Y4VNMota0Ubi5LZLUnZbd1JQm2Bz2V
-VgIKgmCyc0XgMyZRdJq51FAc9k1bW1JSE1qmf6cO4ehBVGeYjIfVydNsy9NUkgYJ
-NEH3gW8/nsl8dVWw58Gzd+jDxAA1lUBwEEoF3iW7n1mlZLxHYL9g43aLE1Xd4XR6
-uc8kpmp/3mQiRFhogmoQ+T3lPhu5vfwi9GAEibtVbShV+t6OjRshFNc3izR7Tfay
-shDPM7F9HGKZSMsrbHaWVb8ZDR0fu2WqG46ZtcYokOWCLXhQIJr9eS8kf/CJKWn0
-fc1zvrPtTsHR7VJej/e4142HrbLZG1ES/1az4a80fVykeIgQnp0DxqWqoiRR90kU
-xbHuWUOV36toKDA/AgMBAAGjggGGMIIBgjASBgNVHRMBAf8ECDAGAQH/AgEBMFMG
-A1UdIARMMEowSAYJKwYBBAGxPgEAMDswOQYIKwYBBQUHAgEWLWh0dHA6Ly93d3cu
-cHVibGljLXRydXN0LmNvbS9DUFMvT21uaVJvb3QuaHRtbDAOBgNVHQ8BAf8EBAMC
-AQYwgaAGA1UdIwSBmDCBlYAUpgwdn2H/Bxe1vzhG20Mw1Y6wUgaheaR3MHUxCzAJ
-BgNVBAYTAlVTMRgwFgYDVQQKEw9HVEUgQ29ycG9yYXRpb24xJzAlBgNVBAsTHkdU
-RSBDeWJlclRydXN0IFNvbHV0aW9ucywgSW5jLjEjMCEGA1UEAxMaR1RFIEN5YmVy
-VHJ1c3QgR2xvYmFsIFJvb3SCAgGlMEUGA1UdHwQ+MDwwOqA4oDaGNGh0dHA6Ly93
-d3cucHVibGljLXRydXN0LmNvbS9jZ2ktYmluL0NSTC8yMDE4L2NkcC5jcmwwHQYD
-VR0OBBYEFKv5aN/PSjfXe0WMX3LeQETDZbvCMA0GCSqGSIb3DQEBBQUAA4GBAI9o
-a6VbB7pEZg4cqFwwezPkCiYE/O+eGjjWLqEf0JlHwnVkJP2eOyh2uSYoYZEMbSz4
-BJ98UAHV42mv7xXSRZskCSpmBU8lgcpdvqrBWSeuM46C9990sFWzjvjnN8huqlZE
-9r1TgSOWPbT6MopTZkQloiXGpjwljPDgKAYityZB
------END CERTIFICATE-----
-
-// Subject: CN=DigiNotar Cyber CA, O=DigiNotar, C=NL
-// Issuer:  CN=GTE CyberTrust Global Root,
-//          OU=GTE CyberTrust Solutions, Inc.,
-//          O=GTE Corporation,
-//          C=US
-// Serial:  120000505 (07:27:0F:F9)
------BEGIN CERTIFICATE-----
-MIIFODCCBKGgAwIBAgIEBycP+TANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV
-UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
-cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
-b2JhbCBSb290MB4XDTA2MDkyMDA5NDUzMloXDTEzMDkyMDA5NDQwNlowPjELMAkG
-A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy
-IEN5YmVyIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0s4VCi2o
-XoRnrf2+70bHyLnPc/z0NLn5LEPnYBM9euOyzztnbJCtwLk/hFLwNULcdNwoO71S
-tKesckUXxvCJ67SqJfJdS17R2Ye61n189c4ynxAzxbFKu16RMcLQ6UHCkWR+CUE7
-24sIN2qqylLetTkewIgDpT+LmRNhQ7WbgrPuIG/PoUSi6i9rQJ+PK1etoVPChSJp
-naA/Ud8LQZENpeGoqlxJCF293nBBsQ/JY2vTfzR0Ai80Wnh1HGh6gWeK89pA8GBj
-9JIg1wOmPaMeZ8SEG0GlyYzmvepItgUWCLM3Elr3YTz3OG8ul+BvVjhU0yi1rRRu
-LktktSdlt3UlCbYHPZVWAgqCYLJzReAzJlF0mrnUUBz2TVtbUlITWqZ/pw7h6EFU
-Z5iMh9XJ02zL01SSBgk0QfeBbz+eyXx1VbDnwbN36MPEADWVQHAQSgXeJbufWaVk
-vEdgv2DjdosTVd3hdHq5zySman/eZCJEWGiCahD5PeU+G7m9/CL0YASJu1VtKFX6
-3o6NGyEU1zeLNHtN9rKyEM8zsX0cYplIyytsdpZVvxkNHR+7Zaobjpm1xiiQ5YIt
-eFAgmv15LyR/8IkpafR9zXO+s+1OwdHtUl6P97jXjYetstkbURL/VrPhrzR9XKR4
-iBCenQPGpaqiJFH3SRTFse5ZQ5Xfq2goMD8CAwEAAaOCAYYwggGCMBIGA1UdEwEB
-/wQIMAYBAf8CAQEwUwYDVR0gBEwwSjBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcC
-ARYtaHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL0NQUy9PbW5pUm9vdC5odG1s
-MA4GA1UdDwEB/wQEAwIBBjCBoAYDVR0jBIGYMIGVgBSmDB2fYf8HF7W/OEbbQzDV
-jrBSBqF5pHcwdTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD0dURSBDb3Jwb3JhdGlv
-bjEnMCUGA1UECxMeR1RFIEN5YmVyVHJ1c3QgU29sdXRpb25zLCBJbmMuMSMwIQYD
-VQQDExpHVEUgQ3liZXJUcnVzdCBHbG9iYWwgUm9vdIICAaUwRQYDVR0fBD4wPDA6
-oDigNoY0aHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL2NnaS1iaW4vQ1JMLzIw
-MTgvY2RwLmNybDAdBgNVHQ4EFgQUq/lo389KN9d7RYxfct5ARMNlu8IwDQYJKoZI
-hvcNAQEFBQADgYEACcpiD427SuDUejUrBi3RKGG2rAH7g0m8rtQvLYauGYOl1h0T
-4he+/jJ06XoUOMqUXvcpAWlxG5Ea/aO7qh3Ke+IW/aGjDvMMX7LhIDGUK16Sdu36
-6bUjpr8KOwOpb1JgVM1f6bcvfKIn/UGDdbYN+3gm87FF6TKVKho1IZXFonU=
------END CERTIFICATE-----
-
-// Subject: CN=DigiNotar Cyber CA, O=DigiNotar, C=NL
-// Issuer:  CN=GTE CyberTrust Global Root,
-//          OU=GTE CyberTrust Solutions, Inc.,
-//          O=GTE Corporation,
-//          C=US
-// Serial:  120000515 (07:27:10:03)
------BEGIN CERTIFICATE-----
-MIIFODCCBKGgAwIBAgIEBycQAzANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQGEwJV
-UzEYMBYGA1UEChMPR1RFIENvcnBvcmF0aW9uMScwJQYDVQQLEx5HVEUgQ3liZXJU
-cnVzdCBTb2x1dGlvbnMsIEluYy4xIzAhBgNVBAMTGkdURSBDeWJlclRydXN0IEds
-b2JhbCBSb290MB4XDTA2MDkyNzEwNTMzMloXDTExMDkyNzEwNTIzMFowPjELMAkG
-A1UEBhMCTkwxEjAQBgNVBAoTCURpZ2lOb3RhcjEbMBkGA1UEAxMSRGlnaU5vdGFy
-IEN5YmVyIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0s4VCi2o
-XoRnrf2+70bHyLnPc/z0NLn5LEPnYBM9euOyzztnbJCtwLk/hFLwNULcdNwoO71S
-tKesckUXxvCJ67SqJfJdS17R2Ye61n189c4ynxAzxbFKu16RMcLQ6UHCkWR+CUE7
-24sIN2qqylLetTkewIgDpT+LmRNhQ7WbgrPuIG/PoUSi6i9rQJ+PK1etoVPChSJp
-naA/Ud8LQZENpeGoqlxJCF293nBBsQ/JY2vTfzR0Ai80Wnh1HGh6gWeK89pA8GBj
-9JIg1wOmPaMeZ8SEG0GlyYzmvepItgUWCLM3Elr3YTz3OG8ul+BvVjhU0yi1rRRu
-LktktSdlt3UlCbYHPZVWAgqCYLJzReAzJlF0mrnUUBz2TVtbUlITWqZ/pw7h6EFU
-Z5iMh9XJ02zL01SSBgk0QfeBbz+eyXx1VbDnwbN36MPEADWVQHAQSgXeJbufWaVk
-vEdgv2DjdosTVd3hdHq5zySman/eZCJEWGiCahD5PeU+G7m9/CL0YASJu1VtKFX6
-3o6NGyEU1zeLNHtN9rKyEM8zsX0cYplIyytsdpZVvxkNHR+7Zaobjpm1xiiQ5YIt
-eFAgmv15LyR/8IkpafR9zXO+s+1OwdHtUl6P97jXjYetstkbURL/VrPhrzR9XKR4
-iBCenQPGpaqiJFH3SRTFse5ZQ5Xfq2goMD8CAwEAAaOCAYYwggGCMBIGA1UdEwEB
-/wQIMAYBAf8CAQEwUwYDVR0gBEwwSjBIBgkrBgEEAbE+AQAwOzA5BggrBgEFBQcC
-ARYtaHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL0NQUy9PbW5pUm9vdC5odG1s
-MA4GA1UdDwEB/wQEAwIBBjCBoAYDVR0jBIGYMIGVgBSmDB2fYf8HF7W/OEbbQzDV
-jrBSBqF5pHcwdTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD0dURSBDb3Jwb3JhdGlv
-bjEnMCUGA1UECxMeR1RFIEN5YmVyVHJ1c3QgU29sdXRpb25zLCBJbmMuMSMwIQYD
-VQQDExpHVEUgQ3liZXJUcnVzdCBHbG9iYWwgUm9vdIICAaUwRQYDVR0fBD4wPDA6
-oDigNoY0aHR0cDovL3d3dy5wdWJsaWMtdHJ1c3QuY29tL2NnaS1iaW4vQ1JMLzIw
-MTgvY2RwLmNybDAdBgNVHQ4EFgQUq/lo389KN9d7RYxfct5ARMNlu8IwDQYJKoZI
-hvcNAQEFBQADgYEAWcyGZhizJlRP1jjNupZey+yZG6oMDW4Z11boriMHbYPCndBE
-bVh07zmPbZsihOw9w/vm5KbVX5CgxUv4Rhzh/20Faixf3P3bpWg0qgzHVVusNVR/
-P50aKkpdK3hp+QLl56e+lWOddSAINIpmcuyDI1hyuzB+GJEASm9tNU/6rs8=
------END CERTIFICATE-----
-
-// Subject: EMAILADDRESS=info@diginotar.nl,
-//          CN=DigiNotar Root CA,
-//          O=DigiNotar, C=NL
-// Issuer:  CN=Entrust.net Secure Server Certification Authority
-//          OU=(c) 1999 Entrust.net Limited,
-//          OU=www.entrust.net/CPS incorp. by ref. (limits liab.),
-//          O=Entrust.net,
-//          C=US,
-// Serial:  1184644297 (46:9C:3C:C9)
------BEGIN CERTIFICATE-----
-MIIFSDCCBLGgAwIBAgIERpw8yTANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
-VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
-ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
-KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
-ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA0
-MjYwNTAwMDBaFw0xMzA4MTQyMDEyMzZaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK
-EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI
-hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP
-ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt
-OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx
-hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7
-gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D
-IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T
-BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs
-Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8
-5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf
-DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX
-9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e
-7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj
-ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB
-BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF
-BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD
-VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy
-bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G
-A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob
-BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAI979rBep8tu3TeLunapgsZ0jtXp
-GDFjKWSk87dj1jCyYi+q/GyDyZ6ZQZNRP0sF+6twscq05lClWNy3TROMp7QeuoLO
-G7Utw3OJaswUtp4YglANMRTHEe3g9ltifUXRH5tSuy7u6yi4LD4WTm5ULP6r/g6l
-0CnjXYb0+b1Fmz6U
------END CERTIFICATE-----
-
-// Subject: EMAILADDRESS=info@diginotar.nl,
-//          CN=DigiNotar Root CA,
-//          O=DigiNotar, C=NL
-// Issuer:  CN=Entrust.net Secure Server Certification Authority
-//          OU=(c) 1999 Entrust.net Limited,
-//          OU=www.entrust.net/CPS incorp. by ref. (limits liab.),
-//          O=Entrust.net,
-//          C=US,
-// Serial:  1184640175 (46:9C:2C:AF)
------BEGIN CERTIFICATE-----
-MIIFSDCCBLGgAwIBAgIERpwsrzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
-VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
-ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
-KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
-ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3
-MjYxNTU3MzlaFw0xMzA4MjYxNjI3MzlaMF8xCzAJBgNVBAYTAk5MMRIwEAYDVQQK
-EwlEaWdpTm90YXIxGjAYBgNVBAMTEURpZ2lOb3RhciBSb290IENBMSAwHgYJKoZI
-hvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCCAiIwDQYJKoZIhvcNAQEBBQADggIP
-ADCCAgoCggIBAKywWMEAvdghCAsrmv5uVjAFnxt3kBBBXMMNhxF3joHxynzpjGrt
-OHQ1u9rf+bvACTe0lnOBfTMamDn3k2+Vfz25sXWHulFI6ItwPpUExdi2wxbZiLCx
-hx1w2oa0DxSLes8Q0XQ2ohJ7d4ZKeeZ73wIRaKVOhq40WJskE3hWIiUeAYtLUXH7
-gsxZlmmIWmhTxbkNAjfLS7xmSpB+KgsFB+0WX1WQddhGyRuD4gi+8SPMmR3WKg+D
-IBVYJ4Iu+uIiwkmxuQGBap1tnUB3aHZOISpthECFTnaZfILz87cCWdQmARuO361T
-BtGuGN3isjrL14g4jqxbKbkZ05j5GAPPSIKGZgsbaQ/J6ziIeiYaBUyS1yTUlvKs
-Ui2jR9VS9j/+zoQGcKaqPqLytlY0GFei5IFt58rwatPHkWsCg0F8Fe9rmmRe49A8
-5bHre12G+8vmd0nNo2Xc97mcuOQLX5PPzDAaMhzOHGOVpfnq4XSLnukrqTB7oBgf
-DhgL5Vup09FsHgdnj5FLqYq80maqkwGIspH6MVzVpsFSCAnNCmOi0yKm6KHZOQaX
-9W6NApCMFHs/gM0bnLrEWHIjr7ZWn8Z6QjMpBz+CyeYfBQ3NTCg2i9PIPhzGiO9e
-7olk6R3r2ol+MqZp0d3MiJ/R0MlmIdwGZ8WUepptYkx9zOBkgLKeR46jAgMBAAGj
-ggEmMIIBIjASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMB
-BggrBgEFBQcDAgYIKwYBBQUHAwQwEQYDVR0gBAowCDAGBgRVHSAAMDMGCCsGAQUF
-BwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZW50cnVzdC5uZXQwMwYD
-VR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5lbnRydXN0Lm5ldC9zZXJ2ZXIxLmNy
-bDAdBgNVHQ4EFgQUiGi/4I41xDs4a2L3KDuEgcgM100wCwYDVR0PBAQDAgEGMB8G
-A1UdIwQYMBaAFPAXYhNVPbP/CgBr+1CEl/PtYtAaMBkGCSqGSIb2fQdBAAQMMAob
-BFY3LjEDAgCBMA0GCSqGSIb3DQEBBQUAA4GBAEa6RcDNcEIGUlkDJUY/pWTds4zh
-xbVkp3wSmpwPFhx5fxTyF4HD2L60jl3aqjTB7gPpsL2Pk5QZlNsi3t4UkCV70UOd
-ueJRN3o/LOtk4+bjXY2lC0qTHbN80VMLqPjmaf9ghSA9hwhskdtMgRsgfd90q5QP
-ZFdYf+hthc3m6IcJ
------END CERTIFICATE-----
-
-// Subject: CN=DigiNotar PKIoverheid CA Organisatie - G2,
-//          O=DigiNotar B.V.,
-//          C=NL
-// Issuer:  CN=Staat der Nederlanden Organisatie CA - G2,
-//          O=Staat der Nederlanden,
-//          C=NL
-// Serial:  20001983 (01:31:34:bf)
------BEGIN CERTIFICATE-----
-MIIGnDCCBISgAwIBAgIEATE0vzANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQGEwJO
-TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTIwMAYDVQQDDClTdGFh
-dCBkZXIgTmVkZXJsYW5kZW4gT3JnYW5pc2F0aWUgQ0EgLSBHMjAeFw0xMDA1MTIw
-ODUxMzhaFw0yMDAzMjMwOTUwMDRaMFoxCzAJBgNVBAYTAk5MMRcwFQYDVQQKDA5E
-aWdpTm90YXIgQi5WLjEyMDAGA1UEAwwpRGlnaU5vdGFyIFBLSW92ZXJoZWlkIENB
-IE9yZ2FuaXNhdGllIC0gRzIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
-AQCxExkPJ+Zs1FWGS9DsiYpFkXisR71HK+T8RetPtCZzWzfTw3/2497Xo/gtaMUI
-PkuU1uSHJTZrhLUYdPMoWHMvm2rPvAQe9t7dr/xLqvXbZmIlASWC3vKXWhBu3V2p
-IrEEqSNzOvhxrR3PhETrR9Gvbch8KKvH8jd6dF9fxQIUiqNa4xtsAeNdjtlo1vQJ
-GzLckbUs9SDrjANtJkm4k8SFXdjSm69WaswFM8ygQp40VUSca6DUEtArVM23iQ3l
-9uvo+4UBM096a/GdcjOWDveyhKWlJ8Qn8VFzKXe6Z27+TNy04qGhgS85SY1DOBPO
-0KVcwoc6AGdlQiPxNlkKHaNRyLyjlCox3+M88p0aPASw77EKMBNzttfzo0wBdRSF
-eMDXijlYhVD6LubFvs+LP6+PNtQlCS3SD6xyk/K/i9RQs/kVUJuZ9RTZ+4uRozIm
-JqD43ztggYaDeVsr6xM9KTrBbd29no6H1kquNJcF7hSm9tw4fkrpJFQHPZdoN0Zr
-DceoIa8TVOQJavFNRgrJXfubT73e+7dUy7g4nKc5+2otwHuNq6WnV+xKkoozxeEg
-XHPYkJIrgNUPhhhpfDlPhIa890xb89W0yqDC8DciynlSH1PmqvOQsDvd8ij9rOvF
-BiSgydQvD1j9tZ7sD8+yWdCiBHo4aq5y+73wJWKUCacFCwIDAQABo4IBYTCCAV0w
-SAYDVR0gBEEwPzA9BgRVHSAAMDUwMwYIKwYBBQUHAgEWJ2h0dHA6Ly93d3cuZGln
-aW5vdGFyLm5sL2Nwcy9wa2lvdmVyaGVpZDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
-DwEB/wQEAwIBBjCBhQYDVR0jBH4wfIAUORCLSZJc22ESIM1JnRqO2pxnQLmhXqRc
-MFoxCzAJBgNVBAYTAk5MMR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4x
-KzApBgNVBAMMIlN0YWF0IGRlciBOZWRlcmxhbmRlbiBSb290IENBIC0gRzKCBACY
-lvQwSQYDVR0fBEIwQDA+oDygOoY4aHR0cDovL2NybC5wa2lvdmVyaGVpZC5ubC9E
-b21PcmdhbmlzYXRpZUxhdGVzdENSTC1HMi5jcmwwHQYDVR0OBBYEFLxdlDvZq3sD
-JXNhwtst7vyrj2WhMA0GCSqGSIb3DQEBCwUAA4ICAQCP/C1Mt9kt1R+978v0t2gX
-dZ1O1ffdnPEqJu2forYcA9VTs+wIzzTi48P0tRYvyMO+19NzqwA2+RpKftZj6V5G
-uqW2jhW3oyrYQx3vXcgfgYWzi/f/PPTZ9EYIP5y8HaDZqEzNJVJOCrEg9x/pQ9lU
-RoETmsBedGwqmDLq/He7DaWiMZgifnx859qkrey3LhoZcfhIUNpDjyyE3cFAJ+O1
-8BVOltT4XOOGKUYr1zsH6zh/yIZXl9PvKjPEF1DVZGlrK2tFXl0vF8paTs/D1zk8
-9TufRrmb5w5Jl53W1eMbD+qPAU6aE5RZCgIHSEsaYKt/T+0L2FUNaG9VnGllFULs
-wNzdbKzDFs4LHVabpMTE0i7gD+JEJytQaaTcYuiKISlCbMwAOpZ2m+9AwKRed4Qy
-bCYqOWauXeO5ubIsaB8empADOfCqs6TMSYsYNOk3yXspx4R8b0QVL+xhWQTJRcui
-1lKifH8pktZKxYtCqNT+6tjHhyMY5J16fXNAUpigrm7jBT8FD+Clxm1N7YM3iJzH
-89xCmmq21yFJNnfy7xhPxXDZnunetyuL9Lx+KN8NQMmFXK6dxTH/0FwOtah+8Okv
-uq+IruW10Vilr5xxpykBkINpN4IFuvwJwQhujHg7wzMCgD9EhQgd31VWCK0shS1d
-sQPhrqp0xaTzTro3mHuCuQ==
------END CERTIFICATE-----
-
-// Subject: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven,
-//          O=DigiNotar B.V.,
-//          C=NL
-// Issuer:  CN=Staat der Nederlanden Overheid CA
-//          O=Staat der Nederlanden,
-//          C=NL
-// Serial:  20015536 (01:31:69:b0)
------BEGIN CERTIFICATE-----
-MIIEiDCCA3CgAwIBAgIEATFpsDANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJO
-TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSowKAYDVQQDEyFTdGFh
-dCBkZXIgTmVkZXJsYW5kZW4gT3ZlcmhlaWQgQ0EwHhcNMDcwNzA1MDg0MjA3WhcN
-MTUwNzI3MDgzOTQ2WjBfMQswCQYDVQQGEwJOTDEXMBUGA1UEChMORGlnaU5vdGFy
-IEIuVi4xNzA1BgNVBAMTLkRpZ2lOb3RhciBQS0lvdmVyaGVpZCBDQSBPdmVyaGVp
-ZCBlbiBCZWRyaWp2ZW4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDc
-vdKnTmoKuzuiheF/AK2+tDBomAfNoHrElM9x+Yo35FPrV3bMi+Zs/u6HVcg+uwQ5
-AKeAeKxbT370vbhUuHE7BzFJOZNUfCA7eSuPu2GQfbGs5h+QLp1FAalkLU3DL7nn
-UNVOKlyrdnY3Rtd57EKZ96LspIlw3Dgrh6aqJOadkiQbvvb91C8ZF3rmMgeUVAVT
-Q+lsvK9Hy7zL/b07RBKB8WtLu+20z6slTxjSzAL8o0+1QjPLWc0J3NNQ/aB2jKx+
-ZopC9q0ckvO2+xRG603XLzDgbe5bNr5EdLcgBVeFTegAGaL2DOauocBC36esgl3H
-aLcY5olLmmv6znn58yynAgMBAAGjggFQMIIBTDBIBgNVHSAEQTA/MD0GBFUdIAAw
-NTAzBggrBgEFBQcCARYnaHR0cDovL3d3dy5kaWdpbm90YXIubmwvY3BzL3BraW92
-ZXJoZWlkMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMIGABgNVHSME
-eTB3gBQLhtYPd6NosftkCcOIblwEHFfpPaFZpFcwVTELMAkGA1UEBhMCTkwxHjAc
-BgNVBAoTFVN0YWF0IGRlciBOZWRlcmxhbmRlbjEmMCQGA1UEAxMdU3RhYXQgZGVy
-IE5lZGVybGFuZGVuIFJvb3QgQ0GCBACYmnkwPQYDVR0fBDYwNDAyoDCgLoYsaHR0
-cDovL2NybC5wa2lvdmVyaGVpZC5ubC9Eb21PdkxhdGVzdENSTC5jcmwwHQYDVR0O
-BBYEFEwIyY128ZjHPt881y91DbF2eZfMMA0GCSqGSIb3DQEBBQUAA4IBAQAMlIca
-v03jheLu19hjeQ5Q38aEW9K72fUxCho1l3TfFPoqDz7toOMI9tVOW6+mriXiRWsi
-D7dUKH6S3o0UbNEc5W50BJy37zRERd/Jgx0ZH8Apad+J1T/CsFNt5U4X5HNhIxMm
-cUP9TFnLw98iqiEr2b+VERqKpOKrp11Lbyn1UtHk0hWxi/7wA8+nfemZhzizDXMU
-5HIs4c71rQZIZPrTKbmi2Lv01QulQERDjqC/zlqlUkxk0xcxYczopIro5Ij76eUv
-BjMzm5RmZrGrUDqhCYF0U1onuabSJc/Tw6f/ltAv6uAejVLpGBwgCkegllYOQJBR
-RKwa/fHuhR/3Qlpl
------END CERTIFICATE-----
-
-// Subject: CN=DigiNotar PKIoverheid CA Overheid
-//          O=DigiNotar B.V.,
-//          C=NL
-// Issuer:  CN=Staat der Nederlanden Overheid CA
-//          O=Staat der Nederlanden,
-//          C=NL
-// Serial:  20006006 (01:31:44:76)
------BEGIN CERTIFICATE-----
-MIIEezCCA2OgAwIBAgIEATFEdjANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJO
-TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSowKAYDVQQDEyFTdGFh
-dCBkZXIgTmVkZXJsYW5kZW4gT3ZlcmhlaWQgQ0EwHhcNMDQwNjI0MDgxOTMyWhcN
-MTAwNjIzMDgxNzM2WjBSMQswCQYDVQQGEwJOTDEXMBUGA1UEChMORGlnaU5vdGFy
-IEIuVi4xKjAoBgNVBAMTIURpZ2lOb3RhciBQS0lvdmVyaGVpZCBDQSBPdmVyaGVp
-ZDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANSlrubta5tlOjVCi/gb
-yLCvRqfBjxG8H594VcKHu0WAYc99SPZF9cycj5mw2GyfQvy/WIrGrL4iyNq1gSqR
-0QA/mTXKZIaPqzpDhdm+VvrKkmjrbZfaQxgMSs3ChtBsjcP9Lc0X1zXZ4Q8nBe3k
-BTp+zehINfmbjoEgXLxsMR5RQ6GxzKjuC04PQpbJQgTIakglKaqYcDDZbEscWgPV
-Hgj/2aoHlj6leW/ThHZ+O41jUguEmBLZA3mu3HrCfrHntb5dPt0ihzSx7GtD/SaX
-5HBLxnP189YuqMk5iRA95CtiSdKauvon/xRKRLNgG6XAz0ctSoY7xLDdiBVU5kJd
-FScCAwEAAaOCAVAwggFMMEgGA1UdIARBMD8wPQYEVR0gADA1MDMGCCsGAQUFBwIB
-FidodHRwOi8vd3d3LmRpZ2lub3Rhci5ubC9jcHMvcGtpb3ZlcmhlaWQwDwYDVR0T
-AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgYAGA1UdIwR5MHeAFAuG1g93o2ix
-+2QJw4huXAQcV+k9oVmkVzBVMQswCQYDVQQGEwJOTDEeMBwGA1UEChMVU3RhYXQg
-ZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFhdCBkZXIgTmVkZXJsYW5kZW4g
-Um9vdCBDQYIEAJiaeTA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3JsLnBraW92
-ZXJoZWlkLm5sL0RvbU92TGF0ZXN0Q1JMLmNybDAdBgNVHQ4EFgQUvRaYQh2+kdE9
-wpcl4CjXWOC1f+IwDQYJKoZIhvcNAQEFBQADggEBAGhQsCWLiaN2EOhPAW+JQP6o
-XBOrLv5w6joahzBFVn1BiefzmlMKjibqKYxURRvMAsMkh82/MfL8V0w6ugxl81lu
-i42dcxl9cKSVXKMw4bbBzJ2VQI5HTIABwefeNuy/eX6idVwYdt3ajAH7fUA8Q9Cq
-vr6H8B+8mwoEqTVTEVlCSsC/EXsokYEUr06PPzRudKjDmijgj7zFaIioZNc8hk7g
-ufEgrs/tmcNGylrwRHgCXjCRBt2NHlZ08l7A1AGU8HcHlSbG9Un/2q9kVHUkps0D
-gtUaEK+x6jpAu/R8Ojezu/+ZEcwwjI/KOhG+84+ejFmtyEkrUdsAdEdLf/2dKsw=
------END CERTIFICATE-----
-
-// Subject: EMAILADDRESS=info@diginotar.nl,
-//          CN=DigiNotar Services 1024 CA
-//          O=DigiNotar, C=NL
-// Issuer:  CN=Entrust.net Secure Server Certification Authority,
-//          OU=(c) 1999 Entrust.net Limited,
-//          OU=www.entrust.net/CPS incorp. by ref. (limits liab.),
-//          O=Entrust.net,
-//          C=US
-// Serial:  1184640176 (46:9c:2c:b0)
------BEGIN CERTIFICATE-----
-MIIDzTCCAzagAwIBAgIERpwssDANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC
-VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u
-ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc
-KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u
-ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNzA3
-MjYxNTU5MDBaFw0xMzA4MjYxNjI5MDBaMGgxCzAJBgNVBAYTAk5MMRIwEAYDVQQK
-EwlEaWdpTm90YXIxIzAhBgNVBAMTGkRpZ2lOb3RhciBTZXJ2aWNlcyAxMDI0IENB
-MSAwHgYJKoZIhvcNAQkBFhFpbmZvQGRpZ2lub3Rhci5ubDCBnzANBgkqhkiG9w0B
-AQEFAAOBjQAwgYkCgYEA2ptNXTz50eKLxsYIIMXZHkjsZlhneWIrQWP0iY1o2q+4
-lDaLGSSkoJPSmQ+yrS01Tc0vauH5mxkrvAQafi09UmTN8T5nD4ku6PJPrqYIoYX+
-oakJ5sarPkP8r3oDkdqmOaZh7phPGKjTs69mgumfvN1y+QYEvRLZGCTnq5NTi1kC
-AwEAAaOCASYwggEiMBIGA1UdEwEB/wQIMAYBAf8CAQAwJwYDVR0lBCAwHgYIKwYB
-BQUHAwEGCCsGAQUFBwMCBggrBgEFBQcDBDARBgNVHSAECjAIMAYGBFUdIAAwMwYI
-KwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5lbnRydXN0Lm5l
-dDAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3JsLmVudHJ1c3QubmV0L3NlcnZl
-cjEuY3JsMB0GA1UdDgQWBBT+3JRJDG/vXH/G8RKZTxZJrfuCZTALBgNVHQ8EBAMC
-AQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7UISX8+1i0BowGQYJKoZIhvZ9B0EA
-BAwwChsEVjcuMQMCAIEwDQYJKoZIhvcNAQEFBQADgYEAY3RqN6k/lpxmyFisCcnv
-9WWUf6MCxDgxvV0jh+zUVrLJsm7kBQb87PX6iHBZ1O7m3bV6oKNgLwIMq94SXa/w
-NUuqikeRGvWFLELHHe+VQ7NeuJWTpdrFKKqtci0xrZlrbP+MISevrZqRK8fdWMNu
-B8WfedLHjFW/TMcnXlEWKz4=
------END CERTIFICATE-----
-
-// Subject: CN=Buster Paper Comercial Ltda,
-//          O=Buster Paper Comercial Ltda,
-//          L=S?o Jos? Dos Campos,
-//          ST=S?o Paulo,
-//          C=BR
-// Issuer:  CN=DigiCert Assured ID Code Signing CA-1,
-//          OU=www.digicert.com,
-//          O=DigiCert Inc,
-//          C=US
-// Serial:  07:b4:4c:db:ff:fb:78:de:05:f4:26:16:72:a6:73:12
------BEGIN CERTIFICATE-----
-MIIGwzCCBaugAwIBAgIQB7RM2//7eN4F9CYWcqZzEjANBgkqhkiG9w0BAQUFADBv
-MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
-d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv
-ZGUgU2lnbmluZyBDQS0xMB4XDTEzMDExNzAwMDAwMFoXDTE0MDEyMjEyMDAwMFow
-gY4xCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMR4wHAYDVQQHDBVT
-w6NvIEpvc8OpIERvcyBDYW1wb3MxJDAiBgNVBAoTG0J1c3RlciBQYXBlciBDb21l
-cmNpYWwgTHRkYTEkMCIGA1UEAxMbQnVzdGVyIFBhcGVyIENvbWVyY2lhbCBMdGRh
-MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzO0l6jWIpEfO2oUpVHpL
-HETj5lzivNb0S9jKHgGJax917czh81PnGTxwxFXd6gLJuy/XFHvmiSi8g8jzlymn
-2Ji5zQ3CPaz7nomJokSUDlMVJ2qYWtctw4jrdjuI4qtn+koXXUFkWjkf8h8251I4
-tUs7S49HE2Go5owCYP3byajj7fsFAYR/Xb7TdVtndkZsUB/YgOjHovyACjouaNCi
-mDiRyQ6zLLjZGiyeD65Yiseuhp5b8/BL5h1p7w76QYMYMVQNAdtDKut2R8MBpuWf
-Ny7Eoi0x/gm1p9X5Rcl5aN7K0G4UtTAJKbkuUfXddsyFoM0Nx8uo8SgNQ8Y/X5Jx
-BwIDAQABo4IDOTCCAzUwHwYDVR0jBBgwFoAUe2jOKarAF75JeuHlP9an90WPNTIw
-HQYDVR0OBBYEFFLZ3n5nt/Eer7n1bvtOqMb1qKO5MA4GA1UdDwEB/wQEAwIHgDAT
-BgNVHSUEDDAKBggrBgEFBQcDAzBzBgNVHR8EbDBqMDOgMaAvhi1odHRwOi8vY3Js
-My5kaWdpY2VydC5jb20vYXNzdXJlZC1jcy0yMDExYS5jcmwwM6AxoC+GLWh0dHA6
-Ly9jcmw0LmRpZ2ljZXJ0LmNvbS9hc3N1cmVkLWNzLTIwMTFhLmNybDCCAcQGA1Ud
-IASCAbswggG3MIIBswYJYIZIAYb9bAMBMIIBpDA6BggrBgEFBQcCARYuaHR0cDov
-L3d3dy5kaWdpY2VydC5jb20vc3NsLWNwcy1yZXBvc2l0b3J5Lmh0bTCCAWQGCCsG
-AQUFBwICMIIBVh6CAVIAQQBuAHkAIAB1AHMAZQAgAG8AZgAgAHQAaABpAHMAIABD
-AGUAcgB0AGkAZgBpAGMAYQB0AGUAIABjAG8AbgBzAHQAaQB0AHUAdABlAHMAIABh
-AGMAYwBlAHAAdABhAG4AYwBlACAAbwBmACAAdABoAGUAIABEAGkAZwBpAEMAZQBy
-AHQAIABDAFAALwBDAFAAUwAgAGEAbgBkACAAdABoAGUAIABSAGUAbAB5AGkAbgBn
-ACAAUABhAHIAdAB5ACAAQQBnAHIAZQBlAG0AZQBuAHQAIAB3AGgAaQBjAGgAIABs
-AGkAbQBpAHQAIABsAGkAYQBiAGkAbABpAHQAeQAgAGEAbgBkACAAYQByAGUAIABp
-AG4AYwBvAHIAcABvAHIAYQB0AGUAZAAgAGgAZQByAGUAaQBuACAAYgB5ACAAcgBl
-AGYAZQByAGUAbgBjAGUALjCBggYIKwYBBQUHAQEEdjB0MCQGCCsGAQUFBzABhhho
-dHRwOi8vb2NzcC5kaWdpY2VydC5jb20wTAYIKwYBBQUHMAKGQGh0dHA6Ly9jYWNl
-cnRzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEFzc3VyZWRJRENvZGVTaWduaW5nQ0Et
-MS5jcnQwDAYDVR0TAQH/BAIwADANBgkqhkiG9w0BAQUFAAOCAQEAPTTQvpOIikXI
-hTLnNbajaFRR5GhQpTzUNgBfF9VYSlNw/wMjpGsrh5RxaJCip52jbehmTgjMRhft
-jRYyml44PAVsCcR9uEoDpCZYpI1fHI1R+F8jd1C9rqprbSwwOG4xlg4SmvTHYs6e
-gBItQ/1p9XY+Sf4Wv1qOuOFL1qvV/5VyR2zdlOQCmKCeMgxt6a/tHLBDiAA67D44
-/vfdoNJl0CU2It0PO60jdCPFNWIRcxL+OSDqAoePeUC7xQ+JsTEIxuUE8+d6w6fc
-BV2mYb1flh22t46GLjh4gyo7xw3aL6L0L0jzlTT6IcEw6NIbaPbIKj/npQnHobYj
-XMuKLxbh7g==
------END CERTIFICATE-----
-
-// Subject: CN=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME,
-//          O=BUSTER ASSISTENCIA TECNICA ELETRONICA LTDA - ME,
-//          L=S?o Paulo,
-//          ST=S?o Paulo,
-//          C=BR
-// Issuer:  CN=DigiCert Assured ID Code Signing CA-1,
-//          OU=www.digicert.com,
-//          O=DigiCert Inc,
-//          C=US
-// Serial:  0a:38:9b:95:ee:73:6d:d1:3b:c0:ed:74:3f:d7:4d:2f
------BEGIN CERTIFICATE-----
-MIIG4DCCBcigAwIBAgIQCjible5zbdE7wO10P9dNLzANBgkqhkiG9w0BAQUFADBv
-MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
-d3cuZGlnaWNlcnQuY29tMS4wLAYDVQQDEyVEaWdpQ2VydCBBc3N1cmVkIElEIENv
-ZGUgU2lnbmluZyBDQS0xMB4XDTEyMTEwOTAwMDAwMFoXDTEzMTExNDEyMDAwMFow
-gasxCzAJBgNVBAYTAkJSMRMwEQYDVQQIDApTw6NvIFBhdWxvMRMwEQYDVQQHDApT
-w6NvIFBhdWxvMTgwNgYDVQQKEy9CVVNURVIgQVNTSVNURU5DSUEgVEVDTklDQSBF
-TEVUUk9OSUNBIExUREEgLSBNRTE4MDYGA1UEAxMvQlVTVEVSIEFTU0lTVEVOQ0lB
-IFRFQ05JQ0EgRUxFVFJPTklDQSBMVERBIC0gTUUwggEiMA0GCSqGSIb3DQEBAQUA
-A4IBDwAwggEKAoIBAQDAqNeEs5/B2CTXGjTOkUIdu6jV6qulOZwdw4sefHWYj1UR
-4z6zPk9kjpUgbnb402RFq88QtfInwddZ/wXn9OxMtDd/3TnC7HrhNS7ga79ZFL2V
-JnmzKHum2Yvh0q82QEJ9tHBR2X9VdKpUIH08Zs3k6cWWM1H0YX0cxA/HohhesQJW
-kwJ3urOIJiH/HeByDk8a1NS8safcCxk5vxvW4WvCg43iT09LeHY5Aa8abKw8lqVb
-0tD5ZSIjdmdj3TT1U37iAHLLRM2DXbxfdbhouUX1c5U1ZHAMA67HwjKiseOiDaHj
-NUGbC37C+cgbc9VVM/cURD8WvS0Kj6fQv7F2QtJDAgMBAAGjggM5MIIDNTAfBgNV
-HSMEGDAWgBR7aM4pqsAXvkl64eU/1qf3RY81MjAdBgNVHQ4EFgQU88EXKAyDsh30
-o9+Gu9a4xUy+FSMwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMD
-MHMGA1UdHwRsMGowM6AxoC+GLWh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9hc3N1
-cmVkLWNzLTIwMTFhLmNybDAzoDGgL4YtaHR0cDovL2NybDQuZGlnaWNlcnQuY29t
-L2Fzc3VyZWQtY3MtMjAxMWEuY3JsMIIBxAYDVR0gBIIBuzCCAbcwggGzBglghkgB
-hv1sAwEwggGkMDoGCCsGAQUFBwIBFi5odHRwOi8vd3d3LmRpZ2ljZXJ0LmNvbS9z
-c2wtY3BzLXJlcG9zaXRvcnkuaHRtMIIBZAYIKwYBBQUHAgIwggFWHoIBUgBBAG4A
-eQAgAHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEMAZQByAHQAaQBmAGkAYwBhAHQA
-ZQAgAGMAbwBuAHMAdABpAHQAdQB0AGUAcwAgAGEAYwBjAGUAcAB0AGEAbgBjAGUA
-IABvAGYAIAB0AGgAZQAgAEQAaQBnAGkAQwBlAHIAdAAgAEMAUAAvAEMAUABTACAA
-YQBuAGQAIAB0AGgAZQAgAFIAZQBsAHkAaQBuAGcAIABQAGEAcgB0AHkAIABBAGcA
-cgBlAGUAbQBlAG4AdAAgAHcAaABpAGMAaAAgAGwAaQBtAGkAdAAgAGwAaQBhAGIA
-aQBsAGkAdAB5ACAAYQBuAGQAIABhAHIAZQAgAGkAbgBjAG8AcgBwAG8AcgBhAHQA
-ZQBkACAAaABlAHIAZQBpAG4AIABiAHkAIAByAGUAZgBlAHIAZQBuAGMAZQAuMIGC
-BggrBgEFBQcBAQR2MHQwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0
-LmNvbTBMBggrBgEFBQcwAoZAaHR0cDovL2NhY2VydHMuZGlnaWNlcnQuY29tL0Rp
-Z2lDZXJ0QXNzdXJlZElEQ29kZVNpZ25pbmdDQS0xLmNydDAMBgNVHRMBAf8EAjAA
-MA0GCSqGSIb3DQEBBQUAA4IBAQAei1QmiXepje8OIfo/WonD4MIXgpPr2dfRaquQ
-A8q63OpTRSveyqdQDCSPpDRF/nvO1Y30yksZvIH1tNBsW5LBdxAKN3lFdBlqBwtE
-Q3jHc0KVVYRJ0FBaGE/PJHmRajscdAhYIcMPhTga0u0tDK+wOHEq3993dfl6yHjA
-XHU2iW5pnk75ZoE39zALD5eKXT8ZXrET5c3XUFJKWA+XuGmdmyzqo0Au49PanBv9
-UlZnabYfqoMArqMS0tGSX4cGgi9/2E+pHG9BX4sFW+ZDumroOA2pxyMWEKjxePEL
-zCOfhbsRWdMLYepauaNZOIMZXmFwcrIl0TGMkTAtATz+XmZc
------END CERTIFICATE-----
-
-// Subject: CN=CLEARESULT CONSULTING INC., OU=Corporate IT,
-//          O=CLEARESULT CONSULTING INC., L=Austin, ST=TX, C=US
-// Issuer:  SERIALNUMBER=07969287,
-//          CN=Go Daddy Secure Certification Authority,
-//          OU=http://certificates.godaddy.com/repository,
-//          O="GoDaddy.com, Inc.",
-//          L=Scottsdale,
-//          ST=Arizona,
-//          C=US
-// Serial:  2b:73:43:2a:a8:4f:44
------BEGIN CERTIFICATE-----
-MIIFYjCCBEqgAwIBAgIHK3NDKqhPRDANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
-BhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAY
-BgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMTMwMQYDVQQLEypodHRwOi8vY2VydGlm
-aWNhdGVzLmdvZGFkZHkuY29tL3JlcG9zaXRvcnkxMDAuBgNVBAMTJ0dvIERhZGR5
-IFNlY3VyZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEBRMIMDc5Njky
-ODcwHhcNMTIwMjE1MjEwOTA2WhcNMTQwMjE1MjEwOTA2WjCBjDELMAkGA1UEBgwC
-VVMxCzAJBgNVBAgMAlRYMQ8wDQYDVQQHDAZBdXN0aW4xIzAhBgNVBAoMGkNMRUFS
-RVNVTFQgQ09OU1VMVElORyBJTkMuMRUwEwYDVQQLDAxDb3Jwb3JhdGUgSVQxIzAh
-BgNVBAMMGkNMRUFSRVNVTFQgQ09OU1VMVElORyBJTkMuMIIBIjANBgkqhkiG9w0B
-AQEFAAOCAQ8AMIIBCgKCAQEAtIOjCKeAicull+7ZIzt0/4ya3IeXUFlfypqKMLkU
-IbKjn0P5uMj6VE3rlbZr44RCegxvdnR6umBh1c0ZXoN3o+yc0JKcKcLiApmJJ277
-p7IbLwYDhBXRQNoIJm187IOMRPIxsKN4hL91txn9jGBmW+9zKlJlNhR5R7vjwU2E
-jrH/6oqsc9EM2yYpfjlNv6+3jSwAYZCkSWr+27PQOV+YHKmIxtJjX0upFz5FdIrV
-9CCX+L2Kji1THOkSgG4QTbYxmEcHqGViWz8hXLeNXjcbEsPuIiAu3hknxRHfUTE/
-U0Lh0Ug1e3LrJu+WnxM2SmUY4krsZ22c0yWUW9hzWITIjQIDAQABo4IBhzCCAYMw
-DwYDVR0TAQH/BAUwAwEBADATBgNVHSUEDDAKBggrBgEFBQcDAzAOBgNVHQ8BAf8E
-BAMCB4AwMwYDVR0fBCwwKjAooCagJIYiaHR0cDovL2NybC5nb2RhZGR5LmNvbS9n
-ZHM1LTE2LmNybDBTBgNVHSAETDBKMEgGC2CGSAGG/W0BBxcCMDkwNwYIKwYBBQUH
-AgEWK2h0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8w
-gYAGCCsGAQUFBwEBBHQwcjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZ29kYWRk
-eS5jb20vMEoGCCsGAQUFBzAChj5odHRwOi8vY2VydGlmaWNhdGVzLmdvZGFkZHku
-Y29tL3JlcG9zaXRvcnkvZ2RfaW50ZXJtZWRpYXRlLmNydDAfBgNVHSMEGDAWgBT9
-rGEyk2xF1uLuhV+auud2mWjM5zAdBgNVHQ4EFgQUDtdeKqeN2QkcbEp1HovFieNB
-XiowDQYJKoZIhvcNAQEFBQADggEBAD74Agw5tvi2aBl4/f/s7/VE/BClzDsKMb9K
-v9qpeC45ZA/jelxV11HKbQnVF194gDb7D2H9OsAsRUy8HVKbXEcc/8dKvwOqb+BC
-2i/EmfjLgmCfezNFtLq8xcPxF3zIRc44vPrK0z4YZsaHdH+yTEJ51p5EMdTqaLaP
-4n5m8LX3RfqlQB9dYFe6dUoYZjKm9d/pIRww3VqfOzjl42Edi1w6dWmBVMx1NZuR
-DBabJH1vJ9Gd+KwxMCmBZ6pQPl28JDimhJhI2LNqU349uADQVV0HJosddN/ARyyI
-LSIQO7BnNVKVG9Iujf33bvPNeg0qNz5qw+rKKq97Pqeum+L5oKU=
------END CERTIFICATE-----
--- a/jdk/src/share/lib/security/java.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/lib/security/java.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -26,15 +26,36 @@
 };
 
 grant codeBase "file:${java.home}/lib/ext/sunec.jar" {
-        permission java.security.AllPermission;
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunec";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunEC";
+        permission java.security.SecurityPermission "clearProviderProperties.SunEC";
+        permission java.security.SecurityPermission "removeProviderProperty.SunEC";
 };
 
 grant codeBase "file:${java.home}/lib/ext/sunjce_provider.jar" {
-        permission java.security.AllPermission;
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+        permission java.security.SecurityPermission "clearProviderProperties.SunJCE";
+        permission java.security.SecurityPermission "removeProviderProperty.SunJCE";
 };
 
 grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
-        permission java.security.AllPermission;
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
+        // needs "security.pkcs11.allowSingleThreadedModules"
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.*";
+        permission java.security.SecurityPermission "clearProviderProperties.*";
+        permission java.security.SecurityPermission "removeProviderProperty.*";
+        permission java.security.SecurityPermission "getProperty.auth.login.defaultCallbackHandler";
+        permission java.security.SecurityPermission "authProvider.*";
+        // Needed for reading PKCS11 config file and NSS library check
+        permission java.io.FilePermission "<<ALL FILES>>", "read";
 };
 
 // default permissions granted to all domains
--- a/jdk/src/share/lib/security/java.security-aix	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/lib/security/java.security-aix	Wed Jul 05 19:50:06 2017 +0200
@@ -206,7 +206,6 @@
                com.sun.org.glassfish.,\
                com.oracle.xmlns.internal.,\
                com.oracle.webservices.internal.,\
-               oracle.jrockit.jfr.,\
                org.jcp.xml.dsig.internal.,\
                jdk.internal.,\
                jdk.nashorn.internal.,\
@@ -253,7 +252,6 @@
                    com.sun.org.glassfish.,\
                    com.oracle.xmlns.internal.,\
                    com.oracle.webservices.internal.,\
-                   oracle.jrockit.jfr.,\
                    org.jcp.xml.dsig.internal.,\
                    jdk.internal.,\
                    jdk.nashorn.internal.,\
--- a/jdk/src/share/lib/security/java.security-linux	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/lib/security/java.security-linux	Wed Jul 05 19:50:06 2017 +0200
@@ -206,7 +206,6 @@
                com.sun.org.glassfish.,\
                com.oracle.xmlns.internal.,\
                com.oracle.webservices.internal.,\
-               oracle.jrockit.jfr.,\
                org.jcp.xml.dsig.internal.,\
                jdk.internal.,\
                jdk.nashorn.internal.,\
@@ -253,7 +252,6 @@
                    com.sun.org.glassfish.,\
                    com.oracle.xmlns.internal.,\
                    com.oracle.webservices.internal.,\
-                   oracle.jrockit.jfr.,\
                    org.jcp.xml.dsig.internal.,\
                    jdk.internal.,\
                    jdk.nashorn.internal.,\
--- a/jdk/src/share/lib/security/java.security-macosx	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/lib/security/java.security-macosx	Wed Jul 05 19:50:06 2017 +0200
@@ -207,7 +207,6 @@
                com.sun.org.glassfish.,\
                com.oracle.xmlns.internal.,\
                com.oracle.webservices.internal.,\
-               oracle.jrockit.jfr.,\
                org.jcp.xml.dsig.internal.,\
                jdk.internal.,\
                jdk.nashorn.internal.,\
@@ -254,7 +253,6 @@
                    com.sun.org.glassfish.,\
                    com.oracle.xmlns.internal.,\
                    com.oracle.webservices.internal.,\
-                   oracle.jrockit.jfr.,\
                    org.jcp.xml.dsig.internal.,\
                    jdk.internal.,\
                    jdk.nashorn.internal.,\
--- a/jdk/src/share/lib/security/java.security-solaris	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/lib/security/java.security-solaris	Wed Jul 05 19:50:06 2017 +0200
@@ -208,7 +208,6 @@
                com.sun.org.glassfish.,\
                com.oracle.xmlns.internal.,\
                com.oracle.webservices.internal.,\
-               oracle.jrockit.jfr.,\
                org.jcp.xml.dsig.internal.,\
                jdk.internal.,\
                jdk.nashorn.internal.,\
@@ -254,7 +253,6 @@
                    com.sun.org.glassfish.,\
                    com.oracle.xmlns.internal.,\
                    com.oracle.webservices.internal.,\
-                   oracle.jrockit.jfr.,\
                    org.jcp.xml.dsig.internal.,\
                    jdk.internal.,\
                    jdk.nashorn.internal.,\
--- a/jdk/src/share/lib/security/java.security-windows	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/lib/security/java.security-windows	Wed Jul 05 19:50:06 2017 +0200
@@ -207,7 +207,6 @@
                com.sun.org.glassfish.,\
                com.oracle.xmlns.internal.,\
                com.oracle.webservices.internal.,\
-               oracle.jrockit.jfr.,\
                org.jcp.xml.dsig.internal.,\
                jdk.internal.,\
                jdk.nashorn.internal.,\
@@ -254,7 +253,6 @@
                    com.sun.org.glassfish.,\
                    com.oracle.xmlns.internal.,\
                    com.oracle.webservices.internal.,\
-                   oracle.jrockit.jfr.,\
                    org.jcp.xml.dsig.internal.,\
                    jdk.internal.,\
                    jdk.nashorn.internal.,\
--- a/jdk/src/share/native/common/check_code.c	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/native/common/check_code.c	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -1357,16 +1357,9 @@
                 }
                 (*env)->DeleteLocalRef(env, super);
 
-                /* The optimizer make cause this to happen on local code */
+                /* The optimizer may cause this to happen on local code */
                 if (not_found) {
-#ifdef BROKEN_JAVAC
-                    jobject loader = JVM_GetClassLoader(env, context->class);
-                    int has_loader = (loader != 0);
-                    (*env)->DeleteLocalRef(env, loader);
-                    if (has_loader)
-#endif /* BROKEN_JAVAC */
-                        CCerror(context,
-                                "Illegal use of nonvirtual function call");
+                    CCerror(context, "Illegal use of nonvirtual function call");
                 }
             }
         }
--- a/jdk/src/share/native/java/lang/Class.c	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/native/java/lang/Class.c	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 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
@@ -45,7 +45,6 @@
 #define CLS "Ljava/lang/Class;"
 #define CPL "Lsun/reflect/ConstantPool;"
 #define STR "Ljava/lang/String;"
-#define JCL "Ljava/lang/ClassLoader;"
 #define FLD "Ljava/lang/reflect/Field;"
 #define MHD "Ljava/lang/reflect/Method;"
 #define CTR "Ljava/lang/reflect/Constructor;"
@@ -56,7 +55,6 @@
     {"getName0",         "()" STR,          (void *)&JVM_GetClassName},
     {"getSuperclass",    "()" CLS,          NULL},
     {"getInterfaces0",   "()[" CLS,         (void *)&JVM_GetClassInterfaces},
-    {"getClassLoader0",  "()" JCL,          (void *)&JVM_GetClassLoader},
     {"isInterface",      "()Z",             (void *)&JVM_IsInterface},
     {"getSigners",       "()[" OBJ,         (void *)&JVM_GetClassSigners},
     {"setSigners",       "([" OBJ ")V",     (void *)&JVM_SetClassSigners},
@@ -81,7 +79,6 @@
 #undef OBJ
 #undef CLS
 #undef STR
-#undef JCL
 #undef FLD
 #undef MHD
 #undef CTR
--- a/jdk/src/share/native/java/lang/java_props.h	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/share/native/java/lang/java_props.h	Wed Jul 05 19:50:06 2017 +0200
@@ -117,7 +117,7 @@
 
     char *exceptionList;
 
-    char *awt_headless  /* java.awt.headless setting, if NULL (default) will not be set */
+    char *awt_headless;  /* java.awt.headless setting, if NULL (default) will not be set */
 #endif
 
 } java_props_t;
--- a/jdk/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/solaris/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java	Wed Jul 05 19:50:06 2017 +0200
@@ -77,8 +77,7 @@
 
     static {
         defaultDomain = java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("http.auth.ntlm.domain",
-                                                      "domain"));
+            new sun.security.action.GetPropertyAction("http.auth.ntlm.domain", ""));
     };
 
     public static boolean supportsTransparentAuth () {
@@ -100,17 +99,13 @@
             public String run() {
                 String localhost;
                 try {
-                    localhost = InetAddress.getLocalHost().getHostName().toUpperCase();
+                    localhost = InetAddress.getLocalHost().getHostName();
                 } catch (UnknownHostException e) {
                      localhost = "localhost";
                 }
                 return localhost;
             }
         });
-        int x = hostname.indexOf ('.');
-        if (x != -1) {
-            hostname = hostname.substring (0, x);
-        }
     };
 
     PasswordAuthentication pw;
--- a/jdk/src/solaris/native/java/lang/locale_str.h	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/solaris/native/java/lang/locale_str.h	Wed Jul 05 19:50:06 2017 +0200
@@ -135,7 +135,7 @@
     "sr_SP", "sr_YU",
     "tchinese", "zh_TW",
 #endif
-    ""
+    "", "",
  };
 
 /*
@@ -188,7 +188,7 @@
     "japanese", "ja",
     "korean", "ko",
 #endif
-    "",
+    "", "",
 };
 
 /*
@@ -201,7 +201,7 @@
     "iqtelif", "Latn",
     "latin", "Latn",
 #endif
-    "",
+    "", "",
 };
 
 /*
@@ -212,7 +212,7 @@
     "RN", "US", // used on Linux, not clear what it stands for
 #endif
     "YU", "CS", // YU has been removed from ISO 3166
-    "",
+    "", "",
 };
 
 /*
@@ -220,5 +220,5 @@
  */
 static char *variant_names[] = {
     "nynorsk", "NY",
-    "",
+    "", "",
 };
--- a/jdk/src/windows/lib/security/java.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/windows/lib/security/java.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,3 +1,8 @@
 grant codeBase "file:${java.home}/lib/ext/sunmscapi.jar" {
-        permission java.security.AllPermission;
+        Permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunmscapi";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunMSCAPI";
+        permission java.security.SecurityPermission "clearProviderProperties.SunMSCAPI";
+        permission java.security.SecurityPermission "removeProviderProperty.SunMSCAPI";
 };
--- a/jdk/src/windows/native/java/net/net_util_md.c	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/windows/native/java/net/net_util_md.c	Wed Jul 05 19:50:06 2017 +0200
@@ -443,6 +443,13 @@
 {
     int rv;
 
+    if (level == IPPROTO_IPV6 && optname == IPV6_TCLASS) {
+        int *intopt = (int *)optval;
+        *intopt = 0;
+        *optlen = sizeof(*intopt);
+        return 0;
+    }
+
     rv = getsockopt(s, level, optname, optval, optlen);
 
 
--- a/jdk/src/windows/native/sun/nio/ch/Net.c	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/src/windows/native/sun/nio/ch/Net.c	Wed Jul 05 19:50:06 2017 +0200
@@ -295,9 +295,9 @@
     /**
      * HACK: IP_TOS is deprecated on Windows and querying the option
      * returns a protocol error. NET_GetSockOpt handles this and uses
-     * a fallback mechanism.
+     * a fallback mechanism. Same applies to IPV6_TCLASS
      */
-    if (level == IPPROTO_IP && opt == IP_TOS) {
+    if ((level == IPPROTO_IP && opt == IP_TOS) || (level == IPPROTO_IPV6 && opt == IPV6_TCLASS)) {
         mayNeedConversion = JNI_TRUE;
     }
 
@@ -340,6 +340,11 @@
         arglen = sizeof(arg);
     }
 
+    if (level == IPPROTO_IPV6 && opt == IPV6_TCLASS) {
+        /* No op */
+        return;
+    }
+
     if (mayNeedConversion) {
         n = NET_SetSockOpt(fdval(env, fdo), level, opt, parg, arglen);
     } else {
--- a/jdk/test/TEST.groups	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/TEST.groups	Wed Jul 05 19:50:06 2017 +0200
@@ -362,7 +362,8 @@
   sun/reflect/CallerSensitive/CallerSensitiveFinder.java \
   sun/reflect/CallerSensitive/MissingCallerSensitive.java \
   sun/security/util/Resources/NewNamesFormat.java \
-  vm/verifier/defaultMethods/DefaultMethodRegressionTestsRun.java
+  vm/verifier/defaultMethods/DefaultMethodRegressionTestsRun.java \
+  javax/xml/ws/clientjar/TestWsImport.java 
 
 # JRE adds further tests to compact3
 #
@@ -388,6 +389,7 @@
   java/security/Security/ClassLoaderDeadlock/Deadlock.sh \
   java/util/jar/Manifest/CreateManifest.java \
   java/util/logging/TestMainAppContext.java \
+  java/util/logging/TestLoggingWithMainAppContext.java \
   java/util/ResourceBundle/Control/Bug6530694.java \
   java/text/Bidi/BidiConformance.java \
   java/text/Bidi/BidiEmbeddingTest.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBESealedObject.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.PrintStream;
+import java.security.AlgorithmParameters;
+import java.security.InvalidKeyException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.Arrays;
+import java.util.Random;
+import java.util.StringTokenizer;
+import javax.crypto.Cipher;
+import javax.crypto.SealedObject;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.PBEParameterSpec;
+
+/**
+ * @test
+ * @bug 8041781
+ * @summary test if seal/unseal works correctly with PBE algorithms
+ * @author Yun Ke
+ * @author Bill Situ
+ * @author Alexander Fomin
+ * @run main PBESealedObject
+ */
+public class PBESealedObject {
+
+    private static final String[] PBEAlgorithms = {
+        "pbeWithMD5ANDdes",
+        "PBEWithMD5AndDES/CBC/PKCS5Padding",
+        "PBEWithMD5AndTripleDES",
+        "PBEWithMD5AndTripleDES/CBC/PKCS5Padding",
+        "PBEwithSHA1AndDESede",
+        "PBEwithSHA1AndDESede/CBC/PKCS5Padding",
+        "PBEwithSHA1AndRC2_40",
+        "PBEwithSHA1Andrc2_40/CBC/PKCS5Padding",
+        "PBEWithSHA1AndRC2_128",
+        "PBEWithSHA1andRC2_128/CBC/PKCS5Padding",
+        "PBEWithSHA1AndRC4_40",
+        "PBEWithsha1AndRC4_40/ECB/NoPadding",
+        "PBEWithSHA1AndRC4_128",
+        "pbeWithSHA1AndRC4_128/ECB/NoPadding",
+        "PBEWithHmacSHA1AndAES_128",
+        "PBEWithHmacSHA224AndAES_128",
+        "PBEWithHmacSHA256AndAES_128",
+        "PBEWithHmacSHA384AndAES_128",
+        "PBEWithHmacSHA512AndAES_128",
+        "PBEWithHmacSHA1AndAES_256",
+        "PBEWithHmacSHA224AndAES_256",
+        "PBEWithHmacSHA256AndAES_256",
+        "PBEWithHmacSHA384AndAES_256",
+        "PBEWithHmacSHA512AndAES_256"
+    };
+
+    public static void main(String[] args) {
+        PBESealedObject test = new PBESealedObject();
+        Provider sunjce = Security.getProvider("SunJCE");
+
+        if (!test.runAll(sunjce, System.out)) {
+            throw new RuntimeException("One or more tests have failed....");
+        }
+    }
+
+    public boolean runAll(Provider p, PrintStream out) {
+        boolean finalResult = true;
+
+        for (String algorithm : PBEAlgorithms) {
+            out.println("Running test with " + algorithm + ":");
+            try {
+                if (!runTest(p, algorithm, out)) {
+                    finalResult = false;
+                    out.println("STATUS: Failed");
+                } else {
+                    out.println("STATUS: Passed");
+                }
+            } catch (Exception ex) {
+                finalResult = false;
+                ex.printStackTrace(out);
+                out.println("STATUS:Failed");
+            }
+        }
+
+        return finalResult;
+    }
+
+    // Have a generic throws Exception as it can throw many different exceptions
+    public boolean runTest(Provider p, String algo, PrintStream out)
+            throws Exception {
+
+        byte[] salt = new byte[8];
+        int ITERATION_COUNT = 1000;
+        AlgorithmParameters pbeParams = null;
+
+        String baseAlgo
+                = new StringTokenizer(algo, "/").nextToken().toUpperCase();
+        boolean isAES = baseAlgo.contains("AES");
+
+        try {
+            // Initialization
+            Cipher ci = Cipher.getInstance(algo, p);
+            new Random().nextBytes(salt);
+            AlgorithmParameterSpec aps = new PBEParameterSpec(salt,
+                    ITERATION_COUNT);
+            SecretKeyFactory skf = SecretKeyFactory.getInstance(baseAlgo, p);
+            SecretKey key = skf.generateSecret(
+                    new PBEKeySpec("Secret Lover".toCharArray()));
+
+            // Seal
+            if (isAES) {
+                ci.init(Cipher.ENCRYPT_MODE, key);
+                pbeParams = ci.getParameters();
+            } else {
+                ci.init(Cipher.ENCRYPT_MODE, key, aps);
+            }
+
+            SealedObject so = new SealedObject(key, ci);
+
+            // Unseal and compare
+            if (isAES) {
+                ci.init(Cipher.DECRYPT_MODE, key, pbeParams);
+            } else {
+                ci.init(Cipher.DECRYPT_MODE, key, aps);
+            }
+
+            SecretKey unsealedKey;
+
+            unsealedKey = (SecretKey) so.getObject(ci);
+            if (!Arrays.equals(unsealedKey.getEncoded(), key.getEncoded())) {
+                return false;
+            }
+
+            unsealedKey = (SecretKey) so.getObject(key);
+            if (!Arrays.equals(unsealedKey.getEncoded(), key.getEncoded())) {
+                return false;
+            }
+
+            unsealedKey = (SecretKey) so.getObject(key, "SunJCE");
+            return Arrays.equals(unsealedKey.getEncoded(), key.getEncoded());
+        } catch (InvalidKeyException ex) {
+            if (baseAlgo.endsWith("TRIPLEDES") || baseAlgo.endsWith("AES_256")) {
+                out.println(
+                        "Expected exception , keyStrength > 128 within" + algo);
+                return true;
+            }
+
+            throw ex;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/PBKDF2Translate.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+import java.util.Arrays;
+import java.util.Random;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.interfaces.PBEKey;
+import javax.crypto.spec.PBEKeySpec;
+
+/**
+ * @test
+ * @bug 8041781
+ * @summary Verify if the SecretKeyFactory.translateKey() method works
+ * @author Alexander Fomin
+ * @run main PBKDF2Translate
+ */
+public class PBKDF2Translate {
+
+    private static final String[] ALGO_TO_TEST = {
+        "PBKDF2WithHmacSHA1",
+        "PBKDF2WithHmacSHA224",
+        "PBKDF2WithHmacSHA256",
+        "PBKDF2WithHmacSHA384",
+        "PBKDF2WithHmacSHA512"
+    };
+
+    private static final String PASS_PHRASE = "some hidden string";
+    private static final int ITERATION_COUNT = 1000;
+    private static final int KEY_SIZE = 128;
+
+    private final String algoToTest;
+    private final byte[] salt = new byte[8];
+
+    public static void main(String[] args) throws Exception {
+
+        boolean failed = false;
+
+        for (String algo : ALGO_TO_TEST) {
+
+            System.out.println("Testing " + algo + ":");
+            PBKDF2Translate theTest = new PBKDF2Translate(algo);
+
+            try {
+                if (!theTest.testMyOwnSecretKey()
+                        || !theTest.generateAndTranslateKey()
+                        || !theTest.translateSpoiledKey()) {
+                    // we don't want to set failed to false
+                    failed = true;
+                }
+            } catch (InvalidKeyException | NoSuchAlgorithmException |
+                    InvalidKeySpecException e) {
+                e.printStackTrace(System.err);
+                failed = true;
+            }
+        }
+
+        if (failed) {
+            throw new RuntimeException("One or more tests failed....");
+        }
+    }
+
+    public PBKDF2Translate(String algoToTest) {
+        this.algoToTest = algoToTest;
+        new Random().nextBytes(this.salt);
+    }
+
+    /**
+     * The test case scenario implemented in the method: - derive PBKDF2 key
+     * using the given algorithm; - translate the key - check if the translated
+     * and original keys have the same key value.
+     *
+     * @return true if the test case passed; false - otherwise.
+     * @throws NoSuchAlgorithmException
+     * @throws InvalidKeySpecException
+     * @throws InvalidKeyException
+     */
+    public boolean generateAndTranslateKey() throws NoSuchAlgorithmException,
+            InvalidKeySpecException, InvalidKeyException {
+        // derive PBKDF2 key
+        SecretKey key1 = getSecretKeyForPBKDF2(algoToTest);
+
+        // translate key
+        SecretKeyFactory skf = SecretKeyFactory.getInstance(algoToTest);
+        SecretKey key2 = skf.translateKey(key1);
+
+        // check if it still the same after translation
+        if (!Arrays.equals(key1.getEncoded(), key2.getEncoded())) {
+            System.err.println("generateAndTranslateKey test case failed: the "
+                    + "key1 and key2 values in its primary encoding format are "
+                    + "not the same for " + algoToTest + "algorithm.");
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * The test case scenario implemented in the method: - derive Key1 for the
+     * given PBKDF2 algorithm - create my own secret Key2 as an instance of a
+     * class implements PBEKey - translate Key2 - check if the key value of the
+     * translated key and Key1 are the same.
+     *
+     * @return true if the test case passed; false - otherwise.
+     * @throws NoSuchAlgorithmException
+     * @throws InvalidKeySpecException
+     * @throws InvalidKeyException
+     */
+    public boolean testMyOwnSecretKey()
+            throws NoSuchAlgorithmException, InvalidKeySpecException,
+            InvalidKeyException {
+        SecretKey key1 = getSecretKeyForPBKDF2(algoToTest);
+        SecretKey key2 = getMyOwnSecretKey();
+
+        // Is it actually the same?
+        if (!Arrays.equals(key1.getEncoded(), key2.getEncoded())) {
+            System.err.println("We shouldn't be here. The key1 and key2 values "
+                    + "in its primary encoding format have to be the same!");
+            return false;
+        }
+
+        // Translate key
+        SecretKeyFactory skf = SecretKeyFactory.getInstance(algoToTest);
+        SecretKey key3 = skf.translateKey(key2);
+
+        // Check if it still the same after translation
+        if (!Arrays.equals(key1.getEncoded(), key3.getEncoded())) {
+            System.err.println("testMyOwnSecretKey test case failed: the key1 "
+                    + "and key3 values in its primary encoding format are not "
+                    + "the same for " + algoToTest + "algorithm.");
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * The test case scenario implemented in the method: - create my own secret
+     * Key2 as an instance of a class implements PBEKey - spoil the key (set
+     * iteration count to 0, for example) - try to translate key -
+     * InvalidKeyException is expected.
+     *
+     * @return true if InvalidKeyException occurred; false - otherwise.
+     * @throws NoSuchAlgorithmException
+     * @throws InvalidKeySpecException
+     */
+    public boolean translateSpoiledKey() throws NoSuchAlgorithmException,
+            InvalidKeySpecException {
+        // derive the key
+        SecretKey key1 = getMyOwnSecretKey();
+
+        // spoil the key
+        ((MyPBKDF2SecretKey) key1).spoil();
+
+        // translate key
+        SecretKeyFactory skf = SecretKeyFactory.getInstance(algoToTest);
+        try {
+            SecretKey key2 = skf.translateKey(key1);
+        } catch (InvalidKeyException ike) {
+            // this is expected
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Generate a PBKDF2 secret key using given algorithm.
+     *
+     * @param algoToDeriveKey PBKDF2 algorithm
+     * @return PBKDF2 secret key
+     * @throws NoSuchAlgorithmException
+     * @throws InvalidKeySpecException
+     */
+    private SecretKey getSecretKeyForPBKDF2(String algoToDeriveKey)
+            throws NoSuchAlgorithmException, InvalidKeySpecException {
+        SecretKeyFactory skf = SecretKeyFactory.getInstance(algoToDeriveKey);
+
+        PBEKeySpec spec = new PBEKeySpec(PASS_PHRASE.toCharArray(),
+                this.salt, ITERATION_COUNT, KEY_SIZE);
+
+        return skf.generateSecret(spec);
+    }
+
+    /**
+     * Generate a secrete key as an instance of a class implements PBEKey.
+     *
+     * @return secrete key
+     * @throws InvalidKeySpecException
+     * @throws NoSuchAlgorithmException
+     */
+    private SecretKey getMyOwnSecretKey() throws InvalidKeySpecException,
+            NoSuchAlgorithmException {
+        return new MyPBKDF2SecretKey(PASS_PHRASE, this.algoToTest, this.salt,
+                ITERATION_COUNT, KEY_SIZE);
+    }
+}
+
+/**
+ * An utility class to check the SecretKeyFactory.translateKey() method.
+ */
+class MyPBKDF2SecretKey implements PBEKey {
+
+    private final byte[] key;
+    private final byte[] salt;
+    private final String algorithm;
+    private final int keySize, keyLength;
+    private int itereationCount;
+    private final String pass;
+
+    @Override
+    public String getAlgorithm() {
+        return algorithm;
+    }
+
+    @Override
+    public String getFormat() {
+        return "RAW";
+    }
+
+    @Override
+    public byte[] getEncoded() {
+        byte[] copy = new byte[keyLength];
+        System.arraycopy(this.key, 0, copy, 0, keyLength);
+        return copy;
+    }
+
+    /**
+     * The key is generating by SecretKeyFactory and its value just copying in
+     * the key field of MySecretKey class. So, this is real key derived using
+     * the given algorithm.
+     *
+     * @param passPhrase some string intended to be a password
+     * @param algo PBKDF2 algorithm
+     * @param salt slat for PBKDF2
+     * @param iterationCount iteration count
+     * @param keySize key size in bits
+     * @throws InvalidKeySpecException
+     * @throws NoSuchAlgorithmException
+     */
+    public MyPBKDF2SecretKey(String passPhrase, String algo, byte[] salt,
+            int iterationCount, int keySize)
+            throws InvalidKeySpecException, NoSuchAlgorithmException {
+        this.algorithm = algo;
+        this.salt = salt;
+        this.itereationCount = iterationCount;
+        this.keySize = keySize;
+        this.pass = passPhrase;
+
+        PBEKeySpec spec = new PBEKeySpec(passPhrase.toCharArray(),
+                this.salt, iterationCount, this.keySize);
+
+        SecretKeyFactory keyFactory
+                = SecretKeyFactory.getInstance(algo);
+
+        SecretKey realKey = keyFactory.generateSecret(spec);
+
+        this.keyLength = realKey.getEncoded().length;
+
+        this.key = new byte[this.keyLength];
+        System.arraycopy(realKey.getEncoded(), 0, this.key, 0,
+                this.keyLength);
+    }
+
+    @Override
+    public int getIterationCount() {
+        return itereationCount;
+    }
+
+    @Override
+    public byte[] getSalt() {
+        return salt;
+    }
+
+    @Override
+    public char[] getPassword() {
+        return this.pass.toCharArray();
+    }
+
+    /**
+     * Spoil the generated key (before translation) to cause an
+     * InvalidKeyException
+     */
+    public void spoil() {
+        this.itereationCount = -1;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/crypto/provider/Cipher/PBE/TestCipherKeyWrapperPBEKey.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.PrintStream;
+import java.security.AlgorithmParameters;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.Provider;
+import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
+import java.util.Arrays;
+import java.util.Random;
+import java.util.StringTokenizer;
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+import javax.crypto.SecretKeyFactory;
+import javax.crypto.spec.PBEKeySpec;
+import javax.crypto.spec.PBEParameterSpec;
+
+/**
+ * @test
+ * @bug 8041781
+ * @summary Test to see if key wrapper works correctly with PBEKey
+ * @author Yu-Ching (Valerie) PENG
+ * @author Bill Situ
+ * @author Yun Ke
+ * @run main TestCipherKeyWrapperPBEKey
+ */
+public class TestCipherKeyWrapperPBEKey {
+
+    private static final String[] PBEAlgorithms = {
+        "pbeWithMD5ANDdes",
+        "PBEWithMD5AndDES/CBC/PKCS5Padding",
+        "PBEWithMD5AndTripleDES",
+        "PBEWithMD5AndTripleDES/CBC/PKCS5Padding",
+        "PBEwithSHA1AndDESede",
+        "PBEwithSHA1AndDESede/CBC/PKCS5Padding",
+        "PBEwithSHA1AndRC2_40",
+        "PBEwithSHA1Andrc2_40/CBC/PKCS5Padding",
+        "PBEWithSHA1AndRC2_128",
+        "PBEWithSHA1andRC2_128/CBC/PKCS5Padding",
+        "PBEWithSHA1AndRC4_40",
+        "PBEWithsha1AndRC4_40/ECB/NoPadding",
+        "PBEWithSHA1AndRC4_128",
+        "pbeWithSHA1AndRC4_128/ECB/NoPadding",
+        "PBEWithHmacSHA1AndAES_128",
+        "PBEWithHmacSHA224AndAES_128",
+        "PBEWithHmacSHA256AndAES_128",
+        "PBEWithHmacSHA384AndAES_128",
+        "PBEWithHmacSHA512AndAES_128",
+        "PBEWithHmacSHA1AndAES_256",
+        "PBEWithHmacSHA224AndAES_256",
+        "PBEWithHmacSHA256AndAES_256",
+        "PBEWithHmacSHA384AndAES_256",
+        "PBEWithHmacSHA512AndAES_256"
+    };
+
+    public static void main(String[] args) {
+
+        TestCipherKeyWrapperPBEKey test = new TestCipherKeyWrapperPBEKey();
+        Provider sunjce = Security.getProvider("SunJCE");
+
+        if (!test.runAll(sunjce, System.out)) {
+            throw new RuntimeException("One or more tests have failed....");
+        }
+    }
+
+    public boolean runAll(Provider p, PrintStream out) {
+        boolean finalResult = true;
+
+        for (String algorithm : PBEAlgorithms) {
+            out.println("Running test with " + algorithm + ":");
+            try {
+                if (!runTest(p, algorithm, out)) {
+                    finalResult = false;
+                    out.println("STATUS: Failed");
+                } else {
+                    out.println("STATUS: Passed");
+                }
+            } catch (Exception ex) {
+                finalResult = false;
+                ex.printStackTrace(out);
+                out.println("STATUS:Failed");
+            }
+        }
+
+        return finalResult;
+    }
+
+    // Have a generic throws Exception as it can throw many different exceptions
+    public boolean runTest(Provider p, String algo, PrintStream out)
+            throws Exception {
+
+        byte[] salt = new byte[8];
+        int ITERATION_COUNT = 1000;
+        AlgorithmParameters pbeParams = null;
+
+        String baseAlgo
+                = new StringTokenizer(algo, "/").nextToken().toUpperCase();
+        boolean isAES = baseAlgo.contains("AES");
+
+        try {
+            // Initialization
+            new Random().nextBytes(salt);
+            AlgorithmParameterSpec aps = new PBEParameterSpec(salt,
+                    ITERATION_COUNT);
+            SecretKeyFactory skf = SecretKeyFactory.getInstance(baseAlgo, p);
+            SecretKey key = skf.generateSecret(new PBEKeySpec(
+                    "Secret Key".toCharArray()));
+            Cipher ci = Cipher.getInstance(algo);
+
+            if (isAES) {
+                ci.init(Cipher.WRAP_MODE, key);
+                pbeParams = ci.getParameters();
+            } else {
+                ci.init(Cipher.WRAP_MODE, key, aps);
+            }
+
+            byte[] keyWrapper = ci.wrap(key);
+            if (isAES) {
+                ci.init(Cipher.UNWRAP_MODE, key, pbeParams);
+            } else {
+                ci.init(Cipher.UNWRAP_MODE, key, aps);
+            }
+
+            Key unwrappedKey = ci.unwrap(keyWrapper, algo, Cipher.SECRET_KEY);
+
+            if (baseAlgo.endsWith("TRIPLEDES")
+                    || baseAlgo.endsWith("AES_256")) {
+                out.print(
+                        "InvalidKeyException not thrown when keyStrength > 128");
+                return false;
+            }
+
+            return (Arrays.equals(key.getEncoded(), unwrappedKey.getEncoded()));
+
+        } catch (InvalidKeyException ex) {
+
+            if ((baseAlgo.endsWith("TRIPLEDES")
+                    || baseAlgo.endsWith("AES_256"))) {
+                out.println("Expected InvalidKeyException, keyStrength > 128");
+                return true;
+            } else {
+                throw ex;
+            }
+        }
+    }
+}
--- a/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,10 +23,13 @@
 
 /**
  * @test
+ * @run main/othervm LdapTimeoutTest
  * @bug 7094377 8000487 6176036 7056489
  * @summary Timeout tests for ldap
  */
 
+import com.sun.jndi.ldap.Connection;
+
 import java.net.Socket;
 import java.net.ServerSocket;
 import java.net.SocketTimeoutException;
@@ -38,7 +41,9 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.concurrent.TimeUnit.NANOSECONDS;
 
 public class LdapTimeoutTest {
     private static final ScheduledExecutorService pool =
@@ -85,7 +90,7 @@
     void ldapReadTimeoutTest(Hashtable env, boolean ssl) {
         InitialContext ctx = null;
         if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl");
-        ScheduledFuture killer = killSwitch(5000);
+        ScheduledFuture killer = killSwitch(5_000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -113,7 +118,7 @@
 
     void simpleAuthConnectTest(Hashtable env) {
         InitialContext ctx = null;
-        ScheduledFuture killer = killSwitch(5000);
+        ScheduledFuture killer = killSwitch(5_000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -123,7 +128,7 @@
         } catch (NamingException e) {
             long end = System.nanoTime();
             if (e.getCause() instanceof SocketTimeoutException) {
-                if (TimeUnit.NANOSECONDS.toMillis(end - start) < 2900) {
+                if (NANOSECONDS.toMillis(end - start) < 2_900) {
                     pass();
                 } else {
                     System.err.println("Fail: Waited too long");
@@ -142,8 +147,8 @@
 
     void deadServerNoTimeout(Hashtable env) {
         InitialContext ctx = null;
-        ScheduledFuture killer = killSwitch(30000);
-        long start = System.nanoTime();
+        ScheduledFuture killer = killSwitch(30_000);
+        long start = System.currentTimeMillis();
         try {
             ctx = new InitialDirContext(env);
             SearchControls scl = new SearchControls();
@@ -153,10 +158,12 @@
             // shouldn't reach here
             fail();
         } catch (NamingException e) {
-            long end = System.nanoTime();
-            if (TimeUnit.NANOSECONDS.toMillis(end - start) < 14000) {
-                System.err.println("fail: timeout should be at least 15 seconds, actual time: "
-                                   + TimeUnit.NANOSECONDS.toMillis(end - start));
+            long elapsed = System.currentTimeMillis() - start;
+            if (elapsed < Connection.DEFAULT_READ_TIMEOUT_MILLIS) {
+                System.err.printf("fail: timeout should be at least %s ms, " +
+                                "actual time is %s ms%n",
+                        Connection.DEFAULT_READ_TIMEOUT_MILLIS, elapsed);
+                e.printStackTrace();
                 fail();
             } else {
                 pass();
@@ -184,7 +191,7 @@
                 System.exit(0);
                 return null;
             }
-        }, ms, TimeUnit.MILLISECONDS);
+        }, ms, MILLISECONDS);
     }
 
     static class Server extends Thread {
--- a/jdk/test/com/sun/security/sasl/ntlm/NTLMTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/com/sun/security/sasl/ntlm/NTLMTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6911951
+ * @bug 6911951 7150092
  * @summary NTLM should be a supported Java SASL mechanism
  */
 import java.io.IOException;
@@ -59,7 +59,6 @@
 
         checkAuthOnly();
         checkClientNameOverride();
-        checkServerDomainOverride();
         checkClientDomainOverride();
         checkVersions();
         checkClientHostname();
@@ -116,15 +115,12 @@
         Map<String,Object> ps = new HashMap<>();
         ps.put("com.sun.security.sasl.ntlm.version", vs);
         SaslClient clnt = Sasl.createSaslClient(
-                new String[]{MECH}, USER1, PROTOCOL, null, pc,
+                new String[]{MECH}, USER1, PROTOCOL, REALM, pc,
                 new CallbackHandler() {
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
                         for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
-                                ncb.setName(ncb.getDefaultName());
-                            } else if (cb instanceof PasswordCallback) {
+                            if (cb instanceof PasswordCallback) {
                                 ((PasswordCallback)cb).setPassword(PASS1);
                             }
                         }
@@ -159,15 +155,12 @@
         Map<String,Object> pc = new HashMap<>();
         pc.put("com.sun.security.sasl.ntlm.hostname", "this.is.com");
         SaslClient clnt = Sasl.createSaslClient(
-                new String[]{MECH}, USER1, PROTOCOL, null, pc,
+                new String[]{MECH}, USER1, PROTOCOL, REALM, pc,
                 new CallbackHandler() {
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
                         for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
-                                ncb.setName(ncb.getDefaultName());
-                            } else if (cb instanceof PasswordCallback) {
+                            if (cb instanceof PasswordCallback) {
                                 ((PasswordCallback)cb).setPassword(PASS1);
                             }
                         }
@@ -212,12 +205,8 @@
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
                         for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
-                                ncb.setName(ncb.getDefaultName());
-                            } else if(cb instanceof RealmCallback) {
-                                RealmCallback dcb = (RealmCallback)cb;
-                                dcb.setText("THIRDDOMAIN");
+                            if (cb instanceof RealmCallback) {
+                                ((RealmCallback)cb).setText(REALM);
                             } else if (cb instanceof PasswordCallback) {
                                 ((PasswordCallback)cb).setPassword(PASS1);
                             }
@@ -255,13 +244,13 @@
      */
     private static void checkClientNameOverride() throws Exception {
         SaslClient clnt = Sasl.createSaslClient(
-                new String[]{MECH}, null, PROTOCOL, null, null,
+                new String[]{MECH}, "someone", PROTOCOL, REALM, null,
                 new CallbackHandler() {
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
                         for (Callback cb: callbacks) {
                             if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
+                                NameCallback ncb = (NameCallback) cb;
                                 ncb.setName(USER1);
                             } else if (cb instanceof PasswordCallback) {
                                 ((PasswordCallback)cb).setPassword(PASS1);
@@ -270,54 +259,7 @@
                     }
                 });
 
-        SaslServer srv = Sasl.createSaslServer(MECH, PROTOCOL, REALM, null,
-                new CallbackHandler() {
-                    public void handle(Callback[] callbacks)
-                            throws IOException, UnsupportedCallbackException {
-                        String domain = null, name = null;
-                        PasswordCallback pcb = null;
-                        for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                name = ((NameCallback)cb).getDefaultName();
-                            } else if (cb instanceof RealmCallback) {
-                                domain = ((RealmCallback)cb).getDefaultText();
-                            } else if (cb instanceof PasswordCallback) {
-                                pcb = (PasswordCallback)cb;
-                            }
-                        }
-                        if (pcb != null) {
-                            pcb.setPassword(getPass(domain, name));
-                        }
-                    }
-                });
-
-        handshake(clnt, srv);
-    }
-
-    /**
-     * server side domain provided in props.
-     * @throws Exception
-     */
-    private static void checkServerDomainOverride() throws Exception {
-        SaslClient clnt = Sasl.createSaslClient(
-                new String[]{MECH}, USER1, PROTOCOL, null, null,
-                new CallbackHandler() {
-                    public void handle(Callback[] callbacks)
-                            throws IOException, UnsupportedCallbackException {
-                        for (Callback cb: callbacks) {
-                            if (cb instanceof NameCallback) {
-                                NameCallback ncb = (NameCallback)cb;
-                                ncb.setName(ncb.getDefaultName());
-                            } else if (cb instanceof PasswordCallback) {
-                                ((PasswordCallback)cb).setPassword(PASS1);
-                            }
-                        }
-                    }
-                });
-
-        Map<String,Object> ps = new HashMap<>();
-        ps.put("com.sun.security.sasl.ntlm.domain", REALM);
-        SaslServer srv = Sasl.createSaslServer(MECH, PROTOCOL, null, ps,
+        SaslServer srv = Sasl.createSaslServer(MECH, PROTOCOL, "FAKE", null,
                 new CallbackHandler() {
                     public void handle(Callback[] callbacks)
                             throws IOException, UnsupportedCallbackException {
--- a/jdk/test/java/io/Serializable/subclassGC/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/io/Serializable/subclassGC/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,3 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-	permission java.security.AllPermission;
-};
 
 grant {
 	permission java.lang.RuntimePermission "createClassLoader";
--- a/jdk/test/java/lang/Class/forName/NonJavaNames.sh	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/lang/Class/forName/NonJavaNames.sh	Wed Jul 05 19:50:06 2017 +0200
@@ -25,19 +25,17 @@
 # @bug 4952558
 # @summary Verify names that aren't legal Java names are accepted by forName.
 # @author Joseph D. Darcy
-# @compile -source 1.5 -target 1.5 NonJavaNames.java
+# @compile NonJavaNames.java
 # @run shell NonJavaNames.sh
 
 # This test uses hand-generated class files stored in the ./classes
 # directory.  After the renaming done below, those class files have
-# single character names that are legal class names under class file
-# version 49 but *not* legal Java language identifiers; e.g. "3" and
-# "+".  First, Z.java is compiled to Z.class using "-target 1.5."
-# Next, to create a test class file, the appropriate name structures
-# within the class files are updated, as is the "Hello world" string
-# the class's main method prints out.  If the definition of the
-# semantics of "-target 1.5" changes, the test class files should be
-# regenerated.
+# single character names that are legal class names under in the class
+# file but *not* legal Java language identifiers; e.g. "3" and "+".
+# First, Z.java is compiled to Z.class.  Next, to create a test class
+# file, the appropriate name structures within the class files are
+# updated, as is the "Hello world" string the class's main method
+# prints out.
 
 # Verify directory context variables are set
 if [ "${TESTJAVA}" = "" ]
--- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java	Wed Jul 05 19:50:06 2017 +0200
@@ -80,7 +80,6 @@
         "com.sun.org.glassfish.",
         "com.oracle.xmlns.internal.",
         "com.oracle.webservices.internal.",
-        "oracle.jrockit.jfr.",
         "org.jcp.xml.dsig.internal.",
         "jdk.internal.",
         "jdk.nashorn.internal.",
--- a/jdk/test/java/lang/System/System.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/lang/System/System.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,10 +1,5 @@
 //
 // Used by SecurityRace.java 
-// Standard extensions get all permissions by default
-
-grant codeBase "file:${{java.ext.dirs}}/*" {
-	permission java.security.AllPermission;
-};
 
 // default permissions granted to all domains
 
--- a/jdk/test/java/net/URLPermission/policy.1	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/net/URLPermission/policy.1	Wed Jul 05 19:50:06 2017 +0200
@@ -37,9 +37,56 @@
 };
 
 // Normal permissions that aren't granted when run under jtreg
+grant codeBase "file:${java.home}/lib/ext/ucrypto.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2ucrypto";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.OracleUcrypto";
+        permission java.security.SecurityPermission "clearProviderProperties.OracleUcrypto";
+        permission java.security.SecurityPermission "removeProviderProperty.OracleUcrypto";
+        permission java.io.FilePermission "${java.home}/lib/security/ucrypto-solaris.cfg", "read";
+};
 
-grant codeBase "file:${{java.ext.dirs}}/*" {
-        permission java.security.AllPermission;
+grant codeBase "file:${java.home}/lib/ext/sunec.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunec";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunEC";
+        permission java.security.SecurityPermission "clearProviderProperties.SunEC";
+        permission java.security.SecurityPermission "removeProviderProperty.SunEC";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunjce_provider.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+        permission java.security.SecurityPermission "clearProviderProperties.SunJCE";
+        permission java.security.SecurityPermission "removeProviderProperty.SunJCE";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.*";
+        permission java.security.SecurityPermission "clearProviderProperties.*";
+        permission java.security.SecurityPermission "removeProviderProperty.*";
+        permission java.security.SecurityPermission "getProperty.auth.login.defaultCallbackHandler";
+        permission java.security.SecurityPermission "authProvider.*";
+        // Needed for reading PKCS11 config file and NSS library check
+        permission java.io.FilePermission "<<ALL FILES>>", "read";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunmscapi.jar" {
+        Permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunmscapi";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunMSCAPI";
+        permission java.security.SecurityPermission "clearProviderProperties.SunMSCAPI";
+        permission java.security.SecurityPermission "removeProviderProperty.SunMSCAPI";
 };
 
 grant codeBase "file:${{java.home}}/jre/lib/rt.jar" {
--- a/jdk/test/java/net/URLPermission/policy.2	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/net/URLPermission/policy.2	Wed Jul 05 19:50:06 2017 +0200
@@ -36,8 +36,57 @@
     permission "java.lang.RuntimePermission" "setFactory";
 };
 
-grant codeBase "file:${{java.ext.dirs}}/*" {
-        permission java.security.AllPermission;
+// Normal permissions that aren't granted when run under jtreg
+grant codeBase "file:${java.home}/lib/ext/ucrypto.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2ucrypto";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.OracleUcrypto";
+        permission java.security.SecurityPermission "clearProviderProperties.OracleUcrypto";
+        permission java.security.SecurityPermission "removeProviderProperty.OracleUcrypto";
+        permission java.io.FilePermission "${java.home}/lib/security/ucrypto-solaris.cfg", "read";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunec.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunec";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunEC";
+        permission java.security.SecurityPermission "clearProviderProperties.SunEC";
+        permission java.security.SecurityPermission "removeProviderProperty.SunEC";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunjce_provider.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+        permission java.security.SecurityPermission "clearProviderProperties.SunJCE";
+        permission java.security.SecurityPermission "removeProviderProperty.SunJCE";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.*";
+        permission java.security.SecurityPermission "clearProviderProperties.*";
+        permission java.security.SecurityPermission "removeProviderProperty.*";
+        permission java.security.SecurityPermission "getProperty.auth.login.defaultCallbackHandler";
+        permission java.security.SecurityPermission "authProvider.*";
+        // Needed for reading PKCS11 config file and NSS library check
+        permission java.io.FilePermission "<<ALL FILES>>", "read";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunmscapi.jar" {
+        Permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunmscapi";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunMSCAPI";
+        permission java.security.SecurityPermission "clearProviderProperties.SunMSCAPI";
+        permission java.security.SecurityPermission "removeProviderProperty.SunMSCAPI";
 };
 
 grant codeBase "file:///export/repos/jdk8/build/linux-x86_64-normal-server-fastdebug/images/j2sdk-image/jre/lib/rt.jar" {
--- a/jdk/test/java/net/URLPermission/policy.3	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/net/URLPermission/policy.3	Wed Jul 05 19:50:06 2017 +0200
@@ -37,9 +37,56 @@
 };
 
 // Normal permissions that aren't granted when run under jtreg
+grant codeBase "file:${java.home}/lib/ext/ucrypto.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2ucrypto";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.OracleUcrypto";
+        permission java.security.SecurityPermission "clearProviderProperties.OracleUcrypto";
+        permission java.security.SecurityPermission "removeProviderProperty.OracleUcrypto";
+        permission java.io.FilePermission "${java.home}/lib/security/ucrypto-solaris.cfg", "read";
+};
 
-grant codeBase "file:${{java.ext.dirs}}/*" {
-        permission java.security.AllPermission;
+grant codeBase "file:${java.home}/lib/ext/sunec.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunec";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunEC";
+        permission java.security.SecurityPermission "clearProviderProperties.SunEC";
+        permission java.security.SecurityPermission "removeProviderProperty.SunEC";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunjce_provider.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+        permission java.security.SecurityPermission "clearProviderProperties.SunJCE";
+        permission java.security.SecurityPermission "removeProviderProperty.SunJCE";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.*";
+        permission java.security.SecurityPermission "clearProviderProperties.*";
+        permission java.security.SecurityPermission "removeProviderProperty.*";
+        permission java.security.SecurityPermission "getProperty.auth.login.defaultCallbackHandler";
+        permission java.security.SecurityPermission "authProvider.*";
+        // Needed for reading PKCS11 config file and NSS library check
+        permission java.io.FilePermission "<<ALL FILES>>", "read";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunmscapi.jar" {
+        Permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunmscapi";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunMSCAPI";
+        permission java.security.SecurityPermission "clearProviderProperties.SunMSCAPI";
+        permission java.security.SecurityPermission "removeProviderProperty.SunMSCAPI";
 };
 
 grant codeBase "file:${{java.home}}/jre/lib/rt.jar" {
--- a/jdk/test/java/nio/charset/spi/default-pol	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/nio/charset/spi/default-pol	Wed Jul 05 19:50:06 2017 +0200
@@ -1,9 +1,3 @@
-
-// Standard extensions get all permissions by default
-
-grant codeBase "file:${java.home}/lib/ext/*" {
-	permission java.security.AllPermission;
-};
 
 // default permissions granted to all domains
 
--- a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // test explicitly acccesses sun.rmi.server.ActivatableRef
   permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.server";
--- a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // need to move some classes out of the tests classpath; specific to this test
   permission java.io.FilePermission "${test.classes}", "read,write,delete";
--- a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // need to move some classes out of the tests classpath; specific to this test
   permission java.io.FilePermission "${test.classes}", "read,write,delete";
--- a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // Needed because of bug#: 4182104
   permission java.lang.RuntimePermission "modifyThreadGroup";
--- a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,3 @@
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
 
 grant {
   // standard activation permissions
--- a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/nestedActivate/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/nestedActivate/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/restartService/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/restartService/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/shutdownGracefully/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,3 @@
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
 
 grant {
   // standard test activation permissions
--- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/activation/CommandEnvironment/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/activation/CommandEnvironment/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // standard test activation permissions
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/dgc/VMID/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/dgc/VMID/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,11 +1,6 @@
 /*
  * security policy used by MarshalForeignStub test
  */
-
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
 
     // used by TestLibrary to determine test environment
--- a/jdk/test/java/rmi/dgc/dgcImplInsulation/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/dgc/dgcImplInsulation/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,11 +1,6 @@
 /*
  * security policy used by the test process
  */
-
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // so that synchronous DGC dirty call will succeed
   permission java.net.SocketPermission "*:1024-", "accept,connect,listen";
--- a/jdk/test/java/rmi/registry/classPathCodebase/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/registry/classPathCodebase/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // need to move some classes out of the test's classpath; specific to this test
   permission java.io.FilePermission "${test.classes}", "read,write,delete";
--- a/jdk/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMIClassLoader/delegateToContextLoader/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // test must create a context loader for the current thread.
   permission java.lang.RuntimePermission "createClassLoader";
--- a/jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMIClassLoader/downloadArrayClass/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
     permission java.util.PropertyPermission
         "java.rmi.server.codebase", "read,write";
--- a/jdk/test/java/rmi/server/RMIClassLoader/getClassLoader/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMIClassLoader/getClassLoader/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
     // permissions needed to move classes into separate codebase directories
     permission java.io.FilePermission
--- a/jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMIClassLoader/loadProxyClasses/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
 
     // permissions needed to move classes into separate codebase directories
--- a/jdk/test/java/rmi/server/RMIClassLoader/spi/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMIClassLoader/spi/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
 
     // permissions needed to move classes into separate codebase directories
--- a/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMIClassLoader/useCodebaseOnly/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
 
     // specific property access needed by this test
--- a/jdk/test/java/rmi/server/RMIClassLoader/useGetURLs/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMIClassLoader/useGetURLs/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // the test needs to move classfiles out of its classpath
   permission java.io.FilePermission "${test.classes}", "read,write,delete";
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // property specifically accessed by this test
   permission java.util.PropertyPermission "user.name", "read";
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/registry/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // used by TestLibrary to determine extra commandline properties
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/unicast/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // used by TestLibrary to determine extra commandline properties
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/server/RemoteServer/setLogPermission/java.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/RemoteServer/setLogPermission/java.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,7 +1,3 @@
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
     permission java.util.logging.LoggingPermission "control";
 };
--- a/jdk/test/java/rmi/server/clientStackTrace/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/clientStackTrace/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // test needs to export rmid and communicate with objects on arbitrary ports
   permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
--- a/jdk/test/java/rmi/server/useCustomRef/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/server/useCustomRef/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // the test uses a class in the package sun.rmi.server
   permission java.lang.RuntimePermission "accessClassInPackage.sun.rmi.registry";
--- a/jdk/test/java/rmi/transport/checkLeaseInfoLeak/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/transport/checkLeaseInfoLeak/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // used by TestLibrary to determine extra commandline properties
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/transport/dgcDeadLock/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/transport/dgcDeadLock/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by the test process
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
   // used by TestLibrary to determine extra commandline properties
   permission java.io.FilePermission "..${/}..${/}test.props", "read";
--- a/jdk/test/java/rmi/transport/httpSocket/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/rmi/transport/httpSocket/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,3 @@
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
 
 grant {
     permission java.net.SocketPermission "*:1024-", "accept,connect,listen";
--- a/jdk/test/java/security/KeyRep/Serial.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/security/KeyRep/Serial.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,10 @@
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
+grant codeBase "file:${java.home}/lib/ext/sunjce_provider.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+        permission java.security.SecurityPermission "clearProviderProperties.SunJCE";
+        permission java.security.SecurityPermission "removeProviderProperty.SunJCE";
 };
 
 grant {
--- a/jdk/test/java/security/KeyRep/SerialOld.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/security/KeyRep/SerialOld.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,53 @@
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
+grant codeBase "file:${java.home}/lib/ext/ucrypto.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2ucrypto";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.OracleUcrypto";
+        permission java.security.SecurityPermission "clearProviderProperties.OracleUcrypto";
+        permission java.security.SecurityPermission "removeProviderProperty.OracleUcrypto";
+        permission java.io.FilePermission "${java.home}/lib/security/ucrypto-solaris.cfg", "read";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunec.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunec";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunEC";
+        permission java.security.SecurityPermission "clearProviderProperties.SunEC";
+        permission java.security.SecurityPermission "removeProviderProperty.SunEC";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunjce_provider.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+        permission java.security.SecurityPermission "clearProviderProperties.SunJCE";
+        permission java.security.SecurityPermission "removeProviderProperty.SunJCE";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.*";
+        permission java.security.SecurityPermission "clearProviderProperties.*";
+        permission java.security.SecurityPermission "removeProviderProperty.*";
+        permission java.security.SecurityPermission "getProperty.auth.login.defaultCallbackHandler";
+        permission java.security.SecurityPermission "authProvider.*";
+        // Needed for reading PKCS11 config file and NSS library check
+        permission java.io.FilePermission "<<ALL FILES>>", "read";
+};
+
+grant codeBase "file:${java.home}/lib/ext/sunmscapi.jar" {
+        Permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "loadLibrary.sunmscapi";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunMSCAPI";
+        permission java.security.SecurityPermission "clearProviderProperties.SunMSCAPI";
+        permission java.security.SecurityPermission "removeProviderProperty.SunMSCAPI";
 };
 
 grant {
@@ -8,11 +56,11 @@
     permission java.util.PropertyPermission "test.src", "read";
 
     permission java.lang.RuntimePermission
-	"accessClassInPackage.sun.security.provider";
+        "accessClassInPackage.sun.security.provider";
     permission java.lang.RuntimePermission
-	"accessClassInPackage.sun.security.pkcs";
+        "accessClassInPackage.sun.security.pkcs";
     permission java.lang.RuntimePermission
-	"accessClassInPackage.sun.security.x509";
+        "accessClassInPackage.sun.security.x509";
     permission java.lang.RuntimePermission
-	"accessClassInPackage.sun.security.rsa";
+        "accessClassInPackage.sun.security.rsa";
 };
--- a/jdk/test/java/security/Policy/GetInstance/GetInstance.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/security/Policy/GetInstance/GetInstance.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,3 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-        permission java.security.AllPermission;
-};
 
 grant {
     permission java.security.SecurityPermission
--- a/jdk/test/java/security/Policy/GetInstance/GetInstance.policyURL	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/security/Policy/GetInstance/GetInstance.policyURL	Wed Jul 05 19:50:06 2017 +0200
@@ -1,7 +1,3 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-        permission java.security.AllPermission;
-};
-
 grant {
     permission java.security.SecurityPermission "GetInstanceTest";
 };
--- a/jdk/test/java/security/Policy/GetInstance/GetInstanceSecurity.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/security/Policy/GetInstance/GetInstanceSecurity.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,7 +1,3 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-	permission java.security.AllPermission;
-};
-
 grant {
     // do not grant this:
     //
--- a/jdk/test/java/security/Security/AddProvider.policy.1	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/security/Security/AddProvider.policy.1	Wed Jul 05 19:50:06 2017 +0200
@@ -1,7 +1,3 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-	permission java.security.AllPermission;
-};
-
 grant {
     permission java.security.SecurityPermission "insertProvider";
 };
--- a/jdk/test/java/security/Security/AddProvider.policy.2	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/security/Security/AddProvider.policy.2	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,3 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-	permission java.security.AllPermission;
-};
 
 grant {
     permission java.security.SecurityPermission "insertProvider.Test1";
--- a/jdk/test/java/security/Security/AddProvider.policy.3	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/security/Security/AddProvider.policy.3	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,3 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-	permission java.security.AllPermission;
-};
 
 grant {
     permission java.security.SecurityPermission "insertProvider.*";
--- a/jdk/test/java/security/Security/removing/RemoveStaticProvider.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/security/Security/removing/RemoveStaticProvider.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,10 +1,15 @@
+
+grant codeBase "file:${java.home}/lib/ext/sunjce_provider.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.SunJCE";
+        permission java.security.SecurityPermission "clearProviderProperties.SunJCE";
+        permission java.security.SecurityPermission "removeProviderProperty.SunJCE";
+};
+
 grant {
     permission java.security.SecurityPermission "removeProvider.SunJCE";
     permission java.security.SecurityPermission "insertProvider.SunJCE";
 };
 
-// Standard extensions get all permissions
-grant codeBase "file:${java.home}/lib/ext/*" {
-        permission java.security.AllPermission;
-};
-
--- a/jdk/test/java/text/Bidi/Bug7051769.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/text/Bidi/Bug7051769.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,8 +23,11 @@
 
 /*
  * @test
- * @bug 7051769
+ * @bug 7051769 8038092
  * @summary verify that Bidi.toString() returns the corect result.
+ *     The second run is intended to test lazy SharedSectets init for 8038092
+ * @run main Bug7051769
+ * @run main/othervm -DpreloadBidi=true Bug7051769
  */
 import java.awt.font.*;
 import java.text.*;
@@ -32,6 +35,18 @@
 
 public class Bug7051769 {
 
+    static {
+        if (System.getProperty("preloadBidi", "").equals("true")) {
+            // Make sure the SharedSecret is lazily initialized correctly
+            try {
+                Class.forName("sun.text.bidi.BidiBase");
+                System.out.println("BidiBase class has been pre-loaded.");
+            } catch (ClassNotFoundException e) {
+                System.out.println("BidiBase class could not be pre-loaded.");
+            }
+        }
+    }
+
     private static boolean err = false;
 
     public static void main(String[] args) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/IdentityHashMap/Capacity.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Random;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+/*
+ * @test
+ * @bug 6904367
+ * @summary IdentityHashMap reallocates storage when inserting expected
+ *          number of elements
+ * @run testng Capacity
+ */
+
+@Test
+public class Capacity {
+    static final Field tableField;
+    static final Random random = new Random();
+    static final Object[][] sizesData;
+
+    @DataProvider(name="sizes", parallel = true)
+    public Object[][] sizesToTest() { return sizesData; }
+
+    static {
+        try {
+            tableField = IdentityHashMap.class.getDeclaredField("table");
+            tableField.setAccessible(true);
+        } catch (NoSuchFieldException e) {
+            throw new LinkageError("table", e);
+        }
+
+        ArrayList<Object[]> sizes = new ArrayList<>();
+        for (int size = 0; size < 200; size++)
+            sizes.add(new Object[] { size });
+
+        // some numbers known to demonstrate bug 6904367
+        for (int size : new int[] {682, 683, 1365, 2730, 2731, 5461})
+            sizes.add(new Object[] { size });
+
+        // a few more random sizes to try
+        for (int i = 0; i != 128; i++)
+            sizes.add(new Object[] { random.nextInt(5000) });
+
+        sizesData = sizes.toArray(new Object[0][]);
+    }
+
+    static int capacity(IdentityHashMap<?,?> map) {
+        try {
+            return ((Object[]) tableField.get(map)).length / 2;
+        } catch (Throwable t) {
+            throw new LinkageError("table", t);
+        }
+    }
+
+    static void assertCapacity(IdentityHashMap<?,?> map,
+                               int expectedCapacity) {
+        assertEquals(capacity(map), expectedCapacity);
+    }
+
+    static void growUsingPut(IdentityHashMap<Object,Object> map,
+                             int elementsToAdd) {
+        for (int i = 0; i < elementsToAdd; i++)
+            map.put(new Object(), new Object());
+    }
+
+    static void growUsingPutAll(IdentityHashMap<Object,Object> map,
+                                int elementsToAdd) {
+        IdentityHashMap<Object,Object> other = new IdentityHashMap<>();
+        growUsingPut(other, elementsToAdd);
+        map.putAll(other);
+    }
+
+    static void growUsingRepeatedPutAll(IdentityHashMap<Object,Object> map,
+                                        int elementsToAdd) {
+        for (int i = 0; i < elementsToAdd; i++)
+            map.putAll(Collections.singletonMap(new Object(),
+                                                new Object()));
+    }
+
+    /**
+     * Checks that expected number of items can be inserted into
+     * the map without resizing of the internal storage
+     */
+    @Test(dataProvider = "sizes")
+    public void canInsertExpectedItemsWithoutResizing(int size)
+        throws Throwable {
+        // First try growing using put()
+        IdentityHashMap<Object,Object> m = new IdentityHashMap<>(size);
+        int initialCapacity = capacity(m);
+        growUsingPut(m, size);
+        assertCapacity(m, initialCapacity);
+
+        // Doubling from the expected size will cause exactly one
+        // resize, except near minimum capacity.
+        if (size > 1) {
+            growUsingPut(m, size);
+            assertCapacity(m, 2 * initialCapacity);
+        }
+
+        // Try again, growing with putAll()
+        m = new IdentityHashMap<>(size);
+        initialCapacity = capacity(m);
+        growUsingPutAll(m, size);
+        assertCapacity(m, initialCapacity);
+
+        // Doubling from the expected size will cause exactly one
+        // resize, except near minimum capacity.
+        if (size > 1) {
+            growUsingPutAll(m, size);
+            assertCapacity(m, 2 * initialCapacity);
+        }
+    }
+
+    /**
+     * Given the expected size, computes such a number N of items that
+     * inserting (N+1) items will trigger resizing of the internal storage
+     */
+    static int threshold(int size) throws Throwable {
+        IdentityHashMap<Object,Object> m = new IdentityHashMap<>(size);
+        int initialCapacity = capacity(m);
+        while (capacity(m) == initialCapacity)
+            growUsingPut(m, 1);
+        return m.size() - 1;
+    }
+
+    /**
+     * Checks that inserting (threshold+1) item causes resizing
+     * of the internal storage
+     */
+    @Test(dataProvider = "sizes")
+    public void passingThresholdCausesResize(int size) throws Throwable {
+        final int threshold = threshold(size);
+        IdentityHashMap<Object,Object> m = new IdentityHashMap<>(threshold);
+        int initialCapacity = capacity(m);
+
+        growUsingPut(m, threshold);
+        assertCapacity(m, initialCapacity);
+
+        growUsingPut(m, 1);
+        assertCapacity(m, 2 * initialCapacity);
+    }
+
+    /**
+     * Checks that 4 methods of requiring capacity lead to the same
+     * internal capacity, unless sized below default capacity.
+     */
+    @Test(dataProvider = "sizes")
+    public void differentGrowthPatternsResultInSameCapacity(int size)
+        throws Throwable {
+        if (size < 21)          // 21 is default maxExpectedSize
+            return;
+
+        IdentityHashMap<Object,Object> m;
+        m = new IdentityHashMap<Object,Object>(size);
+        int capacity1 = capacity(m);
+
+        m = new IdentityHashMap<>();
+        growUsingPut(m, size);
+        int capacity2 = capacity(m);
+
+        m = new IdentityHashMap<>();
+        growUsingPutAll(m, size);
+        int capacity3 = capacity(m);
+
+        m = new IdentityHashMap<>();
+        growUsingRepeatedPutAll(m, size);
+        int capacity4 = capacity(m);
+
+        if (capacity1 != capacity2 ||
+            capacity2 != capacity3 ||
+            capacity3 != capacity4)
+            throw new AssertionError("Capacities not equal: "
+                                     + capacity1 + " "
+                                     + capacity2 + " "
+                                     + capacity3 + " "
+                                     + capacity4);
+    }
+
+    public void defaultExpectedMaxSizeIs21() {
+        assertCapacity(new IdentityHashMap<Long,Long>(), 32);
+        assertCapacity(new IdentityHashMap<Long,Long>(21), 32);
+    }
+
+    public void minimumCapacityIs4() {
+        assertCapacity(new IdentityHashMap<Long,Long>(0), 4);
+        assertCapacity(new IdentityHashMap<Long,Long>(1), 4);
+        assertCapacity(new IdentityHashMap<Long,Long>(2), 4);
+        assertCapacity(new IdentityHashMap<Long,Long>(3), 8);
+    }
+
+    @Test(enabled = false)
+    /** needs too much memory to run normally */
+    public void maximumCapacityIs2ToThe29() {
+        assertCapacity(new IdentityHashMap<Long,Long>(Integer.MAX_VALUE),
+                       1 << 29);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/CheckZombieLockTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,369 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8048020
+ * @author  Daniel Fuchs
+ * @summary Regression on java.util.logging.FileHandler.
+ *     The fix is to avoid filling up the file system with zombie lock files.
+ *
+ * @run  main/othervm CheckZombieLockTest WRITABLE CLOSE CLEANUP
+ * @run  main/othervm CheckZombieLockTest CLEANUP
+ * @run  main/othervm CheckZombieLockTest WRITABLE
+ * @run  main/othervm CheckZombieLockTest CREATE_FIRST
+ * @run  main/othervm CheckZombieLockTest CREATE_NEXT
+ * @run  main/othervm CheckZombieLockTest CREATE_NEXT
+ * @run  main/othervm CheckZombieLockTest CLEANUP
+ * @run  main/othervm CheckZombieLockTest REUSE
+ * @run  main/othervm CheckZombieLockTest CLEANUP
+ */
+import java.io.File;
+import java.io.IOException;
+import java.nio.channels.FileChannel;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.logging.FileHandler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+public class CheckZombieLockTest {
+
+    private static final String WRITABLE_DIR = "writable-dir";
+    private static volatile boolean supportsLocking = true;
+
+    static enum TestCase {
+        WRITABLE,  // just verifies that we can create a file in our 'writable-dir'
+        CLOSE, // checks that closing a FileHandler removes its lock file
+        CREATE_FIRST, // verifies that 'writable-dir' contains no lock, then creates a first FileHandler.
+        CREATE_NEXT, // verifies that 'writable-dir' contains a single lock, then creates the next FileHandler
+        REUSE, // verifies that zombie lock files can be reused
+        CLEANUP // removes "writable-dir"
+    };
+
+    public static void main(String... args) throws IOException {
+        // we'll base all file creation attempts on the system temp directory,
+        // %t
+        File writableDir = setup();
+        System.out.println("Writable dir is: "+writableDir.getAbsolutePath());
+        // we now have one writable directory to work with:
+        //    writableDir
+        if (args == null || args.length == 0) {
+            args = new String[] { "WRITABLE", "CLOSE", "CLEANUP" };
+        }
+        try {
+            runTests(writableDir, args);
+        } catch (RuntimeException | IOException | Error x) {
+            // some error occured: cleanup
+            delete(writableDir);
+            throw x;
+        }
+    }
+
+    /**
+     * @param writableDir in which log and lock file are created
+     * @throws SecurityException
+     * @throws RuntimeException
+     * @throws IOException
+     */
+    private static void runTests(File writableDir, String... args) throws SecurityException,
+            RuntimeException, IOException {
+        for (String arg : args) {
+            switch(TestCase.valueOf(arg)) {
+                // Test 1: makes sure we can create FileHandler in writable directory
+                case WRITABLE: checkWritable(writableDir); break;
+                // Test 2: verifies that FileHandler.close() cleans up its lock file
+                case CLOSE: testFileHandlerClose(writableDir); break;
+                // Test 3: creates the first file handler
+                case CREATE_FIRST: testFileHandlerCreate(writableDir, true); break;
+                // Test 4, 5, ... creates the next file handler
+                case CREATE_NEXT: testFileHandlerCreate(writableDir, false); break;
+                // Checks that zombie lock files are reused appropriatly
+                case REUSE: testFileHandlerReuse(writableDir); break;
+                // Removes the writableDir
+                case CLEANUP: delete(writableDir); break;
+                default: throw new RuntimeException("No such test case: "+arg);
+            }
+        }
+    }
+
+    /**
+     * @param writableDir in which log and lock file are created
+     * @throws SecurityException
+     * @throws RuntimeException
+     * @throws IOException
+     */
+    private static void checkWritable(File writableDir) throws SecurityException,
+            RuntimeException, IOException {
+        // Test 1: make sure we can create/delete files in the writable dir.
+        final File file = new File(writableDir, "test.txt");
+        if (!createFile(file, false)) {
+            throw new IOException("Can't create "+file+"\n\tUnable to run test");
+        } else {
+            delete(file);
+        }
+    }
+
+
+    private static FileHandler createFileHandler(File writableDir) throws SecurityException,
+            RuntimeException, IOException {
+        // Test 1: make sure we can create FileHandler in writable directory
+        try {
+            FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
+            handler.publish(new LogRecord(Level.INFO, handler.toString()));
+            handler.flush();
+            return handler;
+        } catch (IOException ex) {
+            throw new RuntimeException("Test failed: should have been able"
+                    + " to create FileHandler for " + "%t/" + WRITABLE_DIR
+                    + "/log.log in writable directory.", ex);
+        }
+    }
+
+    private static List<File> listLocks(File writableDir, boolean print)
+            throws IOException {
+        List<File> locks = new ArrayList<>();
+        for (File f : writableDir.listFiles()) {
+            if (print) {
+                System.out.println("Found file: " + f.getName());
+            }
+            if (f.getName().endsWith(".lck")) {
+                locks.add(f);
+            }
+        }
+        return locks;
+    }
+
+    private static void testFileHandlerClose(File writableDir) throws IOException {
+        File fakeLock = new File(writableDir, "log.log.lck");
+        if (!createFile(fakeLock, false)) {
+            throw new IOException("Can't create fake lock file: "+fakeLock);
+        }
+        try {
+            List<File> before = listLocks(writableDir, true);
+            System.out.println("before: " +before.size() + " locks found");
+            FileHandler handler = createFileHandler(writableDir);
+            System.out.println("handler created: "+handler);
+            List<File> after = listLocks(writableDir, true);
+            System.out.println("after creating handler: " + after.size() + " locks found");
+            handler.close();
+            System.out.println("handler closed: "+handler);
+            List<File> afterClose = listLocks(writableDir, true);
+            System.out.println("after closing handler: " + afterClose.size() + " locks found");
+            afterClose.removeAll(before);
+            if (!afterClose.isEmpty()) {
+                throw new RuntimeException("Zombie lock file detected: "+ afterClose);
+            }
+        } finally {
+            if (fakeLock.canRead()) delete(fakeLock);
+        }
+        List<File> finalLocks = listLocks(writableDir, false);
+        System.out.println("After cleanup: " + finalLocks.size() + " locks found");
+    }
+
+
+    private static void testFileHandlerReuse(File writableDir) throws IOException {
+        List<File> before = listLocks(writableDir, true);
+        System.out.println("before: " +before.size() + " locks found");
+        try {
+            if (!before.isEmpty()) {
+                throw new RuntimeException("Expected no lock file! Found: "+before);
+            }
+        } finally {
+            before.stream().forEach(CheckZombieLockTest::delete);
+        }
+
+        FileHandler handler1 = createFileHandler(writableDir);
+        System.out.println("handler created: "+handler1);
+        List<File> after = listLocks(writableDir, true);
+        System.out.println("after creating handler: " + after.size() + " locks found");
+        if (after.size() != 1) {
+            throw new RuntimeException("Unexpected number of lock files found for "+handler1+": "+after);
+        }
+        final File lock = after.get(0);
+        after.clear();
+        handler1.close();
+        after = listLocks(writableDir, true);
+        System.out.println("after closing handler: " + after.size() + " locks found");
+        if (!after.isEmpty()) {
+            throw new RuntimeException("Unexpected number of lock files found for "+handler1+": "+after);
+        }
+        if (!createFile(lock, false)) {
+            throw new IOException("Can't create fake lock file: "+lock);
+        }
+        try {
+            before = listLocks(writableDir, true);
+            System.out.println("before: " +before.size() + " locks found");
+            if (before.size() != 1) {
+                throw new RuntimeException("Unexpected number of lock files found: "+before+" expected ["
+                        +lock+"].");
+            }
+            FileHandler handler2 = createFileHandler(writableDir);
+            System.out.println("handler created: "+handler2);
+            after = listLocks(writableDir, true);
+            System.out.println("after creating handler: " + after.size() + " locks found");
+            after.removeAll(before);
+            if (!after.isEmpty()) {
+                throw new RuntimeException("Unexpected lock file found: "+after
+                        + "\n\t" + lock + " should have been reused");
+            }
+            handler2.close();
+            System.out.println("handler closed: "+handler2);
+            List<File> afterClose = listLocks(writableDir, true);
+            System.out.println("after closing handler: " + afterClose.size() + " locks found");
+            if (!afterClose.isEmpty()) {
+                throw new RuntimeException("Zombie lock file detected: "+ afterClose);
+            }
+
+            if (supportsLocking) {
+                FileChannel fc = FileChannel.open(Paths.get(lock.getAbsolutePath()),
+                    StandardOpenOption.CREATE_NEW, StandardOpenOption.APPEND,
+                    StandardOpenOption.WRITE);
+                try {
+                    if (fc.tryLock() != null) {
+                        System.out.println("locked: "+lock);
+                        handler2 = createFileHandler(writableDir);
+                        System.out.println("handler created: "+handler2);
+                        after = listLocks(writableDir, true);
+                        System.out.println("after creating handler: " + after.size() + " locks found");
+                        after.removeAll(before);
+                        if (after.size() != 1) {
+                            throw new RuntimeException("Unexpected lock files found: "+after
+                                + "\n\t" + lock + " should not have been reused");
+                        }
+                    } else {
+                        throw new RuntimeException("Failed to lock: "+lock);
+                    }
+                } finally {
+                    delete(lock);
+                }
+            }
+        } finally {
+            List<File> finalLocks = listLocks(writableDir, false);
+            System.out.println("end: " + finalLocks.size() + " locks found");
+            delete(writableDir);
+        }
+    }
+
+
+    private static void testFileHandlerCreate(File writableDir, boolean first)
+            throws IOException {
+        List<File> before = listLocks(writableDir, true);
+        System.out.println("before: " +before.size() + " locks found");
+        try {
+            if (first && !before.isEmpty()) {
+                throw new RuntimeException("Expected no lock file! Found: "+before);
+            } else if (!first && before.size() != 1) {
+                throw new RuntimeException("Expected a single lock file! Found: "+before);
+            }
+        } finally {
+            before.stream().forEach(CheckZombieLockTest::delete);
+        }
+        FileHandler handler = createFileHandler(writableDir);
+        System.out.println("handler created: "+handler);
+        List<File> after = listLocks(writableDir, true);
+        System.out.println("after creating handler: " + after.size() + " locks found");
+        if (after.size() != 1) {
+            throw new RuntimeException("Unexpected number of lock files found for "+handler+": "+after);
+        }
+    }
+
+
+    /**
+     * Setup all the files and directories needed for the tests
+     *
+     * @return writable directory created that needs to be deleted when done
+     * @throws RuntimeException
+     */
+    private static File setup() throws RuntimeException {
+        // First do some setup in the temporary directory (using same logic as
+        // FileHandler for %t pattern)
+        String tmpDir = System.getProperty("java.io.tmpdir"); // i.e. %t
+        if (tmpDir == null) {
+            tmpDir = System.getProperty("user.home");
+        }
+        File tmpOrHomeDir = new File(tmpDir);
+        // Create a writable directory here (%t/writable-dir)
+        File writableDir = new File(tmpOrHomeDir, WRITABLE_DIR);
+        if (!createFile(writableDir, true)) {
+            throw new RuntimeException("Test setup failed: unable to create"
+                    + " writable working directory "
+                    + writableDir.getAbsolutePath() );
+        }
+
+        // try to determine whether file locking is supported
+        try {
+            FileChannel fc = FileChannel.open(Paths.get(writableDir.getAbsolutePath(),
+                    UUID.randomUUID().toString()+".lck"),
+                    StandardOpenOption.CREATE_NEW, StandardOpenOption.APPEND,
+                    StandardOpenOption.DELETE_ON_CLOSE);
+            try {
+                fc.tryLock();
+            } catch(IOException x) {
+                supportsLocking = false;
+            } finally {
+                fc.close();
+            }
+        } catch(Throwable t) {
+            // should not happen
+            t.printStackTrace();
+        }
+        return writableDir;
+    }
+
+    /**
+     * @param newFile
+     * @return true if file already exists or creation succeeded
+     */
+    private static boolean createFile(File newFile, boolean makeDirectory) {
+        if (newFile.exists()) {
+            return true;
+        }
+        if (makeDirectory) {
+            return newFile.mkdir();
+        } else {
+            try {
+                return newFile.createNewFile();
+            } catch (IOException ioex) {
+                ioex.printStackTrace();
+                return false;
+            }
+        }
+    }
+
+    /*
+     * Recursively delete all files starting at specified file
+     */
+    private static void delete(File f) {
+        if (f != null && f.isDirectory()) {
+            for (File c : f.listFiles())
+                delete(c);
+        }
+        if (!f.delete())
+            System.err.println(
+                    "WARNING: unable to delete/cleanup writable test directory: "
+                    + f );
+        }
+}
--- a/jdk/test/java/util/logging/LoggingDeadlock2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/java/util/logging/LoggingDeadlock2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -28,7 +28,7 @@
  * @author  Serguei Spitsyn / Hitachi / Martin Buchholz
  *
  * @build    LoggingDeadlock2
- * @run  main/timeout=15 LoggingDeadlock2
+ * @run  main LoggingDeadlock2
  *
  * There is a clear deadlock between LogManager.<clinit> and
  * Cleaner.run() methods.
--- a/jdk/test/javax/security/auth/login/Configuration/GetInstanceSecurity.grantedPolicy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/javax/security/auth/login/Configuration/GetInstanceSecurity.grantedPolicy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,7 +1,3 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-	permission java.security.AllPermission;
-};
-
 grant {
     permission java.util.PropertyPermission "test.src", "read";
     permission java.io.FilePermission "${test.src}${/}*", "read";
--- a/jdk/test/javax/security/auth/login/Configuration/GetInstanceSecurity.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/javax/security/auth/login/Configuration/GetInstanceSecurity.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,3 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-	permission java.security.AllPermission;
-};
 
 grant {
 
--- a/jdk/test/jdk/nio/zipfs/test.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/jdk/nio/zipfs/test.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -4,10 +4,6 @@
     permission java.util.PropertyPermission "*", "read";
 };
 
-grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
-    permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
-};
-
 grant {
     permission java.io.FilePermission "<<ALL FILES>>","read,write,delete";
     permission java.util.PropertyPermission "test.jdk","read";
--- a/jdk/test/lib/security/CheckBlacklistedCerts.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/lib/security/CheckBlacklistedCerts.java	Wed Jul 05 19:50:06 2017 +0200
@@ -62,9 +62,9 @@
         // a -testonly JPRT job.
         File[] blacklists = {
             new File(System.getProperty("test.src"),
-                "../../../src/share/lib/security/blacklisted.certs.pem"),
+                "../../../make/data/blacklistedcertsconverter/blacklisted.certs.pem"),
             new File(System.getProperty("test.src"),
-                "../../../src/closed/share/lib/security/blacklisted.certs.pem")
+                "../../../make/closed/data/blacklistedcertsconverter/blacklisted.certs.pem")
         };
 
         // Is this an OPENJDK build?
--- a/jdk/test/sun/net/www/http/HttpClient/IsKeepingAlive.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/net/www/http/HttpClient/IsKeepingAlive.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -5,13 +5,6 @@
 	permission java.lang.RuntimePermission "accessClassInPackage.sun.net.www.http";
 };
 
-// From system java.policy
-// Standard extensions get all permissions by default
-
-grant codeBase "file:${java.home}/lib/ext/*" {
-	permission java.security.AllPermission;
-};
-
 // default permissions granted to all domains
 
 grant { 
--- a/jdk/test/sun/net/www/http/HttpClient/OpenServer.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/net/www/http/HttpClient/OpenServer.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -5,13 +5,6 @@
 	permission java.lang.RuntimePermission "accessClassInPackage.sun.net.www.http";
 };
 
-// From system java.policy
-// Standard extensions get all permissions by default
-
-grant codeBase "file:${java.home}/lib/ext/*" {
-	permission java.security.AllPermission;
-};
-
 // default permissions granted to all domains
 
 grant { 
--- a/jdk/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/rmi/rmic/minimizeWrapperInstances/run.sh	Wed Jul 05 19:50:06 2017 +0200
@@ -45,9 +45,3 @@
 
 ${TESTJAVA}/bin/rmic -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} -vcompat PImpl
 ${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test
-
-${TESTJAVA}/bin/rmic -Xnew -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} PImpl
-${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test
-
-${TESTJAVA}/bin/rmic -Xnew -classpath ${TESTCLASSES:-.} -d ${TESTCLASSES:-.} -vcompat PImpl
-${TESTJAVA}/bin/java ${TESTVMOPTS} -classpath ${TESTCLASSES:-.} Test
--- a/jdk/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/security.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/rmi/server/MarshalOutputStream/marshalForeignStub/security.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -2,10 +2,6 @@
  * security policy used by MarshalForeignStub test
  */
 
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
-};
-
 grant {
 
     // used by TestLibrary to determine test environment
--- a/jdk/test/sun/security/krb5/auto/SaslBasic.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/security/krb5/auto/SaslBasic.java	Wed Jul 05 19:50:06 2017 +0200
@@ -29,6 +29,8 @@
  * @run main/othervm SaslBasic bound
  * @run main/othervm SaslBasic unbound
  */
+import com.sun.security.jgss.InquireType;
+
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -82,11 +84,17 @@
             }
         }
         if (!bound) {
-            String boundName = (String)ss.getNegotiatedProperty(Sasl.BOUND_SERVER_NAME);
+            String boundName = (String)ss.getNegotiatedProperty(
+                    Sasl.BOUND_SERVER_NAME);
             if (!boundName.equals(name)) {
                 throw new Exception("Wrong bound server name");
             }
         }
+        Object key = ss.getNegotiatedProperty(
+                "com.sun.security.jgss.inquiretype.krb5_get_session_key");
+        if (key == null) {
+            throw new Exception("Extended negotiated property not read");
+        }
         byte[] hello = "hello".getBytes();
         token = sc.wrap(hello, 0, hello.length);
         token = ss.unwrap(token, 0, token.length);
--- a/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/security/pkcs11/KeyStore/Basic.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,15 @@
-grant codeBase "file:${java.home}/lib/ext/*" {
-    permission java.security.AllPermission;
+grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.*";
+        permission java.security.SecurityPermission "clearProviderProperties.*";
+        permission java.security.SecurityPermission "removeProviderProperty.*";
+        permission java.security.SecurityPermission "getProperty.auth.login.defaultCallbackHandler";
+        permission java.security.SecurityPermission "authProvider.*";
+        // Needed for reading PKCS11 config file and NSS library check
+        permission java.io.FilePermission "<<ALL FILES>>", "read";
 };
 
 grant codebase "file:${user.dir}${/}loader.jar" {
--- a/jdk/test/sun/security/pkcs11/Provider/Login.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/security/pkcs11/Provider/Login.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,16 @@
-grant codeBase "file:${java.home}/lib/ext/*" {
-        permission java.security.AllPermission;
+grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
+        permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
+        permission java.util.PropertyPermission "*", "read";
+        permission java.security.SecurityPermission "putProviderProperty.*";
+        permission java.security.SecurityPermission "clearProviderProperties.*";
+        permission java.security.SecurityPermission "removeProviderProperty.*";
+        permission java.security.SecurityPermission "getProperty.auth.login.defaultCallbackHandler";
+
+        permission java.security.SecurityPermission "authProvider.*";
+        // Needed for reading PKCS11 config file and NSS library check
+        permission java.io.FilePermission "<<ALL FILES>>", "read";
 };
 
 grant {
--- a/jdk/test/sun/security/provider/PolicyFile/Alias.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/security/provider/PolicyFile/Alias.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -10,9 +10,3 @@
 	principal com.sun.security.auth.UnixPrincipal "unix" {
     permission java.security.SecurityPermission "ALIAS";
 };
-
-// Standard extensions get all permissions
-grant codeBase "file:${java.home}/lib/ext/*" {
-        permission java.security.AllPermission;
-};
-
--- a/jdk/test/sun/security/provider/PolicyFile/AliasExpansion.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/security/provider/PolicyFile/AliasExpansion.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -20,9 +20,3 @@
     permission java.security.SecurityPermission
 	"${{alias}}";
 };
-
-// Standard extensions get all permissions
-grant codeBase "file:${java.home}/lib/ext/*" {
-        permission java.security.AllPermission;
-};
-
--- a/jdk/test/sun/security/provider/PolicyFile/TrustedCert.policy	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/sun/security/provider/PolicyFile/TrustedCert.policy	Wed Jul 05 19:50:06 2017 +0200
@@ -9,8 +9,3 @@
     permission java.util.PropertyPermission "foo", "read";
 };
 
-// Standard extensions get all permissions
-grant codeBase "file:${java.home}/lib/ext/*" {
-        permission java.security.AllPermission;
-};
-
--- a/jdk/test/tools/pack200/PackageVersionTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/jdk/test/tools/pack200/PackageVersionTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -59,13 +59,10 @@
         }
 
         File out = new File("test.pack");
-        createClassFile("Test5");
         createClassFile("Test6");
         createClassFile("Test7");
 
         verify6991164();
-        verifyPack("Test5.class", JAVA5_PACKAGE_MAJOR_VERSION,
-                JAVA5_PACKAGE_MINOR_VERSION);
 
         verifyPack("Test6.class", JAVA6_PACKAGE_MAJOR_VERSION,
                 JAVA6_PACKAGE_MINOR_VERSION);
@@ -98,7 +95,7 @@
         String target = name.substring(name.length() - 1);
         String javacCmds[] = {
             "-source",
-            "5",
+            "6",
             "-target",
             name.substring(name.length() - 1),
             name + ".java"
--- a/langtools/.hgtags	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/.hgtags	Wed Jul 05 19:50:06 2017 +0200
@@ -264,3 +264,4 @@
 a9accd7c44159f191ad09740d54493e563c39f95 jdk9-b19
 31acbc476a5251824f919df0b82bca9cbb19cf7c jdk9-b20
 fa0d1059a26f82f95620b7dc8bbfbe302bce8883 jdk9-b21
+aca19c52b24627a6b085cfeb433051a3e420cd81 jdk9-b22
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -121,7 +121,7 @@
      * @param dlTree the content tree to which the description will be added
      */
     protected void addDescription(PackageDoc pkg, Content dlTree) {
-        Content link = getPackageLink(pkg, new StringContent(Util.getPackageName(pkg)));
+        Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
         Content dt = HtmlTree.DT(link);
         dt.addContent(" - ");
         dt.addContent(getResource("doclet.package"));
@@ -159,9 +159,9 @@
      */
     protected void addClassInfo(ClassDoc cd, Content contentTree) {
         contentTree.addContent(getResource("doclet.in",
-                Util.getTypeName(configuration, cd, false),
+                utils.getTypeName(configuration, cd, false),
                 getPackageLink(cd.containingPackage(),
-                    Util.getPackageName(cd.containingPackage()))
+                    utils.getPackageName(cd.containingPackage()))
                 ));
     }
 
@@ -200,7 +200,7 @@
         Content span = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.block);
-        if (Util.isDeprecated(element)) {
+        if (utils.isDeprecated(element)) {
             div.addContent(span);
             if ((tags = element.tags("deprecated")).length > 0)
                 addInlineDeprecatedComment(element, tags[0], div);
@@ -208,7 +208,7 @@
         } else {
             ClassDoc cont = element.containingClass();
             while (cont != null) {
-                if (Util.isDeprecated(cont)) {
+                if (utils.isDeprecated(cont)) {
                     div.addContent(span);
                     contentTree.addContent(div);
                     break;
@@ -228,7 +228,7 @@
      */
     protected void addMemberDesc(MemberDoc member, Content contentTree) {
         ClassDoc containing = member.containingClass();
-        String classdesc = Util.getTypeName(
+        String classdesc = utils.getTypeName(
                 configuration, containing, true) + " ";
         if (member.isField()) {
             if (member.isStatic()) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -50,6 +50,7 @@
 public abstract class AbstractMemberWriter {
 
     protected final ConfigurationImpl configuration;
+    protected final Utils utils;
     protected final SubWriterHolderWriter writer;
     protected final ClassDoc classdoc;
     protected Map<String,Integer> typeMap = new LinkedHashMap<>();
@@ -64,6 +65,7 @@
         this.writer = writer;
         this.nodepr = configuration.nodeprecated;
         this.classdoc = classdoc;
+        this.utils = writer.configuration.utils;
     }
 
     public AbstractMemberWriter(SubWriterHolderWriter writer) {
@@ -244,8 +246,8 @@
             // it is updated to use the javax.lang.model.element.Modifier, we
             // will need to remove this.
             mod = (member.isMethod() && ((MethodDoc)member).isDefault()) ?
-                    Util.replaceText(mod, "public", "default").trim() :
-                    Util.replaceText(mod, "public", "").trim();
+                    utils.replaceText(mod, "public", "default").trim() :
+                    utils.replaceText(mod, "public", "").trim();
         }
         if(mod.length() > 0) {
             htmltree.addContent(mod);
@@ -538,7 +540,7 @@
     }
 
     public ProgramElementDoc[] eligibleMembers(ProgramElementDoc[] members) {
-        return nodepr? Util.excludeDeprecatedMembers(members): members;
+        return nodepr? utils.excludeDeprecatedMembers(members): members;
     }
 
     /**
@@ -573,7 +575,7 @@
                         ? methodType | MethodTypes.ABSTRACT.value()
                         : methodType | MethodTypes.CONCRETE.value();
             }
-            if (Util.isDeprecated(member) || Util.isDeprecated(classdoc)) {
+            if (utils.isDeprecated(member) || utils.isDeprecated(classdoc)) {
                 methodType = methodType | MethodTypes.DEPRECATED.value();
             }
             methodTypesOr = methodTypesOr | methodType;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -137,7 +137,7 @@
             for (ClassDoc intf : interfaces) {
                 if (parent != intf) {
                     if (!(intf.isPublic() ||
-                          Util.isLinkable(intf, configuration))) {
+                          utils.isLinkable(intf, configuration))) {
                         continue;
                     }
                     if (counter == 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -153,7 +153,7 @@
                                Content content) {
         for (Doc doc : classlist) {
             ClassDoc cd = (ClassDoc) doc;
-            if (!Util.isCoreClass(cd)) {
+            if (!utils.isCoreClass(cd)) {
                 continue;
             }
             Content label = italicsClassName(cd, false);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -261,7 +261,7 @@
         Content hr = new HtmlTree(HtmlTag.HR);
         annotationInfoTree.addContent(hr);
         Tag[] deprs = annotationType.tags("deprecated");
-        if (Util.isDeprecated(annotationType)) {
+        if (utils.isDeprecated(annotationType)) {
             Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
             Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             if (deprs.length > 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -165,13 +165,13 @@
             // the class-use page if the class is marked as deprecated but the containing
             // package is not since it could still be linked from that package-use page.
             if (!(configuration.nodeprecated &&
-                  Util.isDeprecated(aClass.containingPackage())))
+                  configuration.utils.isDeprecated(aClass.containingPackage())))
                 ClassUseWriter.generate(configuration, mapper, aClass);
         }
         for (PackageDoc pkg : configuration.packages) {
             // If -nodeprecated option is set and the package is marked
             // as deprecated, do not generate the package-use page.
-            if (!(configuration.nodeprecated && Util.isDeprecated(pkg)))
+            if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg)))
                 PackageUseWriter.generate(configuration, mapper, pkg);
         }
     }
@@ -180,7 +180,7 @@
         Map<String,List<ProgramElementDoc>> map = new HashMap<>();
         List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
         if (list != null) {
-            Collections.sort(list, Util.makeComparatorForClassUse());
+            Collections.sort(list, utils.makeComparatorForClassUse());
             for (ProgramElementDoc doc : list) {
                 PackageDoc pkg = doc.containingPackage();
                 pkgSet.add(pkg);
@@ -337,7 +337,7 @@
             Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
                                        getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
                                                                 classdoc)),
-                                       getPackageLink(pkg, Util.getPackageName(pkg)));
+                                       getPackageLink(pkg, utils.getPackageName(pkg)));
             Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
             li.addContent(heading);
             addClassUse(pkg, li);
@@ -355,7 +355,7 @@
      */
     protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
         Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
-                getHyperLink(pkg.name(), new StringContent(Util.getPackageName(pkg))));
+                getHyperLink(pkg.name(), new StringContent(utils.getPackageName(pkg))));
         contentTree.addContent(tdFirst);
         HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
         tdLast.addStyle(HtmlStyle.colLast);
@@ -372,7 +372,7 @@
     protected void addClassUse(PackageDoc pkg, Content contentTree) throws IOException {
         Content classLink = getLink(new LinkInfoImpl(configuration,
             LinkInfoImpl.Kind.CLASS_USE_HEADER, classdoc));
-        Content pkgLink = getPackageLink(pkg, Util.getPackageName(pkg));
+        Content pkgLink = getPackageLink(pkg, utils.getPackageName(pkg));
         classSubWriter.addUseInfo(pkgToClassAnnotations.get(pkg.name()),
                 configuration.getResource("doclet.ClassUse_Annotation", classLink,
                 pkgLink), classUseTableSummary, contentTree);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -260,7 +260,7 @@
             pre.addContent(span);
         }
         if (!isInterface) {
-            Type superclass = Util.getFirstVisibleSuperClass(classDoc,
+            Type superclass = utils.getFirstVisibleSuperClass(classDoc,
                     configuration);
             if (superclass != null) {
                 pre.addContent(DocletConstants.NL);
@@ -276,7 +276,7 @@
             int counter = 0;
             for (Type implType : implIntfacs) {
                 ClassDoc classDoc = implType.asClassDoc();
-                if (!(classDoc.isPublic() || Util.isLinkable(classDoc, configuration))) {
+                if (!(classDoc.isPublic() || utils.isLinkable(classDoc, configuration))) {
                     continue;
                 }
                 if (counter == 0) {
@@ -329,7 +329,7 @@
         classTreeUl.addStyle(HtmlStyle.inheritance);
         Content liTree = null;
         do {
-            sup = Util.getFirstVisibleSuperClass(
+            sup = utils.getFirstVisibleSuperClass(
                     type instanceof ClassDoc ? (ClassDoc) type : type.asClassDoc(),
                     configuration);
             if (sup != null) {
@@ -471,7 +471,7 @@
     public void addImplementedInterfacesInfo(Content classInfoTree) {
         //NOTE:  we really should be using ClassDoc.interfaceTypes() here, but
         //       it doesn't walk up the tree like we want it to.
-        List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration);
+        List<Type> interfaceArray = utils.getAllInterfaces(classDoc, configuration);
         if (classDoc.isClass() && interfaceArray.size() > 0) {
             Content label = getResource(
                     "doclet.All_Implemented_Interfaces");
@@ -489,7 +489,7 @@
     public void addSuperInterfacesInfo(Content classInfoTree) {
         //NOTE:  we really should be using ClassDoc.interfaceTypes() here, but
         //       it doesn't walk up the tree like we want it to.
-        List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration);
+        List<Type> interfaceArray = utils.getAllInterfaces(classDoc, configuration);
         if (classDoc.isInterface() && interfaceArray.size() > 0) {
             Content label = getResource(
                     "doclet.All_Superinterfaces");
@@ -559,7 +559,7 @@
         Content hr = new HtmlTree(HtmlTag.HR);
         classInfoTree.addContent(hr);
         Tag[] deprs = classDoc.tags("deprecated");
-        if (Util.isDeprecated(classDoc)) {
+        if (utils.isDeprecated(classDoc)) {
             Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
             Content div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             if (deprs.length > 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -130,7 +130,7 @@
         ClassDoc holder = field.containingClass();
         if (field.inlineTags().length > 0) {
             if (holder.equals(classdoc) ||
-                    (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
+                    (! (holder.isPublic() || utils.isLinkable(holder, configuration)))) {
                 writer.addInlineComment(field, fieldDocTree);
             } else {
                 Content link =
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Wed Jul 05 19:50:06 2017 +0200
@@ -28,7 +28,6 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
-import com.sun.tools.javac.sym.Profiles;
 import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.builders.*;
@@ -223,7 +222,7 @@
                     // deprecated, do not generate the profilename-package-summary.html
                     // and profilename-package-frame.html pages for that package.
                     PackageDoc pkg = packages.get(j);
-                    if (!(configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                    if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
                         ProfilePackageFrameWriter.generate(configuration, pkg, i);
                         next = getNamedPackage(packages, j + 1);
                         AbstractBuilder profilePackageSummaryBuilder =
@@ -269,7 +268,7 @@
             // deprecated, do not generate the package-summary.html, package-frame.html
             // and package-tree.html pages for that package.
             PackageDoc pkg = pList.get(i);
-            if (!(configuration.nodeprecated && Util.isDeprecated(pkg))) {
+            if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
                 PackageFrameWriter.generate(configuration, pkg);
                 next = getNamedPackage(pList, i + 1);
                 //If the next package is unnamed package, skip 2 ahead if possible
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -82,6 +82,8 @@
      */
     public final ConfigurationImpl configuration;
 
+    protected final Utils utils;
+
     /**
      * To check whether annotation heading is printed or not.
      */
@@ -111,6 +113,7 @@
             throws IOException {
         super(configuration, path);
         this.configuration = configuration;
+        this.utils = configuration.utils;
         this.path = path;
         this.pathToRoot = path.parent().invert();
         this.filename = path.basename();
@@ -347,7 +350,7 @@
                 if (!isTypeInProfile(classes[i], profileValue)) {
                     continue;
                 }
-                if (!Util.isCoreClass(classes[i]) ||
+                if (!utils.isCoreClass(classes[i]) ||
                     !configuration.isGeneratedDoc(classes[i])) {
                     continue;
                 }
@@ -361,7 +364,7 @@
                     tr.addStyle(HtmlStyle.rowColor);
                 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
                 tdClassDescription.addStyle(HtmlStyle.colLast);
-                if (Util.isDeprecated(classes[i])) {
+                if (utils.isDeprecated(classes[i])) {
                     tdClassDescription.addContent(deprecatedLabel);
                     if (classes[i].tags("deprecated").length > 0) {
                         addSummaryDeprecatedComment(classes[i],
@@ -1021,7 +1024,7 @@
             return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY),
                     label);
         } else {
-            DocLink crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg));
+            DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(pkg));
             if (crossPkgLink != null) {
                 return getHyperLink(crossPkgLink, label);
             } else {
@@ -1288,7 +1291,7 @@
     public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
             Content label, boolean strong, boolean isProperty) {
         if (! (doc.isIncluded() ||
-            Util.isLinkable(classDoc, configuration))) {
+            utils.isLinkable(classDoc, configuration))) {
             return label;
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
@@ -1316,7 +1319,7 @@
     public Content getDocLink(LinkInfoImpl.Kind context, ClassDoc classDoc, MemberDoc doc,
             Content label) {
         if (! (doc.isIncluded() ||
-            Util.isLinkable(classDoc, configuration))) {
+            utils.isLinkable(classDoc, configuration))) {
             return label;
         } else if (doc instanceof ExecutableMemberDoc) {
             ExecutableMemberDoc emd = (ExecutableMemberDoc) doc;
@@ -1360,7 +1363,7 @@
             return new ContentBuilder();
         }
 
-        String seetext = replaceDocRootDir(Util.normalizeNewlines(see.text()));
+        String seetext = replaceDocRootDir(utils.normalizeNewlines(see.text()));
 
         //Check if @see is an href or "string"
         if (seetext.startsWith("<") || seetext.startsWith("\"")) {
@@ -1422,7 +1425,7 @@
             ClassDoc containing = refMem.containingClass();
             if (see.text().trim().startsWith("#") &&
                 ! (containing.isPublic() ||
-                Util.isLinkable(containing, configuration))) {
+                utils.isLinkable(containing, configuration))) {
                 // Since the link is relative and the holder is not even being
                 // documented, this must be an inherited link.  Redirect it.
                 // The current class either overrides the referenced member or
@@ -1628,8 +1631,8 @@
                 if (isFirstSentence) {
                     text = removeNonInlineHtmlTags(text);
                 }
-                text = Util.replaceTabs(configuration, text);
-                text = Util.normalizeNewlines(text);
+                text = utils.replaceTabs(configuration, text);
+                text = utils.normalizeNewlines(text);
                 result.addContent(new RawHtml(text));
             }
         }
@@ -1955,13 +1958,13 @@
             // and also if its container annotation is not documented, do not add it
             // to the list. If an annotation of a repeatable type is not documented
             // but its container is documented, it will be added to the list.
-            if (!Util.isDocumentedAnnotation(annotationDoc) &&
+            if (!utils.isDocumentedAnnotation(annotationDoc) &&
                 (!isAnnotationDocumented && !isContainerDocumented)) {
                 continue;
             }
             /* TODO: check logic here to correctly handle declaration
              * and type annotations.
-            if  (Util.isDeclarationAnnotation(annotationDoc, isJava5DeclarationLocation)) {
+            if  (util.isDeclarationAnnotation(annotationDoc, isJava5DeclarationLocation)) {
                 continue;
             }*/
             annotation = new ContentBuilder();
@@ -2096,7 +2099,7 @@
                         AnnotationTypeDoc annotationDoc =
                                 ((AnnotationDesc) annotationArray[0].value()).annotationType();
                         isContainerDocumented = true;
-                        if (Util.isDocumentedAnnotation(annotationDoc)) {
+                        if (utils.isDocumentedAnnotation(annotationDoc)) {
                             isAnnotationDocumented = true;
                         }
                         return true;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -29,8 +29,6 @@
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
-import com.sun.tools.doclets.formats.html.markup.RawHtml;
-import com.sun.tools.doclets.formats.html.markup.StringContent;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 import com.sun.tools.doclets.internal.toolkit.util.links.*;
@@ -174,21 +172,22 @@
      */
     private String getClassToolTip(ClassDoc classDoc, boolean isTypeLink) {
         Configuration configuration = m_writer.configuration;
+        Utils utils = configuration.utils;
         if (isTypeLink) {
             return configuration.getText("doclet.Href_Type_Param_Title",
                 classDoc.name());
         } else if (classDoc.isInterface()){
             return configuration.getText("doclet.Href_Interface_Title",
-                Util.getPackageName(classDoc.containingPackage()));
+                utils.getPackageName(classDoc.containingPackage()));
         } else if (classDoc.isAnnotationType()) {
             return configuration.getText("doclet.Href_Annotation_Title",
-                Util.getPackageName(classDoc.containingPackage()));
+                utils.getPackageName(classDoc.containingPackage()));
         } else if (classDoc.isEnum()) {
             return configuration.getText("doclet.Href_Enum_Title",
-                Util.getPackageName(classDoc.containingPackage()));
+                utils.getPackageName(classDoc.containingPackage()));
         } else {
             return configuration.getText("doclet.Href_Class_Title",
-                Util.getPackageName(classDoc.containingPackage()));
+                utils.getPackageName(classDoc.containingPackage()));
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -30,7 +30,6 @@
 import com.sun.tools.doclets.formats.html.markup.ContentBuilder;
 import com.sun.tools.doclets.formats.html.markup.StringContent;
 import com.sun.tools.doclets.internal.toolkit.Content;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 import com.sun.tools.doclets.internal.toolkit.util.links.*;
 
 /**
@@ -426,6 +425,6 @@
      * desired place.
      */
     public boolean isLinkable() {
-        return Util.isLinkable(classDoc, configuration);
+        return configuration.utils.isLinkable(classDoc, configuration);
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -151,7 +151,7 @@
         if (method.inlineTags().length > 0) {
             if (holder.asClassDoc().equals(classdoc) ||
                     (! (holderClassDoc.isPublic() ||
-                    Util.isLinkable(holderClassDoc, configuration)))) {
+                    utils.isLinkable(holderClassDoc, configuration)))) {
                 writer.addInlineComment(method, methodDocTree);
             } else {
                 Content link =
@@ -292,7 +292,7 @@
         }
         ClassDoc holderClassDoc = overriddenType.asClassDoc();
         if (! (holderClassDoc.isPublic() ||
-            Util.isLinkable(holderClassDoc, writer.configuration))) {
+            writer.configuration.utils.isLinkable(holderClassDoc, writer.configuration))) {
             //This is an implementation detail that should not be documented.
             return;
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -92,7 +92,7 @@
         PackageFrameWriter packgen;
         try {
             packgen = new PackageFrameWriter(configuration, packageDoc);
-            String pkgName = Util.getPackageName(packageDoc);
+            String pkgName = configuration.utils.getPackageName(packageDoc);
             Content body = packgen.getBody(false, packgen.getWindowTitle(pkgName));
             Content pkgNameContent = new StringContent(pkgName);
             Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar,
@@ -136,7 +136,7 @@
             addClassKindListing(packageDoc.annotationTypes(),
                 getResource("doclet.AnnotationTypes"), contentTree);
         } else {
-            String name = Util.getPackageName(packageDoc);
+            String name = utils.getPackageName(packageDoc);
             addClassKindListing(config.classDocCatalog.interfaces(name),
                 getResource("doclet.Interfaces"), contentTree);
             addClassKindListing(config.classDocCatalog.ordinaryClasses(name),
@@ -161,7 +161,7 @@
      */
     protected void addClassKindListing(ClassDoc[] arr, Content labelContent,
             Content contentTree) {
-        arr = Util.filterOutPrivateClasses(arr, configuration.javafx);
+        arr = utils.filterOutPrivateClasses(arr, configuration.javafx);
         if(arr.length > 0) {
             Arrays.sort(arr);
             boolean printedHeader = false;
@@ -171,7 +171,7 @@
                 if (documentedClasses != null && !documentedClasses.contains(classDoc)) {
                     continue;
                 }
-                if (!Util.isCoreClass(classDoc) || !configuration.isGeneratedDoc(classDoc)) {
+                if (!utils.isCoreClass(classDoc) || !configuration.isGeneratedDoc(classDoc)) {
                     continue;
                 }
                 if (!printedHeader) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -90,7 +90,7 @@
             // Do not list the package if -nodeprecated option is set and the
             // package is marked as deprecated.
             if (aPackage != null &&
-                (!(configuration.nodeprecated && Util.isDeprecated(aPackage)))) {
+                (!(configuration.nodeprecated && utils.isDeprecated(aPackage)))) {
                 ul.addContent(getPackage(aPackage));
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -168,7 +168,7 @@
         boolean altColor = true;
         for (PackageDoc pkg : packages) {
             if (pkg != null && !pkg.name().isEmpty()) {
-                if (!(configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
                     Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
                     Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
                     HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -115,7 +115,7 @@
     protected void generatePackageTreeFile() throws IOException {
         Content body = getPackageTreeHeader();
         Content headContent = getResource("doclet.Hierarchy_For_Package",
-                Util.getPackageName(packagedoc));
+                utils.getPackageName(packagedoc));
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
                 HtmlStyle.title, headContent);
         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -74,7 +74,7 @@
                             .get(usingPackage.name());
                     if (usedClasses == null) {
                         usedClasses = new TreeSet<>();
-                        usingPackageToUsedClasses.put(Util.getPackageName(usingPackage),
+                        usingPackageToUsedClasses.put(utils.getPackageName(usingPackage),
                                                       usedClasses);
                     }
                     usedClasses.add(usedClass);
@@ -151,7 +151,7 @@
         Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, useTableSummary,
                 getTableCaption(configuration.getResource(
                 "doclet.ClassUse_Packages.that.use.0",
-                getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)))));
+                getPackageLink(pkgdoc, utils.getPackageName(pkgdoc)))));
         table.addContent(getSummaryTableHeader(packageTableHeader, "col"));
         Content tbody = new HtmlTree(HtmlTag.TBODY);
         Iterator<String> it = usingPackageToUsedClasses.keySet().iterator();
@@ -194,8 +194,8 @@
             Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary,
                                            getTableCaption(configuration.getResource(
                                                    "doclet.ClassUse_Classes.in.0.used.by.1",
-                                                   getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
-                                                   getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
+                                                   getPackageLink(pkgdoc, utils.getPackageName(pkgdoc)),
+                                                   getPackageLink(usingPackage, utils.getPackageName(usingPackage)))));
             table.addContent(getSummaryTableHeader(classTableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             Iterator<ClassDoc> itc =
@@ -241,8 +241,8 @@
      */
     protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
         Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
-                getHyperLink(Util.getPackageName(pkg),
-                new StringContent(Util.getPackageName(pkg))));
+                getHyperLink(utils.getPackageName(pkg),
+                new StringContent(utils.getPackageName(pkg))));
         contentTree.addContent(tdFirst);
         HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
         tdLast.addStyle(HtmlStyle.colLast);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -138,7 +138,7 @@
      */
     public void addDeprecationInfo(Content div) {
         Tag[] deprs = packageDoc.tags("deprecated");
-        if (Util.isDeprecated(packageDoc)) {
+        if (utils.isDeprecated(packageDoc)) {
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
             Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
@@ -175,7 +175,7 @@
             table.addContent(getSummaryTableHeader(tableHeader, "col"));
             Content tbody = new HtmlTree(HtmlTag.TBODY);
             for (int i = 0; i < classes.length; i++) {
-                if (!Util.isCoreClass(classes[i]) ||
+                if (!utils.isCoreClass(classes[i]) ||
                     !configuration.isGeneratedDoc(classes[i])) {
                     continue;
                 }
@@ -189,7 +189,7 @@
                     tr.addStyle(HtmlStyle.rowColor);
                 HtmlTree tdClassDescription = new HtmlTree(HtmlTag.TD);
                 tdClassDescription.addStyle(HtmlStyle.colLast);
-                if (Util.isDeprecated(classes[i])) {
+                if (utils.isDeprecated(classes[i])) {
                     tdClassDescription.addContent(deprecatedLabel);
                     if (classes[i].tags("deprecated").length > 0) {
                         addSummaryDeprecatedComment(classes[i],
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -91,7 +91,7 @@
             StringBuilder winTitle = new StringBuilder(profileName);
             String sep = " - ";
             winTitle.append(sep);
-            String pkgName = Util.getPackageName(packageDoc);
+            String pkgName = configuration.utils.getPackageName(packageDoc);
             winTitle.append(pkgName);
             Content body = profpackgen.getBody(false,
                     profpackgen.getWindowTitle(winTitle.toString()));
@@ -163,7 +163,7 @@
                 if (!isTypeInProfile(classDoc, profileValue)) {
                     continue;
                 }
-                if (!Util.isCoreClass(classDoc) || !
+                if (!utils.isCoreClass(classDoc) || !
                         configuration.isGeneratedDoc(classDoc)) {
                     continue;
                 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -95,7 +95,7 @@
         ul.setTitle(packagesLabel);
         List<PackageDoc> packages = configuration.profilePackages.get(profileName);
         for (PackageDoc packageDoc : packages) {
-            if ((!(configuration.nodeprecated && Util.isDeprecated(packageDoc)))) {
+            if ((!(configuration.nodeprecated && utils.isDeprecated(packageDoc)))) {
                 ul.addContent(getPackage(packageDoc, profileName));
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -26,7 +26,6 @@
 package com.sun.tools.doclets.formats.html;
 
 import java.io.*;
-import java.util.*;
 
 import com.sun.javadoc.*;
 import com.sun.tools.javac.jvm.Profile;
@@ -155,7 +154,7 @@
      */
     public void addDeprecationInfo(Content div) {
         Tag[] deprs = packageDoc.tags("deprecated");
-        if (Util.isDeprecated(packageDoc)) {
+        if (utils.isDeprecated(packageDoc)) {
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
             Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -26,7 +26,6 @@
 package com.sun.tools.doclets.formats.html;
 
 import java.io.*;
-import java.util.*;
 
 import com.sun.javadoc.*;
 import com.sun.tools.javac.jvm.Profile;
@@ -183,7 +182,7 @@
      */
     public void addPackageDeprecationInfo(Content li, PackageDoc pkg) {
         Tag[] deprs;
-        if (Util.isDeprecated(pkg)) {
+        if (utils.isDeprecated(pkg)) {
             deprs = pkg.tags("deprecated");
             HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
             deprDiv.addStyle(HtmlStyle.deprecatedContent);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -126,7 +126,7 @@
         ClassDoc holder = property.containingClass();
         if (property.inlineTags().length > 0) {
             if (holder.equals(classdoc) ||
-                    (! (holder.isPublic() || Util.isLinkable(holder, configuration)))) {
+                    (! (holder.isPublic() || utils.isLinkable(holder, configuration)))) {
                 writer.addInlineComment(property, propertyDocTree);
             } else {
                 Content link =
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -61,6 +61,7 @@
     private static final String NEW_LINE = DocletConstants.NL;
 
     private final ConfigurationImpl configuration;
+    private final Utils utils;
 
     private final RootDoc rootDoc;
 
@@ -75,6 +76,7 @@
     private SourceToHTMLConverter(ConfigurationImpl configuration, RootDoc rd,
             DocPath outputdir) {
         this.configuration  = configuration;
+        this.utils = configuration.utils;
         this.rootDoc = rd;
         this.outputdir = outputdir;
     }
@@ -98,7 +100,7 @@
         for (PackageDoc pd : rootDoc.specifiedPackages()) {
             // If -nodeprecated option is set and the package is marked as deprecated,
             // do not convert the package files to HTML.
-            if (!(configuration.nodeprecated && Util.isDeprecated(pd)))
+            if (!(configuration.nodeprecated && utils.isDeprecated(pd)))
                 convertPackage(pd, outputdir);
         }
         for (ClassDoc cd : rootDoc.specifiedClasses()) {
@@ -106,7 +108,7 @@
             // or the containing package is deprecated, do not convert the
             // package files to HTML.
             if (!(configuration.nodeprecated &&
-                  (Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage()))))
+                  (utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage()))))
                 convertClass(cd, outputdir);
         }
     }
@@ -126,7 +128,7 @@
             // do not convert the package files to HTML. We do not check for
             // containing package deprecation since it is already check in
             // the calling method above.
-            if (!(configuration.nodeprecated && Util.isDeprecated(cd)))
+            if (!(configuration.nodeprecated && utils.isDeprecated(cd)))
                 convertClass(cd, outputdir);
         }
     }
@@ -260,7 +262,7 @@
      */
     private void addLine(Content pre, String line, int currentLineNo) {
         if (line != null) {
-            pre.addContent(Util.replaceTabs(configuration, line));
+            pre.addContent(utils.replaceTabs(configuration, line));
             Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo));
             pre.addContent(anchor);
             pre.addContent(NEW_LINE);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -174,7 +174,7 @@
             Content tdSummary) {
         Tag[] deprs = member.tags("deprecated");
         Content div;
-        if (Util.isDeprecated((ProgramElementDoc) member)) {
+        if (utils.isDeprecated((ProgramElementDoc) member)) {
             Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
             div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
             div.addContent(getSpace());
@@ -185,7 +185,7 @@
             return;
         } else {
             ClassDoc cd = ((ProgramElementDoc)member).containingClass();
-            if (cd != null && Util.isDeprecated(cd)) {
+            if (cd != null && utils.isDeprecated(cd)) {
                 Content deprLabel = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
                 div = HtmlTree.DIV(HtmlStyle.block, deprLabel);
                 div.addContent(getSpace());
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -53,11 +53,13 @@
 
     private final HtmlDocletWriter htmlWriter;
     private final ConfigurationImpl configuration;
+    private final Utils utils;
 
     public TagletWriterImpl(HtmlDocletWriter htmlWriter, boolean isFirstSentence) {
         super(isFirstSentence);
         this.htmlWriter = htmlWriter;
         configuration = htmlWriter.configuration;
+        this.utils = configuration.utils;
     }
 
     /**
@@ -71,7 +73,7 @@
      * {@inheritDoc}
      */
     protected Content codeTagOutput(Tag tag) {
-        Content result = HtmlTree.CODE(new StringContent(Util.normalizeNewlines(tag.text())));
+        Content result = HtmlTree.CODE(new StringContent(utils.normalizeNewlines(tag.text())));
         return result;
     }
 
@@ -94,7 +96,7 @@
         ContentBuilder result = new ContentBuilder();
         Tag[] deprs = doc.tags("deprecated");
         if (doc instanceof ClassDoc) {
-            if (Util.isDeprecated((ProgramElementDoc) doc)) {
+            if (utils.isDeprecated((ProgramElementDoc) doc)) {
                 result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
                         new StringContent(configuration.getText("doclet.Deprecated"))));
                 result.addContent(RawHtml.nbsp);
@@ -109,7 +111,7 @@
             }
         } else {
             MemberDoc member = (MemberDoc) doc;
-            if (Util.isDeprecated((ProgramElementDoc) doc)) {
+            if (utils.isDeprecated((ProgramElementDoc) doc)) {
                 result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
                         new StringContent(configuration.getText("doclet.Deprecated"))));
                 result.addContent(RawHtml.nbsp);
@@ -120,7 +122,7 @@
                         result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body));
                 }
             } else {
-                if (Util.isDeprecated(member.containingClass())) {
+                if (utils.isDeprecated(member.containingClass())) {
                     result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
                             new StringContent(configuration.getText("doclet.Deprecated"))));
                     result.addContent(RawHtml.nbsp);
@@ -134,7 +136,7 @@
      * {@inheritDoc}
      */
     protected Content literalTagOutput(Tag tag) {
-        Content result = new StringContent(Util.normalizeNewlines(tag.text()));
+        Content result = new StringContent(utils.normalizeNewlines(tag.text()));
         return result;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -142,7 +142,7 @@
                 // is set and the package is marked as deprecated, do not include
                 // the page in the list of package hierarchies.
                 if (pkg.name().isEmpty() ||
-                        (configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                        (configuration.nodeprecated && utils.isDeprecated(pkg))) {
                     i++;
                     continue;
                 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -45,6 +45,10 @@
      * The global configuration information for this run.
      */
     public Configuration configuration;
+    /*
+     *  a handle to our utility methods
+     */
+    protected Utils utils;
 
     /**
      * The only doclet that may use this toolkit is {@value}
@@ -75,6 +79,7 @@
     public boolean start(AbstractDoclet doclet, RootDoc root) {
         configuration = configuration();
         configuration.root = root;
+        utils = configuration.utils;
         if (! isValidDoclet(doclet)) {
             return false;
         }
@@ -94,7 +99,6 @@
             }
             return false;
         } catch (Exception exc) {
-            exc.printStackTrace();
             return false;
         }
         return true;
@@ -135,7 +139,7 @@
         ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
 
         generateClassFiles(root, classtree);
-        Util.copyDocFiles(configuration, DocPaths.DOC_FILES);
+        configuration.utils.copyDocFiles(configuration, DocPaths.DOC_FILES);
 
         PackageListWriter.generate(configuration);
         generatePackageFiles(classtree);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Jul 05 19:50:06 2017 +0200
@@ -140,7 +140,7 @@
     /**
      * The meta tag keywords instance.
      */
-    public final MetaKeywords metakeywords = new MetaKeywords(this);
+    public final MetaKeywords metakeywords;
 
     /**
      * The list of doc-file subdirectories to exclude
@@ -158,6 +158,10 @@
     public RootDoc root;
 
     /**
+     * An utility class for commonly used helpers
+     */
+    public Utils utils;
+    /**
      * Destination directory name, in which doclet will generate the entire
      * documentation. Default is current directory.
      */
@@ -310,6 +314,8 @@
         excludedDocFileDirs = new HashSet<>();
         excludedQualifiers = new HashSet<>();
         setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH);
+        utils = new Utils();
+        metakeywords = new MetaKeywords(this);
     }
 
     /**
@@ -397,7 +403,7 @@
             interimResults.put(p, new ArrayList<PackageDoc>());
 
         for (PackageDoc pkg: packages) {
-            if (nodeprecated && Util.isDeprecated(pkg)) {
+            if (nodeprecated && utils.isDeprecated(pkg)) {
                 continue;
             }
             // the getProfile method takes a type name, not a package name,
@@ -933,7 +939,7 @@
         if (!nodeprecated) {
             return true;
         }
-        return !(Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage()));
+        return !(utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage()));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -85,6 +85,8 @@
      */
     protected final Configuration configuration;
 
+    protected final Utils utils;
+
     /**
      * Keep track of which packages we have seen for
      * efficiency purposes.  We don't want to copy the
@@ -106,6 +108,7 @@
      */
     public AbstractBuilder(Context c) {
         this.configuration = c.configuration;
+        this.utils = configuration.utils;
         this.containingPackagesSeen = c.containingPackagesSeen;
         this.layoutParser = c.layoutParser;
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -26,11 +26,9 @@
 package com.sun.tools.doclets.internal.toolkit.builders;
 
 import java.io.*;
-import java.util.*;
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
  * Builds the summary for a given annotation type.
@@ -138,7 +136,7 @@
             //Only copy doc files dir if the containing package is not
             //documented AND if we have not documented a class from the same
             //package already. Otherwise, we are making duplicate copies.
-            Util.copyDocFiles(configuration, containingPackage);
+            utils.copyDocFiles(configuration, containingPackage);
             containingPackagesSeen.add(containingPackage);
         }
      }
@@ -174,7 +172,7 @@
     public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) {
         StringBuilder modifiers = new StringBuilder(
                 annotationTypeDoc.modifiers() + " ");
-        writer.addAnnotationTypeSignature(Util.replaceText(
+        writer.addAnnotationTypeSignature(utils.replaceText(
                 modifiers.toString(), "interface", "@interface"), annotationInfoTree);
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -26,11 +26,9 @@
 package com.sun.tools.doclets.internal.toolkit.builders;
 
 import java.io.*;
-import java.util.*;
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
  * Builds the summary for a given class.
@@ -94,7 +92,7 @@
         } else if (classDoc.isEnum()) {
             isInterface = false;
             isEnum = true;
-            Util.setEnumDocumentation(configuration, classDoc);
+            utils.setEnumDocumentation(configuration, classDoc);
         } else {
             isInterface = false;
             isEnum = false;
@@ -276,7 +274,7 @@
             //Only copy doc files dir if the containing package is not
             //documented AND if we have not documented a class from the same
             //package already. Otherwise, we are making duplicate copies.
-            Util.copyDocFiles(configuration, containingPackage);
+            utils.copyDocFiles(configuration, containingPackage);
             containingPackagesSeen.add(containingPackage);
         }
      }
@@ -296,12 +294,12 @@
             if ((index = modifiers.indexOf("abstract")) >= 0) {
                 modifiers.delete(index, index + "abstract".length());
                 modifiers = new StringBuilder(
-                        Util.replaceText(modifiers.toString(), "  ", " "));
+                        utils.replaceText(modifiers.toString(), "  ", " "));
             }
             if ((index = modifiers.indexOf("final")) >= 0) {
                 modifiers.delete(index, index + "final".length());
                 modifiers = new StringBuilder(
-                        Util.replaceText(modifiers.toString(), "  ", " "));
+                        utils.replaceText(modifiers.toString(), "  ", " "));
             }
         //} else if (classDoc.isAnnotationType()) {
             //modifiers.append("@interface ");
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -347,7 +347,7 @@
                     //Inherit comments from overriden or implemented method if
                     //necessary.
                     DocFinder.Output inheritedDoc =
-                            DocFinder.search(new DocFinder.Input((MethodDoc) member));
+                            DocFinder.search(configuration, new DocFinder.Input((MethodDoc) member));
                     if (inheritedDoc.holder != null
                             && inheritedDoc.holder.firstSentenceTags().length > 0) {
                         firstSentenceTags = inheritedDoc.holder.firstSentenceTags();
@@ -384,13 +384,13 @@
                 commentTextBuilder.append(
                         MessageFormat.format(
                                 configuration.getText("doclet.PropertySetterWithName"),
-                                Util.propertyNameFromMethodName(configuration, member.name())));
+                                utils.propertyNameFromMethodName(configuration, member.name())));
             }
             if (isGetter) {
                 commentTextBuilder.append(
                         MessageFormat.format(
                                 configuration.getText("doclet.PropertyGetterWithName"),
-                                Util.propertyNameFromMethodName(configuration, member.name())));
+                                utils.propertyNameFromMethodName(configuration, member.name())));
             }
             if (propertyDoc.commentText() != null
                         && !propertyDoc.commentText().isEmpty()) {
@@ -477,7 +477,7 @@
             VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
         for (ClassDoc inhclass : visibleMemberMap.getVisibleClassesList()) {
             if (!(inhclass.isPublic() ||
-                  Util.isLinkable(inhclass, configuration))) {
+                  utils.isLinkable(inhclass, configuration))) {
                 continue;
             }
             if (inhclass == classDoc) {
@@ -491,7 +491,7 @@
                 for (int j = 0; j < inhmembers.size(); ++j) {
                     writer.addInheritedMemberSummary(
                             inhclass.isPackagePrivate() &&
-                            !Util.isLinkable(inhclass, configuration) ?
+                            !utils.isLinkable(inhclass, configuration) ?
                             classDoc : inhclass,
                             inhmembers.get(j),
                             j == 0,
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -207,7 +207,7 @@
             MethodDoc method = (MethodDoc) methods.get(currentMethodIndex);
 
             if (method.inlineTags().length == 0) {
-                DocFinder.Output docs = DocFinder.search(
+                DocFinder.Output docs = DocFinder.search(configuration,
                         new DocFinder.Input(method));
                 method = docs.inlineTags != null && docs.inlineTags.length > 0 ?
                     (MethodDoc) docs.holder : method;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -29,7 +29,6 @@
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
  * Builds the summary for a given package.
@@ -120,12 +119,12 @@
      * @param contentTree the content tree to which the documentation will be added
      */
     public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
-        contentTree = packageWriter.getPackageHeader(Util.getPackageName(packageDoc));
+        contentTree = packageWriter.getPackageHeader(utils.getPackageName(packageDoc));
         buildChildren(node, contentTree);
         packageWriter.addPackageFooter(contentTree);
         packageWriter.printDocument(contentTree);
         packageWriter.close();
-        Util.copyDocFiles(configuration, packageDoc);
+        utils.copyDocFiles(configuration, packageDoc);
     }
 
     /**
@@ -174,8 +173,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.interfaces()
                         : configuration.classDocCatalog.interfaces(
-                                Util.getPackageName(packageDoc));
-        interfaces = Util.filterOutPrivateClasses(interfaces, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        interfaces = utils.filterOutPrivateClasses(interfaces, configuration.javafx);
         if (interfaces.length > 0) {
             packageWriter.addClassesSummary(
                     interfaces,
@@ -204,8 +203,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.ordinaryClasses()
                         : configuration.classDocCatalog.ordinaryClasses(
-                                Util.getPackageName(packageDoc));
-        classes = Util.filterOutPrivateClasses(classes, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        classes = utils.filterOutPrivateClasses(classes, configuration.javafx);
         if (classes.length > 0) {
             packageWriter.addClassesSummary(
                     classes,
@@ -234,8 +233,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.enums()
                         : configuration.classDocCatalog.enums(
-                                Util.getPackageName(packageDoc));
-        enums = Util.filterOutPrivateClasses(enums, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        enums = utils.filterOutPrivateClasses(enums, configuration.javafx);
         if (enums.length > 0) {
             packageWriter.addClassesSummary(
                     enums,
@@ -264,8 +263,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.exceptions()
                         : configuration.classDocCatalog.exceptions(
-                                Util.getPackageName(packageDoc));
-        exceptions = Util.filterOutPrivateClasses(exceptions, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        exceptions = utils.filterOutPrivateClasses(exceptions, configuration.javafx);
         if (exceptions.length > 0) {
             packageWriter.addClassesSummary(
                     exceptions,
@@ -294,8 +293,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.errors()
                         : configuration.classDocCatalog.errors(
-                                Util.getPackageName(packageDoc));
-        errors = Util.filterOutPrivateClasses(errors, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        errors = utils.filterOutPrivateClasses(errors, configuration.javafx);
         if (errors.length > 0) {
             packageWriter.addClassesSummary(
                     errors,
@@ -324,8 +323,8 @@
                 packageDoc.isIncluded()
                         ? packageDoc.annotationTypes()
                         : configuration.classDocCatalog.annotationTypes(
-                                Util.getPackageName(packageDoc));
-        annotationTypes = Util.filterOutPrivateClasses(annotationTypes, configuration.javafx);
+                                utils.getPackageName(packageDoc));
+        annotationTypes = utils.filterOutPrivateClasses(annotationTypes, configuration.javafx);
         if (annotationTypes.length > 0) {
             packageWriter.addClassesSummary(
                     annotationTypes,
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -30,7 +30,6 @@
 import com.sun.javadoc.*;
 import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.doclets.internal.toolkit.util.*;
 
 /**
  * Builds the summary for a given profile package.
@@ -136,12 +135,12 @@
      */
     public void buildPackageDoc(XMLNode node, Content contentTree) throws Exception {
         contentTree = profilePackageWriter.getPackageHeader(
-                Util.getPackageName(packageDoc));
+                utils.getPackageName(packageDoc));
         buildChildren(node, contentTree);
         profilePackageWriter.addPackageFooter(contentTree);
         profilePackageWriter.printDocument(contentTree);
         profilePackageWriter.close();
-        Util.copyDocFiles(configuration, packageDoc);
+        utils.copyDocFiles(configuration, packageDoc);
     }
 
     /**
@@ -190,7 +189,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.interfaces()
                         : configuration.classDocCatalog.interfaces(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (interfaces.length > 0) {
             profilePackageWriter.addClassesSummary(
                     interfaces,
@@ -219,7 +218,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.ordinaryClasses()
                         : configuration.classDocCatalog.ordinaryClasses(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (classes.length > 0) {
             profilePackageWriter.addClassesSummary(
                     classes,
@@ -248,7 +247,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.enums()
                         : configuration.classDocCatalog.enums(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (enums.length > 0) {
             profilePackageWriter.addClassesSummary(
                     enums,
@@ -277,7 +276,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.exceptions()
                         : configuration.classDocCatalog.exceptions(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (exceptions.length > 0) {
             profilePackageWriter.addClassesSummary(
                     exceptions,
@@ -306,7 +305,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.errors()
                         : configuration.classDocCatalog.errors(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (errors.length > 0) {
             profilePackageWriter.addClassesSummary(
                     errors,
@@ -335,7 +334,7 @@
                 packageDoc.isIncluded()
                         ? packageDoc.annotationTypes()
                         : configuration.classDocCatalog.annotationTypes(
-                                Util.getPackageName(packageDoc));
+                                utils.getPackageName(packageDoc));
         if (annotationTypes.length > 0) {
             profilePackageWriter.addClassesSummary(
                     annotationTypes,
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -129,7 +129,7 @@
         profileWriter.addProfileFooter(contentTree);
         profileWriter.printDocument(contentTree);
         profileWriter.close();
-        Util.copyDocFiles(configuration, DocPaths.profileSummary(profile.name));
+        utils.copyDocFiles(configuration, DocPaths.profileSummary(profile.name));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -201,7 +201,7 @@
      */
     public void buildPackageHeader(XMLNode node, Content packageSerializedTree) {
         packageSerializedTree.addContent(writer.getPackageHeader(
-                Util.getPackageName(currentPackage)));
+                utils.getPackageName(currentPackage)));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -133,7 +133,7 @@
                 "doclet.noInheritedDoc", message);
          }
         DocFinder.Output inheritedDoc =
-            DocFinder.search(new DocFinder.Input(ped,
+            DocFinder.search(configuration, new DocFinder.Input(ped,
                 (InheritableTaglet) inheritableTaglet, holderTag,
                 isFirstSentence, true));
         if (inheritedDoc.isValidInheritDocTag) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -228,7 +228,7 @@
                 //This parameter does not have any @param documentation.
                 //Try to inherit it.
                 DocFinder.Output inheritedDoc =
-                    DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
+                    DocFinder.search(writer.configuration(), new DocFinder.Input((MethodDoc) holder, this,
                         String.valueOf(i), ! isNonTypeParams));
                 if (inheritedDoc.inlineTags != null &&
                         inheritedDoc.inlineTags.length > 0) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ReturnTaglet.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ReturnTaglet.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -89,7 +89,7 @@
         //Inherit @return tag if necessary.
         if (tags.length == 0) {
             DocFinder.Output inheritedDoc =
-                DocFinder.search(new DocFinder.Input((MethodDoc) holder, this));
+                DocFinder.search(writer.configuration(), new DocFinder.Input((MethodDoc) holder, this));
             tags = inheritedDoc.holderTag == null ? tags : new Tag[] {inheritedDoc.holderTag};
         }
         return tags.length > 0 ? writer.returnTagOutput(tags[0]) : null;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SeeTaglet.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SeeTaglet.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -66,7 +66,7 @@
         SeeTag[] tags = holder.seeTags();
         if (tags.length == 0 && holder instanceof MethodDoc) {
             DocFinder.Output inheritedDoc =
-                DocFinder.search(new DocFinder.Input((MethodDoc) holder, this));
+                DocFinder.search(writer.configuration(), new DocFinder.Input((MethodDoc) holder, this));
             if (inheritedDoc.holder != null) {
                 tags = inheritedDoc.holder.seeTags();
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -116,10 +116,10 @@
             Set<Tag> declaredExceptionTags = new LinkedHashSet<>();
             for (Type declaredExceptionType : declaredExceptionTypes) {
                 DocFinder.Output inheritedDoc =
-                        DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
+                        DocFinder.search(writer.configuration(), new DocFinder.Input((MethodDoc) holder, this,
                                                              declaredExceptionType.typeName()));
                 if (inheritedDoc.tagList.size() == 0) {
-                    inheritedDoc = DocFinder.search(new DocFinder.Input(
+                    inheritedDoc = DocFinder.search(writer.configuration(), new DocFinder.Input(
                             (MethodDoc) holder, this,
                             declaredExceptionType.qualifiedTypeName()));
                 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -91,6 +91,7 @@
      private Map<String,Set<ClassDoc>> interfaces;
 
      private Configuration configuration;
+     private Utils utils;
 
      /**
       * Construct a new ClassDocCatalog.
@@ -100,6 +101,7 @@
      public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) {
          init();
          this.configuration = config;
+         this.utils = config.utils;
          for (ClassDoc classdoc : classdocs) {
              addClassDoc(classdoc);
          }
@@ -156,13 +158,13 @@
       private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) {
 
           PackageDoc pkg = classdoc.containingPackage();
-          if (pkg.isIncluded() || (configuration.nodeprecated && Util.isDeprecated(pkg))) {
+          if (pkg.isIncluded() || (configuration.nodeprecated && utils.isDeprecated(pkg))) {
               //No need to catalog this class if it's package is
               //included on the command line or if -nodeprecated option is set
               // and the containing package is marked as deprecated.
               return;
           }
-          String key = Util.getPackageName(pkg);
+          String key = utils.getPackageName(pkg);
           Set<ClassDoc> s = map.get(key);
           if (s == null) {
               packageSet.add(key);
@@ -190,7 +192,7 @@
       public ClassDoc[] allClasses(PackageDoc pkgDoc) {
           return pkgDoc.isIncluded() ?
                 pkgDoc.allClasses() :
-                getArray(allClasses, Util.getPackageName(pkgDoc));
+                getArray(allClasses, utils.getPackageName(pkgDoc));
       }
 
       /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -81,6 +81,8 @@
     */
     private Map<ClassDoc,List<ClassDoc>> implementingclasses = new HashMap<>();
 
+    private final Configuration configuration;
+    private final Utils utils;
     /**
      * Constructor. Build the Tree using the Root of this Javadoc run.
      *
@@ -90,17 +92,21 @@
      */
     public ClassTree(Configuration configuration, boolean noDeprecated) {
         configuration.message.notice("doclet.Building_Tree");
-        buildTree(configuration.root.classes(), configuration);
+        this.configuration = configuration;
+        this.utils = configuration.utils;
+        buildTree(configuration.root.classes());
     }
 
     /**
      * Constructor. Build the Tree using the Root of this Javadoc run.
      *
      * @param root Root of the Document.
-     * @param configuration The curren configuration of the doclet.
+     * @param configuration The current configuration of the doclet.
      */
     public ClassTree(RootDoc root, Configuration configuration) {
-        buildTree(root.classes(), configuration);
+        this.configuration = configuration;
+        this.utils = configuration.utils;
+        buildTree(root.classes());
     }
 
     /**
@@ -110,7 +116,9 @@
      * @param configuration The curren configuration of the doclet.
      */
     public ClassTree(ClassDoc[] classes, Configuration configuration) {
-        buildTree(classes, configuration);
+        this.configuration = configuration;
+        this.utils = configuration.utils;
+        buildTree(classes);
     }
 
     /**
@@ -122,14 +130,14 @@
      * @param classes all the classes in this run.
      * @param configuration the current configuration of the doclet.
      */
-    private void buildTree(ClassDoc[] classes, Configuration configuration) {
+    private void buildTree(ClassDoc[] classes) {
         for (ClassDoc aClass : classes) {
             // In the tree page (e.g overview-tree.html) do not include
             // information of classes which are deprecated or are a part of a
             // deprecated package.
             if (configuration.nodeprecated &&
-                    (Util.isDeprecated(aClass) ||
-                    Util.isDeprecated(aClass.containingPackage()))) {
+                    (utils.isDeprecated(aClass) ||
+                    utils.isDeprecated(aClass.containingPackage()))) {
                 continue;
             }
 
@@ -177,7 +185,7 @@
      */
     private void processType(ClassDoc cd, Configuration configuration,
             List<ClassDoc> bases, Map<ClassDoc,List<ClassDoc>> subs) {
-        ClassDoc superclass = Util.getFirstVisibleSuperClassCD(cd, configuration);
+        ClassDoc superclass = utils.getFirstVisibleSuperClassCD(cd, configuration);
         if (superclass != null) {
             if (!add(subs, superclass, cd)) {
                 return;
@@ -189,7 +197,7 @@
                 bases.add(cd);
             }
         }
-        List<Type> intfacs = Util.getAllInterfaces(cd, configuration);
+        List<Type> intfacs = utils.getAllInterfaces(cd, configuration);
         for (Type intfac : intfacs) {
             add(implementingclasses, intfac.asClassDoc(), cd);
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/CommentedMethodFinder.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1999, 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.
- */
-
-package com.sun.tools.doclets.internal.toolkit.util;
-
-import com.sun.javadoc.*;
-
-/**
- * Find a commented method.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- *
- */
-public class CommentedMethodFinder extends MethodFinder {
-    public boolean isCorrectMethod(MethodDoc method) {
-        return method.inlineTags().length > 0;
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -61,7 +61,8 @@
      * List of deprecated type Lists.
      */
     private List<List<Doc>> deprecatedLists;
-
+    private final Configuration configuration;
+    private final Utils utils;
 
     /**
      * Constructor.
@@ -69,11 +70,13 @@
      * @param configuration the current configuration of the doclet
      */
     public DeprecatedAPIListBuilder(Configuration configuration) {
+        this.configuration = configuration;
+        this.utils = configuration.utils;
         deprecatedLists = new ArrayList<>();
         for (int i = 0; i < NUM_TYPES; i++) {
             deprecatedLists.add(i, new ArrayList<Doc>());
         }
-        buildDeprecatedAPIInfo(configuration);
+        buildDeprecatedAPIInfo();
     }
 
     /**
@@ -83,15 +86,15 @@
      *
      * @param configuration the current configuration of the doclet.
      */
-    private void buildDeprecatedAPIInfo(Configuration configuration) {
+    private void buildDeprecatedAPIInfo() {
         Set<PackageDoc> packages = configuration.packages;
         for (PackageDoc pkg : packages) {
-            if (Util.isDeprecated(pkg)) {
+            if (utils.isDeprecated(pkg)) {
                 getList(PACKAGE).add(pkg);
             }
         }
         for (ClassDoc cd : configuration.root.classes()) {
-            if (Util.isDeprecated(cd)) {
+            if (utils.isDeprecated(cd)) {
                 if (cd.isOrdinaryClass()) {
                     getList(CLASS).add(cd);
                 } else if (cd.isInterface()) {
@@ -128,7 +131,7 @@
      */
     private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) {
         for (MemberDoc member : members) {
-            if (Util.isDeprecated(member)) {
+            if (utils.isDeprecated(member)) {
                 list.add(member);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import com.sun.javadoc.*;
+import com.sun.tools.doclets.internal.toolkit.Configuration;
 import com.sun.tools.doclets.internal.toolkit.taglets.*;
 
 /**
@@ -184,7 +185,7 @@
      *
      * @return an Output object representing the documentation that was found.
      */
-    public static Output search(Input input) {
+    public static Output search(Configuration configuration, Input input) {
         Output output = new Output();
         if (input.isInheritDocTag) {
             //Do nothing because "element" does not have any documentation.
@@ -209,7 +210,7 @@
             MethodDoc overriddenMethod = ((MethodDoc) input.element).overriddenMethod();
             if (overriddenMethod != null) {
                 inheritedSearchInput.element = overriddenMethod;
-                output = search(inheritedSearchInput);
+                output = search(configuration, inheritedSearchInput);
                 output.isValidInheritDocTag = true;
                 if (output.inlineTags.length > 0) {
                     return output;
@@ -219,10 +220,10 @@
             //       not pass all implemented interfaces, we will use the
             //       appropriate element here.
             MethodDoc[] implementedMethods =
-                (new ImplementedMethods((MethodDoc) input.element, null)).build(false);
+                (new ImplementedMethods((MethodDoc) input.element, configuration)).build(false);
             for (MethodDoc implementedMethod : implementedMethods) {
                 inheritedSearchInput.element = implementedMethod;
-                output = search(inheritedSearchInput);
+                output = search(configuration, inheritedSearchInput);
                 output.isValidInheritDocTag = true;
                 if (output.inlineTags.length > 0) {
                     return output;
@@ -232,7 +233,7 @@
             ProgramElementDoc superclass = ((ClassDoc) input.element).superclass();
             if (superclass != null) {
                 inheritedSearchInput.element = superclass;
-                output = search(inheritedSearchInput);
+                output = search(configuration, inheritedSearchInput);
                 output.isValidInheritDocTag = true;
                 if (output.inlineTags.length > 0) {
                     return output;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -43,15 +43,17 @@
  */
 public class ImplementedMethods {
 
-    private Map<MethodDoc,Type> interfaces = new HashMap<>();
-    private List<MethodDoc> methlist = new ArrayList<>();
-    private Configuration configuration;
+    private final Map<MethodDoc,Type> interfaces = new HashMap<>();
+    private final List<MethodDoc> methlist = new ArrayList<>();
+    private final Configuration configuration;
+    private final Utils utils;
     private final ClassDoc classdoc;
     private final MethodDoc method;
 
     public ImplementedMethods(MethodDoc method, Configuration configuration) {
         this.method = method;
         this.configuration = configuration;
+        this.utils = configuration.utils;
         classdoc = method.containingClass();
     }
 
@@ -88,9 +90,9 @@
      * from the array passed.
      */
     private void buildImplementedMethodList(boolean sort) {
-        List<Type> intfacs = Util.getAllInterfaces(classdoc, configuration, sort);
+        List<Type> intfacs = utils.getAllInterfaces(classdoc, configuration, sort);
         for (Type interfaceType : intfacs) {
-            MethodDoc found = Util.findMethod(interfaceType.asClassDoc(), method);
+            MethodDoc found = utils.findMethod(interfaceType.asClassDoc(), method);
             if (found != null) {
                 removeOverriddenMethod(found);
                 if (!overridingMethodFound(found)) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -71,6 +71,7 @@
     // make ProgramElementDoc[] when new toArray is available
     protected final Object[] elements;
 
+    private final Configuration configuration;
     /**
      * Constructor. Build the index map.
      *
@@ -92,6 +93,7 @@
      */
     public IndexBuilder(Configuration configuration, boolean noDeprecated,
                         boolean classesOnly) {
+        this.configuration  = configuration;
         if (classesOnly) {
             configuration.message.notice("doclet.Building_Index_For_All_Classes");
         } else {
@@ -112,7 +114,7 @@
      */
     protected void sortIndexMap() {
         for (List<Doc> docs : indexmap.values()) {
-            Collections.sort(docs, Util.makeComparatorForIndexUse());
+            Collections.sort(docs, configuration.utils.makeComparatorForIndexUse());
         }
     }
 
@@ -202,14 +204,14 @@
         if (element instanceof PackageDoc)
             // Do not add to index map if -nodeprecated option is set and the
             // package is marked as deprecated.
-            return !(noDeprecated && Util.isDeprecated(element));
+            return !(noDeprecated && configuration.utils.isDeprecated(element));
         else
             // Do not add to index map if -nodeprecated option is set and if the
             // Doc is marked as deprecated or the containing package is marked as
             // deprecated.
             return !(noDeprecated &&
-                    (Util.isDeprecated(element) ||
-                    Util.isDeprecated(((ProgramElementDoc)element).containingPackage())));
+                    (configuration.utils.isDeprecated(element) ||
+                    configuration.utils.isDeprecated(((ProgramElementDoc)element).containingPackage())));
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -50,12 +50,14 @@
      * The global configuration information for this run.
      */
     private final Configuration configuration;
+    private final Utils utils;
 
     /**
      * Constructor
      */
     public MetaKeywords(Configuration configuration) {
         this.configuration = configuration;
+        this.utils = configuration.utils;
     }
 
     /**
@@ -98,7 +100,7 @@
      */
     public String[] getMetaKeywords(PackageDoc packageDoc) {
         if( configuration.keywords ) {
-            String pkgName = Util.getPackageName(packageDoc);
+            String pkgName = utils.getPackageName(packageDoc);
             return new String[] { pkgName + " " + "package" };
         } else {
             return new String[] {};
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodFinder.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 1999, 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.
- */
-
-package com.sun.tools.doclets.internal.toolkit.util;
-
-import com.sun.javadoc.*;
-
-/**
- * This class is useful for searching a method which has documentation
- * comment and documentation tags. The method is searched in all the
- * superclasses and interfaces(subsequently super-interfaces also)
- * recursively.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- */
-public abstract class MethodFinder {
-
-    abstract boolean isCorrectMethod(MethodDoc method);
-
-    public MethodDoc search(ClassDoc cd, MethodDoc method) {
-        MethodDoc meth = searchInterfaces(cd, method);
-        if (meth != null) {
-            return meth;
-        }
-        ClassDoc icd = cd.superclass();
-        if (icd != null) {
-            meth = Util.findMethod(icd, method);
-            if (meth != null) {
-            if (isCorrectMethod(meth)) {
-                    return meth;
-                }
-            }
-            return search(icd, method);
-        }
-        return null;
-    }
-
-    public MethodDoc searchInterfaces(ClassDoc cd, MethodDoc method) {
-        MethodDoc[] implementedMethods = (new ImplementedMethods(method, null)).build();
-        for (MethodDoc implementedMethod : implementedMethods) {
-            if (isCorrectMethod(implementedMethod)) {
-                return implementedMethod;
-            }
-        }
-        return null;
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -44,7 +44,8 @@
  */
 public class PackageListWriter extends PrintWriter {
 
-    private Configuration configuration;
+    private final Configuration configuration;
+    private final Utils utils;
 
     /**
      * Constructor.
@@ -54,6 +55,7 @@
     public PackageListWriter(Configuration configuration) throws IOException {
         super(DocFile.createFileForOutput(configuration, DocPaths.PACKAGE_LIST).openWriter());
         this.configuration = configuration;
+        this.utils = configuration.utils;
     }
 
     /**
@@ -80,7 +82,7 @@
         for (PackageDoc pkg : configuration.packages) {
             // if the -nodeprecated option is set and the package is marked as
             // deprecated, do not include it in the packages list.
-            if (!(configuration.nodeprecated && Util.isDeprecated(pkg)))
+            if (!(configuration.nodeprecated && utils.isDeprecated(pkg)))
                 names.add(pkg.name());
         }
         Collections.sort(names);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/TaggedMethodFinder.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1999, 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.
- */
-
-package com.sun.tools.doclets.internal.toolkit.util;
-
-import com.sun.javadoc.*;
-
-/**
- * Find a tagged method.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- *
- * @author Atul M Dambalkar
- */
-public class TaggedMethodFinder extends MethodFinder {
-    public boolean isCorrectMethod(MethodDoc method) {
-        return method.paramTags().length + method.tags("return").length +
-               method.throwsTags().length + method.seeTags().length > 0;
-    }
-}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1003 +0,0 @@
-/*
- * Copyright (c) 1999, 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.tools.doclets.internal.toolkit.util;
-
-import java.io.*;
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Target;
-import java.text.Collator;
-import java.util.*;
-
-import javax.tools.StandardLocation;
-
-import com.sun.javadoc.*;
-import com.sun.javadoc.AnnotationDesc.ElementValuePair;
-import com.sun.tools.doclets.internal.toolkit.*;
-import com.sun.tools.javac.util.StringUtils;
-
-/**
- * Utilities Class for Doclets.
- *
- *  <p><b>This is NOT part of any supported API.
- *  If you write code that depends on this, you do so at your own risk.
- *  This code and its internal interfaces are subject to change or
- *  deletion without notice.</b>
- *
- * @author Atul M Dambalkar
- * @author Jamie Ho
- */
-public class Util {
-    /**
-     * Return array of class members whose documentation is to be generated.
-     * If the member is deprecated do not include such a member in the
-     * returned array.
-     *
-     * @param  members             Array of members to choose from.
-     * @return ProgramElementDoc[] Array of eligible members for whom
-     *                             documentation is getting generated.
-     */
-    public static ProgramElementDoc[] excludeDeprecatedMembers(
-        ProgramElementDoc[] members) {
-        return
-            toProgramElementDocArray(excludeDeprecatedMembersAsList(members));
-    }
-
-    /**
-     * Return array of class members whose documentation is to be generated.
-     * If the member is deprecated do not include such a member in the
-     * returned array.
-     *
-     * @param  members    Array of members to choose from.
-     * @return List       List of eligible members for whom
-     *                    documentation is getting generated.
-     */
-    public static List<ProgramElementDoc> excludeDeprecatedMembersAsList(
-        ProgramElementDoc[] members) {
-        List<ProgramElementDoc> list = new ArrayList<>();
-        for (ProgramElementDoc member : members) {
-            if (member.tags("deprecated").length == 0) {
-                list.add(member);
-            }
-        }
-        Collections.sort(list);
-        return list;
-    }
-
-    /**
-     * Return the list of ProgramElementDoc objects as Array.
-     */
-    public static ProgramElementDoc[] toProgramElementDocArray(List<ProgramElementDoc> list) {
-        ProgramElementDoc[] pgmarr = new ProgramElementDoc[list.size()];
-        for (int i = 0; i < list.size(); i++) {
-            pgmarr[i] = list.get(i);
-        }
-        return pgmarr;
-    }
-
-    /**
-     * Return true if a non-public member found in the given array.
-     *
-     * @param  members Array of members to look into.
-     * @return boolean True if non-public member found, false otherwise.
-     */
-    public static boolean nonPublicMemberFound(ProgramElementDoc[] members) {
-        for (ProgramElementDoc member : members) {
-            if (!member.isPublic()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Search for the given method in the given class.
-     *
-     * @param  cd        Class to search into.
-     * @param  method    Method to be searched.
-     * @return MethodDoc Method found, null otherwise.
-     */
-    public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
-        MethodDoc[] methods = cd.methods();
-        for (MethodDoc m : methods) {
-            if (executableMembersEqual(method, m)) {
-                return m;
-
-            }
-        }
-        return null;
-    }
-
-    /**
-     * @param member1 the first method to compare.
-     * @param member2 the second method to compare.
-     * @return true if member1 overrides/hides or is overriden/hidden by member2.
-     */
-    public static boolean executableMembersEqual(ExecutableMemberDoc member1,
-            ExecutableMemberDoc member2) {
-        if (! (member1 instanceof MethodDoc && member2 instanceof MethodDoc))
-            return false;
-
-        MethodDoc method1 = (MethodDoc) member1;
-        MethodDoc method2 = (MethodDoc) member2;
-        if (method1.isStatic() && method2.isStatic()) {
-            Parameter[] targetParams = method1.parameters();
-            Parameter[] currentParams;
-            if (method1.name().equals(method2.name()) &&
-                   (currentParams = method2.parameters()).length ==
-                targetParams.length) {
-                int j;
-                for (j = 0; j < targetParams.length; j++) {
-                    if (! (targetParams[j].typeName().equals(
-                              currentParams[j].typeName()) ||
-                                   currentParams[j].type() instanceof TypeVariable ||
-                                   targetParams[j].type() instanceof TypeVariable)) {
-                        break;
-                    }
-                }
-                if (j == targetParams.length) {
-                    return true;
-                }
-            }
-            return false;
-        } else {
-                return method1.overrides(method2) ||
-                method2.overrides(method1) ||
-                                member1 == member2;
-        }
-    }
-
-    /**
-     * According to
-     * <cite>The Java&trade; Language Specification</cite>,
-     * all the outer classes and static inner classes are core classes.
-     */
-    public static boolean isCoreClass(ClassDoc cd) {
-        return cd.containingClass() == null || cd.isStatic();
-    }
-
-    public static boolean matches(ProgramElementDoc doc1,
-            ProgramElementDoc doc2) {
-        if (doc1 instanceof ExecutableMemberDoc &&
-            doc2 instanceof ExecutableMemberDoc) {
-            ExecutableMemberDoc ed1 = (ExecutableMemberDoc)doc1;
-            ExecutableMemberDoc ed2 = (ExecutableMemberDoc)doc2;
-            return executableMembersEqual(ed1, ed2);
-        } else {
-            return doc1.name().equals(doc2.name());
-        }
-    }
-
-    /**
-     * Copy the given directory contents from the source package directory
-     * to the generated documentation directory. For example for a package
-     * java.lang this method find out the source location of the package using
-     * {@link SourcePath} and if given directory is found in the source
-     * directory structure, copy the entire directory, to the generated
-     * documentation hierarchy.
-     *
-     * @param configuration The configuration of the current doclet.
-     * @param path The relative path to the directory to be copied.
-     * @param dir The original directory name to copy from.
-     * @param overwrite Overwrite files if true.
-     */
-    public static void copyDocFiles(Configuration configuration, PackageDoc pd) {
-        copyDocFiles(configuration, DocPath.forPackage(pd).resolve(DocPaths.DOC_FILES));
-    }
-
-    public static void copyDocFiles(Configuration configuration, DocPath dir) {
-        try {
-            boolean first = true;
-            for (DocFile f : DocFile.list(configuration, StandardLocation.SOURCE_PATH, dir)) {
-                if (!f.isDirectory()) {
-                    continue;
-                }
-                DocFile srcdir = f;
-                DocFile destdir = DocFile.createFileForOutput(configuration, dir);
-                if (srcdir.isSameFile(destdir)) {
-                    continue;
-                }
-
-                for (DocFile srcfile: srcdir.list()) {
-                    DocFile destfile = destdir.resolve(srcfile.getName());
-                    if (srcfile.isFile()) {
-                        if (destfile.exists() && !first) {
-                            configuration.message.warning((SourcePosition) null,
-                                    "doclet.Copy_Overwrite_warning",
-                                    srcfile.getPath(), destdir.getPath());
-                        } else {
-                            configuration.message.notice(
-                                    "doclet.Copying_File_0_To_Dir_1",
-                                    srcfile.getPath(), destdir.getPath());
-                            destfile.copyFile(srcfile);
-                        }
-                    } else if (srcfile.isDirectory()) {
-                        if (configuration.copydocfilesubdirs
-                                && !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
-                            copyDocFiles(configuration, dir.resolve(srcfile.getName()));
-                        }
-                    }
-                }
-
-                first = false;
-            }
-        } catch (SecurityException | IOException exc) {
-            throw new DocletAbortException(exc);
-        }
-    }
-
-    /**
-     * We want the list of types in alphabetical order.  However, types are not
-     * comparable.  We need a comparator for now.
-     */
-    private static class TypeComparator implements Comparator<Type> {
-        public int compare(Type type1, Type type2) {
-            return type1.qualifiedTypeName().compareToIgnoreCase(
-                type2.qualifiedTypeName());
-        }
-    }
-
-    /**
-     * For the class return all implemented interfaces including the
-     * superinterfaces of the implementing interfaces, also iterate over for
-     * all the superclasses. For interface return all the extended interfaces
-     * as well as superinterfaces for those extended interfaces.
-     *
-     * @param  type       type whose implemented or
-     *                    super interfaces are sought.
-     * @param  configuration the current configuration of the doclet.
-     * @param  sort if true, return list of interfaces sorted alphabetically.
-     * @return List of all the required interfaces.
-     */
-    public static List<Type> getAllInterfaces(Type type,
-            Configuration configuration, boolean sort) {
-        Map<ClassDoc,Type> results = sort ?
-                new TreeMap<ClassDoc,Type>() :
-                new LinkedHashMap<ClassDoc,Type>();
-        Type[] interfaceTypes = null;
-        Type superType = null;
-        if (type instanceof ParameterizedType) {
-            interfaceTypes = ((ParameterizedType) type).interfaceTypes();
-            superType = ((ParameterizedType) type).superclassType();
-        } else if (type instanceof ClassDoc) {
-            interfaceTypes = ((ClassDoc) type).interfaceTypes();
-            superType = ((ClassDoc) type).superclassType();
-        } else {
-            interfaceTypes = type.asClassDoc().interfaceTypes();
-            superType = type.asClassDoc().superclassType();
-        }
-
-        for (Type interfaceType : interfaceTypes) {
-            ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
-            if (!(interfaceClassDoc.isPublic() ||
-                  (configuration == null ||
-                   isLinkable(interfaceClassDoc, configuration)))) {
-                continue;
-            }
-            results.put(interfaceClassDoc, interfaceType);
-            for (Type t : getAllInterfaces(interfaceType, configuration, sort)) {
-                results.put(t.asClassDoc(), t);
-            }
-        }
-        if (superType == null)
-            return new ArrayList<>(results.values());
-        //Try walking the tree.
-        addAllInterfaceTypes(results,
-            superType,
-            interfaceTypesOf(superType),
-            false, configuration);
-        List<Type> resultsList = new ArrayList<>(results.values());
-        if (sort) {
-                Collections.sort(resultsList, new TypeComparator());
-        }
-        return resultsList;
-    }
-
-    private static Type[] interfaceTypesOf(Type type) {
-        if (type instanceof AnnotatedType)
-            type = ((AnnotatedType)type).underlyingType();
-        return type instanceof ClassDoc ?
-                ((ClassDoc)type).interfaceTypes() :
-                ((ParameterizedType)type).interfaceTypes();
-    }
-
-    public static List<Type> getAllInterfaces(Type type, Configuration configuration) {
-        return getAllInterfaces(type, configuration, true);
-    }
-
-    private static void findAllInterfaceTypes(Map<ClassDoc,Type> results, ClassDoc c, boolean raw,
-            Configuration configuration) {
-        Type superType = c.superclassType();
-        if (superType == null)
-            return;
-        addAllInterfaceTypes(results, superType,
-                interfaceTypesOf(superType),
-                raw, configuration);
-    }
-
-    private static void findAllInterfaceTypes(Map<ClassDoc,Type> results, ParameterizedType p,
-            Configuration configuration) {
-        Type superType = p.superclassType();
-        if (superType == null)
-            return;
-        addAllInterfaceTypes(results, superType,
-                interfaceTypesOf(superType),
-                false, configuration);
-    }
-
-    private static void addAllInterfaceTypes(Map<ClassDoc,Type> results, Type type,
-            Type[] interfaceTypes, boolean raw,
-            Configuration configuration) {
-        for (Type interfaceType : interfaceTypes) {
-            ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
-            if (!(interfaceClassDoc.isPublic() ||
-                  (configuration != null &&
-                   isLinkable(interfaceClassDoc, configuration)))) {
-                continue;
-            }
-            if (raw)
-                interfaceType = interfaceType.asClassDoc();
-            results.put(interfaceClassDoc, interfaceType);
-            List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration);
-            for (Type superInterface : superInterfaces) {
-                results.put(superInterface.asClassDoc(), superInterface);
-            }
-        }
-        if (type instanceof AnnotatedType)
-            type = ((AnnotatedType)type).underlyingType();
-
-        if (type instanceof ParameterizedType)
-            findAllInterfaceTypes(results, (ParameterizedType) type, configuration);
-        else if (((ClassDoc) type).typeParameters().length == 0)
-            findAllInterfaceTypes(results, (ClassDoc) type, raw, configuration);
-        else
-            findAllInterfaceTypes(results, (ClassDoc) type, true, configuration);
-    }
-
-    /**
-     * Enclose in quotes, used for paths and filenames that contains spaces
-     */
-    public static String quote(String filepath) {
-        return ("\"" + filepath + "\"");
-    }
-
-    /**
-     * Given a package, return its name.
-     * @param packageDoc the package to check.
-     * @return the name of the given package.
-     */
-    public static String getPackageName(PackageDoc packageDoc) {
-        return packageDoc == null || packageDoc.name().length() == 0 ?
-            DocletConstants.DEFAULT_PACKAGE_NAME : packageDoc.name();
-    }
-
-    /**
-     * Given a package, return its file name without the extension.
-     * @param packageDoc the package to check.
-     * @return the file name of the given package.
-     */
-    public static String getPackageFileHeadName(PackageDoc packageDoc) {
-        return packageDoc == null || packageDoc.name().length() == 0 ?
-            DocletConstants.DEFAULT_PACKAGE_FILE_NAME : packageDoc.name();
-    }
-
-    /**
-     * Given a string, replace all occurrences of 'newStr' with 'oldStr'.
-     * @param originalStr the string to modify.
-     * @param oldStr the string to replace.
-     * @param newStr the string to insert in place of the old string.
-     */
-    public static String replaceText(String originalStr, String oldStr,
-            String newStr) {
-        if (oldStr == null || newStr == null || oldStr.equals(newStr)) {
-            return originalStr;
-        }
-        return originalStr.replace(oldStr, newStr);
-    }
-
-    /**
-     * Given an annotation, return true if it should be documented and false
-     * otherwise.
-     *
-     * @param annotationDoc the annotation to check.
-     *
-     * @return true return true if it should be documented and false otherwise.
-     */
-    public static boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) {
-        for (AnnotationDesc anno : annotationDoc.annotations()) {
-            if (anno.annotationType().qualifiedName().equals(
-                    Documented.class.getName())) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private static boolean isDeclarationTarget(AnnotationDesc targetAnno) {
-        // The error recovery steps here are analogous to TypeAnnotations
-        ElementValuePair[] elems = targetAnno.elementValues();
-        if (elems == null
-            || elems.length != 1
-            || !"value".equals(elems[0].element().name())
-            || !(elems[0].value().value() instanceof AnnotationValue[]))
-            return true;    // error recovery
-
-        for (AnnotationValue aValue : (AnnotationValue[])elems[0].value().value()) {
-            Object value = aValue.value();
-            if (!(value instanceof FieldDoc))
-                return true; // error recovery
-
-            FieldDoc eValue = (FieldDoc) value;
-            if (Util.isJava5DeclarationElementType(eValue)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /**
-     * Returns true if the {@code annotationDoc} is to be treated
-     * as a declaration annotation, when targeting the
-     * {@code elemType} element type.
-     *
-     * @param annotationDoc the annotationDoc to check
-     * @param elemType  the targeted elemType
-     * @return true if annotationDoc is a declaration annotation
-     */
-    public static boolean isDeclarationAnnotation(AnnotationTypeDoc annotationDoc,
-            boolean isJava5DeclarationLocation) {
-        if (!isJava5DeclarationLocation)
-            return false;
-        AnnotationDesc[] annotationDescList = annotationDoc.annotations();
-        // Annotations with no target are treated as declaration as well
-        if (annotationDescList.length==0)
-            return true;
-        for (AnnotationDesc anno : annotationDescList) {
-            if (anno.annotationType().qualifiedName().equals(
-                    Target.class.getName())) {
-                if (isDeclarationTarget(anno))
-                    return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Return true if this class is linkable and false if we can't link to the
-     * desired class.
-     * <br>
-     * <b>NOTE:</b>  You can only link to external classes if they are public or
-     * protected.
-     *
-     * @param classDoc the class to check.
-     * @param configuration the current configuration of the doclet.
-     *
-     * @return true if this class is linkable and false if we can't link to the
-     * desired class.
-     */
-    public static boolean isLinkable(ClassDoc classDoc,
-            Configuration configuration) {
-        return
-            ((classDoc.isIncluded() && configuration.isGeneratedDoc(classDoc))) ||
-            (configuration.extern.isExternal(classDoc) &&
-                (classDoc.isPublic() || classDoc.isProtected()));
-    }
-
-    /**
-     * Given a class, return the closest visible super class.
-     *
-     * @param classDoc the class we are searching the parent for.
-     * @param configuration the current configuration of the doclet.
-     * @return the closest visible super class.  Return null if it cannot
-     *         be found (i.e. classDoc is java.lang.Object).
-     */
-    public static Type getFirstVisibleSuperClass(ClassDoc classDoc,
-            Configuration configuration) {
-        if (classDoc == null) {
-            return null;
-        }
-        Type sup = classDoc.superclassType();
-        ClassDoc supClassDoc = classDoc.superclass();
-        while (sup != null &&
-                  (! (supClassDoc.isPublic() ||
-                              isLinkable(supClassDoc, configuration))) ) {
-            if (supClassDoc.superclass().qualifiedName().equals(supClassDoc.qualifiedName()))
-                break;
-            sup = supClassDoc.superclassType();
-            supClassDoc = supClassDoc.superclass();
-        }
-        if (classDoc.equals(supClassDoc)) {
-            return null;
-        }
-        return sup;
-    }
-
-    /**
-     * Given a class, return the closest visible super class.
-     *
-     * @param classDoc the class we are searching the parent for.
-     * @param configuration the current configuration of the doclet.
-     * @return the closest visible super class.  Return null if it cannot
-     *         be found (i.e. classDoc is java.lang.Object).
-     */
-    public static ClassDoc getFirstVisibleSuperClassCD(ClassDoc classDoc,
-            Configuration configuration) {
-        if (classDoc == null) {
-            return null;
-        }
-        ClassDoc supClassDoc = classDoc.superclass();
-        while (supClassDoc != null &&
-                  (! (supClassDoc.isPublic() ||
-                              isLinkable(supClassDoc, configuration))) ) {
-            supClassDoc = supClassDoc.superclass();
-        }
-        if (classDoc.equals(supClassDoc)) {
-            return null;
-        }
-        return supClassDoc;
-    }
-
-    /**
-     * Given a ClassDoc, return the name of its type (Class, Interface, etc.).
-     *
-     * @param cd the ClassDoc to check.
-     * @param lowerCaseOnly true if you want the name returned in lower case.
-     *                      If false, the first letter of the name is capitalized.
-     * @return
-     */
-    public static String getTypeName(Configuration config,
-        ClassDoc cd, boolean lowerCaseOnly) {
-        String typeName = "";
-        if (cd.isOrdinaryClass()) {
-            typeName = "doclet.Class";
-        } else if (cd.isInterface()) {
-            typeName = "doclet.Interface";
-        } else if (cd.isException()) {
-            typeName = "doclet.Exception";
-        } else if (cd.isError()) {
-            typeName = "doclet.Error";
-        } else if (cd.isAnnotationType()) {
-            typeName = "doclet.AnnotationType";
-        } else if (cd.isEnum()) {
-            typeName = "doclet.Enum";
-        }
-        return config.getText(
-            lowerCaseOnly ? StringUtils.toLowerCase(typeName) : typeName);
-    }
-
-    /**
-     * Replace all tabs in a string with the appropriate number of spaces.
-     * The string may be a multi-line string.
-     * @param configuration the doclet configuration defining the setting for the
-     *                      tab length.
-     * @param text the text for which the tabs should be expanded
-     * @return the text with all tabs expanded
-     */
-    public static String replaceTabs(Configuration configuration, String text) {
-        if (!text.contains("\t"))
-            return text;
-
-        final int tabLength = configuration.sourcetab;
-        final String whitespace = configuration.tabSpaces;
-        final int textLength = text.length();
-        StringBuilder result = new StringBuilder(textLength);
-        int pos = 0;
-        int lineLength = 0;
-        for (int i = 0; i < textLength; i++) {
-            char ch = text.charAt(i);
-            switch (ch) {
-                case '\n': case '\r':
-                    lineLength = 0;
-                    break;
-                case '\t':
-                    result.append(text, pos, i);
-                    int spaceCount = tabLength - lineLength % tabLength;
-                    result.append(whitespace, 0, spaceCount);
-                    lineLength += spaceCount;
-                    pos = i + 1;
-                    break;
-                default:
-                    lineLength++;
-            }
-        }
-        result.append(text, pos, textLength);
-        return result.toString();
-    }
-
-    public static String normalizeNewlines(String text) {
-        StringBuilder sb = new StringBuilder();
-        final int textLength = text.length();
-        final String NL = DocletConstants.NL;
-        int pos = 0;
-        for (int i = 0; i < textLength; i++) {
-            char ch = text.charAt(i);
-            switch (ch) {
-                case '\n':
-                    sb.append(text, pos, i);
-                    sb.append(NL);
-                    pos = i + 1;
-                    break;
-                case '\r':
-                    sb.append(text, pos, i);
-                    sb.append(NL);
-                    if (i + 1 < textLength && text.charAt(i + 1) == '\n')
-                        i++;
-                    pos = i + 1;
-                    break;
-            }
-        }
-        sb.append(text, pos, textLength);
-        return sb.toString();
-    }
-
-    /**
-     * The documentation for values() and valueOf() in Enums are set by the
-     * doclet.
-     */
-    public static void setEnumDocumentation(Configuration configuration,
-            ClassDoc classDoc) {
-        for (MethodDoc currentMethod : classDoc.methods()) {
-            if (currentMethod.name().equals("values") &&
-                currentMethod.parameters().length == 0) {
-                StringBuilder sb = new StringBuilder();
-                sb.append(configuration.getText("doclet.enum_values_doc.main", classDoc.name()));
-                sb.append("\n@return ");
-                sb.append(configuration.getText("doclet.enum_values_doc.return"));
-                currentMethod.setRawCommentText(sb.toString());
-            } else if (currentMethod.name().equals("valueOf") &&
-                     currentMethod.parameters().length == 1) {
-                Type paramType = currentMethod.parameters()[0].type();
-                if (paramType != null &&
-                    paramType.qualifiedTypeName().equals(String.class.getName())) {
-                    StringBuilder sb = new StringBuilder();
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
-                    sb.append("\n@param name ");
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
-                    sb.append("\n@return ");
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
-                    sb.append("\n@throws IllegalArgumentException ");
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
-                    sb.append("\n@throws NullPointerException ");
-                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
-                    currentMethod.setRawCommentText(sb.toString());
-                }
-            }
-        }
-    }
-
-    /**
-     *  Return true if the given Doc is deprecated.
-     *
-     * @param doc the Doc to check.
-     * @return true if the given Doc is deprecated.
-     */
-    public static boolean isDeprecated(Doc doc) {
-        if (doc.tags("deprecated").length > 0) {
-            return true;
-        }
-        AnnotationDesc[] annotationDescList;
-        if (doc instanceof PackageDoc)
-            annotationDescList = ((PackageDoc)doc).annotations();
-        else
-            annotationDescList = ((ProgramElementDoc)doc).annotations();
-        for (AnnotationDesc anno : annotationDescList) {
-            if (anno.annotationType().qualifiedName().equals(
-                    Deprecated.class.getName())) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * A convenience method to get property name from the name of the
-     * getter or setter method.
-     * @param name name of the getter or setter method.
-     * @return the name of the property of the given setter of getter.
-     */
-    public static String propertyNameFromMethodName(Configuration configuration, String name) {
-        String propertyName = null;
-        if (name.startsWith("get") || name.startsWith("set")) {
-            propertyName = name.substring(3);
-        } else if (name.startsWith("is")) {
-            propertyName = name.substring(2);
-        }
-        if ((propertyName == null) || propertyName.isEmpty()){
-            return "";
-        }
-        return propertyName.substring(0, 1).toLowerCase(configuration.getLocale())
-                + propertyName.substring(1);
-    }
-
-    /**
-     * In case of JavaFX mode on, filters out classes that are private,
-     * package private or having the @treatAsPrivate annotation. Those are not
-     * documented in JavaFX mode.
-     *
-     * @param classes array of classes to be filtered.
-     * @param javafx set to true if in JavaFX mode.
-     * @return list of filtered classes.
-     */
-    public static ClassDoc[] filterOutPrivateClasses(final ClassDoc[] classes,
-                                                     boolean javafx) {
-        if (!javafx) {
-            return classes;
-        }
-        final List<ClassDoc> filteredOutClasses = new ArrayList<>(classes.length);
-        for (ClassDoc classDoc : classes) {
-            if (classDoc.isPrivate() || classDoc.isPackagePrivate()) {
-                continue;
-            }
-            Tag[] aspTags = classDoc.tags("treatAsPrivate");
-            if (aspTags != null && aspTags.length > 0) {
-                continue;
-            }
-            filteredOutClasses.add(classDoc);
-        }
-
-        return filteredOutClasses.toArray(new ClassDoc[0]);
-    }
-
-    /**
-     * Test whether the given FieldDoc is one of the declaration annotation ElementTypes
-     * defined in Java 5.
-     * Instead of testing for one of the new enum constants added in Java 8, test for
-     * the old constants. This prevents bootstrapping problems.
-     *
-     * @param elt The FieldDoc to test
-     * @return true, iff the given ElementType is one of the constants defined in Java 5
-     * @since 1.8
-     */
-    public static boolean isJava5DeclarationElementType(FieldDoc elt) {
-        return elt.name().contentEquals(ElementType.ANNOTATION_TYPE.name()) ||
-                elt.name().contentEquals(ElementType.CONSTRUCTOR.name()) ||
-                elt.name().contentEquals(ElementType.FIELD.name()) ||
-                elt.name().contentEquals(ElementType.LOCAL_VARIABLE.name()) ||
-                elt.name().contentEquals(ElementType.METHOD.name()) ||
-                elt.name().contentEquals(ElementType.PACKAGE.name()) ||
-                elt.name().contentEquals(ElementType.PARAMETER.name()) ||
-                elt.name().contentEquals(ElementType.TYPE.name());
-    }
-
-    /**
-     * A general purpose case insensitive String comparator, which compares two Strings using a Collator
-     * strength of "TERTIARY".
-     *
-     * @param s1 first String to compare.
-     * @param s2 second String to compare.
-     * @return a negative integer, zero, or a positive integer as the first
-     *         argument is less than, equal to, or greater than the second.
-     */
-    public static int compareStrings(String s1, String s2) {
-        return compareStrings(true, s1, s2);
-    }
-    /**
-     * A general purpose case sensitive String comparator, which compares two Strings using a Collator
-     * strength of "SECONDARY".
-     *
-     * @param s1 first String to compare.
-     * @param s2 second String to compare.
-     * @return a negative integer, zero, or a positive integer as the first
-     *         argument is less than, equal to, or greater than the second.
-     */
-    public static int compareCaseCompare(String s1, String s2) {
-        return compareStrings(false, s1, s2);
-    }
-    private static int compareStrings(boolean caseSensitive, String s1, String s2) {
-        Collator collator = Collator.getInstance();
-        collator.setStrength(caseSensitive ? Collator.TERTIARY : Collator.SECONDARY);
-        return collator.compare(s1, s2);
-    }
-
-    /**
-     * A comparator for index file presentations,
-     *  1. this sorts first on simple names
-     *  2. if equal, then compare the DocKind ex: Package, Interface etc.
-     *  3a. if equal and if the type is of ExecutableMemberDoc(Constructor, Fields),
-     *      a case insensitive comparison of parameter types
-     *  3b. if equal, a case sensitive comparison of parameter types
-     *  4. finally, if equal, compare the FQNs of the entities
-     * @return a comparator for index file use
-     */
-    public static Comparator<Doc> makeComparatorForIndexUse() {
-        return new Util.DocComparator<Doc>() {
-            /**
-             * Compare two given Doc entities, first sort on name, then on the kinds,
-             * then on the parameters only if the type is an instance of ExecutableMemberDocs,
-             * the parameters are compared ignoring the case first, then a case sensitive comparison,
-             * and finally the fully qualified names.
-             *
-             * @param d1 - a Doc element.
-             * @param d2 - a Doc element.
-             * @return a negative integer, zero, or a positive integer as the first
-             *         argument is less than, equal to, or greater than the second.
-             */
-            public int compare(Doc d1, Doc d2) {
-                int result = compareNames(d1, d2);
-                if (result != 0) {
-                    return result;
-                }
-                result = compareDocKinds(d1, d2);
-                if (result != 0) {
-                    return result;
-                }
-                if (hasParameters(d1)) {
-                    Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters();
-                    Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters();
-                    result = compareParameters(false, param1, param2);
-                    if (result != 0) {
-                        return result;
-                    }
-                    result = compareParameters(true, param1, param2);
-                    if (result != 0) {
-                        return result;
-                    }
-                }
-                return compareFullyQualifiedNames(d1, d2);
-            }
-        };
-    }
-    /**
-     * Comparator for ClassUse presentations, and sorts as follows:
-     * 1. member names
-     * 2. then fully qualified member names
-     * 3. then parameter types if applicable
-     * 4. finally the Doc kinds ie. package, class, interface etc.
-     * @return a comparator to sort classes and members for class use
-     */
-    public static Comparator<Doc> makeComparatorForClassUse() {
-        return new Util.DocComparator<Doc>() {
-            /**
-             * Compare two given Doc entities, first sort on name, and if
-             * applicable on the fully qualified name, and if applicable
-             * on the parameter types, and finally the DocKind.
-             * @param d1 - a Doc element.
-             * @param d2 - a Doc element.
-             * @return a negative integer, zero, or a positive integer as the first
-             *         argument is less than, equal to, or greater than the second.
-             */
-            public int compare(Doc d1, Doc d2) {
-                int result = compareNames(d1, d2);
-                if (result != 0) {
-                    return result;
-                }
-                result = compareFullyQualifiedNames(d1, d2);
-                if (result != 0) {
-                    return result;
-                }
-                if (hasParameters(d1) && hasParameters(d2)) {
-                    Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters();
-                    Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters();
-                    result = compareParameters(false, param1, param2);
-                    if (result != 0) {
-                        return result;
-                    }
-                    return compareParameters(true, param1, param2);
-                }
-                return compareDocKinds(d1, d2);
-            }
-        };
-    }
-    /**
-     * A general purpose comparator to sort Doc entities, basically provides the building blocks
-     * for creating specific comparators for an use-case.
-     * @param <T> a Doc entity
-     */
-    static abstract class DocComparator<T extends Doc> implements Comparator<Doc> {
-        static enum DocKind {
-           PACKAGE,
-           CLASS,
-           ENUM,
-           INTERFACE,
-           ANNOTATION,
-           FIELD,
-           CONSTRUCTOR,
-           METHOD
-        };
-        boolean hasParameters(Doc d) {
-            return d instanceof ExecutableMemberDoc;
-        }
-        DocKind getDocKind(Doc d) {
-            if (d.isAnnotationType() || d.isAnnotationTypeElement()) {
-                return DocKind.ANNOTATION;
-            } else if (d.isEnum() || d.isEnumConstant()) {
-                return DocKind.ENUM;
-            } else if (d.isField()) {
-                return DocKind.FIELD;
-            } else if (d.isInterface()) {
-                return DocKind.INTERFACE;
-            } else if (d.isClass()) {
-                return DocKind.CLASS;
-            } else if (d.isConstructor()) {
-                return DocKind.CONSTRUCTOR;
-            } else if (d.isMethod()) {
-                return DocKind.METHOD;
-            } else {
-                return DocKind.PACKAGE;
-            }
-        }
-        /**
-         * Compares two Doc entities' kinds, and these are ordered as defined in
-         * the DocKind enumeration.
-         * @param d1 the first Doc object
-         * @param d2 the second Doc object
-         * @return a negative integer, zero, or a positive integer as the first
-         *         argument is less than, equal to, or greater than the second.
-         */
-        protected int compareDocKinds(Doc d1, Doc d2) {
-            return getDocKind(d1).compareTo(getDocKind(d2));
-        }
-        /**
-         * Compares two parameter arrays by comparing each Type of the parameter in the array,
-         * and as many as possible, otherwise compare their lengths.
-         * @param ignoreCase specifies case sensitive or insensitive comparison.
-         * @param params1 the first parameter array.
-         * @param params2 the first parameter array.
-         * @return a negative integer, zero, or a positive integer as the first
-         *         argument is less than, equal to, or greater than the second.
-         */
-        protected int compareParameters(boolean ignoreCase, Parameter[] params1, Parameter[] params2) {
-            // try to compare as many as possible
-            for (int i = 0; i < params1.length && i < params2.length; i++) {
-                int result = compareStrings(ignoreCase, params1[i].typeName(), params2[i].typeName());
-                if (result != 0) {
-                    return result;
-                }
-            }
-            return Integer.compare(params1.length, params2.length);
-        }
-
-        /**
-         * Compares two Doc entities typically the simple name of a method,
-         * field, constructor etc.
-         * @param d1 the first Doc.
-         * @param d2 the second Doc.
-         * @return a negative integer, zero, or a positive integer as the first
-         *         argument is less than, equal to, or greater than the second.
-         */
-        protected int compareNames(Doc d1, Doc d2) {
-            return compareStrings(d1.name(), d2.name());
-        }
-
-        /**
-         * Compares the fully qualified names of the entities
-         * @param d1 the first entity
-         * @param d2 the second entity
-         * @return a negative integer, zero, or a positive integer as the first
-         *         argument is less than, equal to, or greater than the second.
-         */
-        protected int compareFullyQualifiedNames(Doc d1, Doc d2) {
-            String name1 = (d1 instanceof ProgramElementDoc)
-                    ? ((ProgramElementDoc)d1).qualifiedName()
-                    : d1.name();
-            String name2 = (d2 instanceof ProgramElementDoc)
-                    ? ((ProgramElementDoc)d2).qualifiedName()
-                    : d2.name();
-            return compareStrings(name1, name2);
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,1018 @@
+/*
+ * Copyright (c) 1999, 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.tools.doclets.internal.toolkit.util;
+
+import java.io.*;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.text.Collator;
+import java.util.*;
+
+import javax.tools.StandardLocation;
+
+import com.sun.javadoc.*;
+import com.sun.javadoc.AnnotationDesc.ElementValuePair;
+import com.sun.tools.doclets.internal.toolkit.*;
+import com.sun.tools.javac.util.StringUtils;
+
+/**
+ * Utilities Class for Doclets.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ *
+ * @author Atul M Dambalkar
+ * @author Jamie Ho
+ */
+public class Utils {
+    /**
+     * Return array of class members whose documentation is to be generated.
+     * If the member is deprecated do not include such a member in the
+     * returned array.
+     *
+     * @param  members             Array of members to choose from.
+     * @return ProgramElementDoc[] Array of eligible members for whom
+     *                             documentation is getting generated.
+     */
+    public ProgramElementDoc[] excludeDeprecatedMembers(
+        ProgramElementDoc[] members) {
+        return
+            toProgramElementDocArray(excludeDeprecatedMembersAsList(members));
+    }
+
+    /**
+     * Return array of class members whose documentation is to be generated.
+     * If the member is deprecated do not include such a member in the
+     * returned array.
+     *
+     * @param  members    Array of members to choose from.
+     * @return List       List of eligible members for whom
+     *                    documentation is getting generated.
+     */
+    public List<ProgramElementDoc> excludeDeprecatedMembersAsList(
+        ProgramElementDoc[] members) {
+        List<ProgramElementDoc> list = new ArrayList<>();
+        for (ProgramElementDoc member : members) {
+            if (member.tags("deprecated").length == 0) {
+                list.add(member);
+            }
+        }
+        Collections.sort(list);
+        return list;
+    }
+
+    /**
+     * Return the list of ProgramElementDoc objects as Array.
+     */
+    public ProgramElementDoc[] toProgramElementDocArray(List<ProgramElementDoc> list) {
+        ProgramElementDoc[] pgmarr = new ProgramElementDoc[list.size()];
+        for (int i = 0; i < list.size(); i++) {
+            pgmarr[i] = list.get(i);
+        }
+        return pgmarr;
+    }
+
+    /**
+     * Return true if a non-public member found in the given array.
+     *
+     * @param  members Array of members to look into.
+     * @return boolean True if non-public member found, false otherwise.
+     */
+    public boolean nonPublicMemberFound(ProgramElementDoc[] members) {
+        for (ProgramElementDoc member : members) {
+            if (!member.isPublic()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Search for the given method in the given class.
+     *
+     * @param  cd        Class to search into.
+     * @param  method    Method to be searched.
+     * @return MethodDoc Method found, null otherwise.
+     */
+    public MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
+        MethodDoc[] methods = cd.methods();
+        for (MethodDoc m : methods) {
+            if (executableMembersEqual(method, m)) {
+                return m;
+
+            }
+        }
+        return null;
+    }
+
+    /**
+     * @param member1 the first method to compare.
+     * @param member2 the second method to compare.
+     * @return true if member1 overrides/hides or is overriden/hidden by member2.
+     */
+    public boolean executableMembersEqual(ExecutableMemberDoc member1,
+            ExecutableMemberDoc member2) {
+        if (! (member1 instanceof MethodDoc && member2 instanceof MethodDoc))
+            return false;
+
+        MethodDoc method1 = (MethodDoc) member1;
+        MethodDoc method2 = (MethodDoc) member2;
+        if (method1.isStatic() && method2.isStatic()) {
+            Parameter[] targetParams = method1.parameters();
+            Parameter[] currentParams;
+            if (method1.name().equals(method2.name()) &&
+                   (currentParams = method2.parameters()).length ==
+                targetParams.length) {
+                int j;
+                for (j = 0; j < targetParams.length; j++) {
+                    if (! (targetParams[j].typeName().equals(
+                              currentParams[j].typeName()) ||
+                                   currentParams[j].type() instanceof TypeVariable ||
+                                   targetParams[j].type() instanceof TypeVariable)) {
+                        break;
+                    }
+                }
+                if (j == targetParams.length) {
+                    return true;
+                }
+            }
+            return false;
+        } else {
+                return method1.overrides(method2) ||
+                method2.overrides(method1) ||
+                                member1 == member2;
+        }
+    }
+
+    /**
+     * According to
+     * <cite>The Java&trade; Language Specification</cite>,
+     * all the outer classes and static inner classes are core classes.
+     */
+    public boolean isCoreClass(ClassDoc cd) {
+        return cd.containingClass() == null || cd.isStatic();
+    }
+
+    public boolean matches(ProgramElementDoc doc1,
+            ProgramElementDoc doc2) {
+        if (doc1 instanceof ExecutableMemberDoc &&
+            doc2 instanceof ExecutableMemberDoc) {
+            ExecutableMemberDoc ed1 = (ExecutableMemberDoc)doc1;
+            ExecutableMemberDoc ed2 = (ExecutableMemberDoc)doc2;
+            return executableMembersEqual(ed1, ed2);
+        } else {
+            return doc1.name().equals(doc2.name());
+        }
+    }
+
+    /**
+     * Copy the given directory contents from the source package directory
+     * to the generated documentation directory. For example for a package
+     * java.lang this method find out the source location of the package using
+     * {@link SourcePath} and if given directory is found in the source
+     * directory structure, copy the entire directory, to the generated
+     * documentation hierarchy.
+     *
+     * @param configuration The configuration of the current doclet.
+     * @param path The relative path to the directory to be copied.
+     * @param dir The original directory name to copy from.
+     * @param overwrite Overwrite files if true.
+     */
+    public void copyDocFiles(Configuration configuration, PackageDoc pd) {
+        copyDocFiles(configuration, DocPath.forPackage(pd).resolve(DocPaths.DOC_FILES));
+    }
+
+    public void copyDocFiles(Configuration configuration, DocPath dir) {
+        try {
+            boolean first = true;
+            for (DocFile f : DocFile.list(configuration, StandardLocation.SOURCE_PATH, dir)) {
+                if (!f.isDirectory()) {
+                    continue;
+                }
+                DocFile srcdir = f;
+                DocFile destdir = DocFile.createFileForOutput(configuration, dir);
+                if (srcdir.isSameFile(destdir)) {
+                    continue;
+                }
+
+                for (DocFile srcfile: srcdir.list()) {
+                    DocFile destfile = destdir.resolve(srcfile.getName());
+                    if (srcfile.isFile()) {
+                        if (destfile.exists() && !first) {
+                            configuration.message.warning((SourcePosition) null,
+                                    "doclet.Copy_Overwrite_warning",
+                                    srcfile.getPath(), destdir.getPath());
+                        } else {
+                            configuration.message.notice(
+                                    "doclet.Copying_File_0_To_Dir_1",
+                                    srcfile.getPath(), destdir.getPath());
+                            destfile.copyFile(srcfile);
+                        }
+                    } else if (srcfile.isDirectory()) {
+                        if (configuration.copydocfilesubdirs
+                                && !configuration.shouldExcludeDocFileDir(srcfile.getName())) {
+                            copyDocFiles(configuration, dir.resolve(srcfile.getName()));
+                        }
+                    }
+                }
+
+                first = false;
+            }
+        } catch (SecurityException | IOException exc) {
+            throw new DocletAbortException(exc);
+        }
+    }
+
+    /**
+     * We want the list of types in alphabetical order.  However, types are not
+     * comparable.  We need a comparator for now.
+     */
+    private static class TypeComparator implements Comparator<Type> {
+        public int compare(Type type1, Type type2) {
+            return type1.qualifiedTypeName().compareToIgnoreCase(
+                type2.qualifiedTypeName());
+        }
+    }
+
+    /**
+     * For the class return all implemented interfaces including the
+     * superinterfaces of the implementing interfaces, also iterate over for
+     * all the superclasses. For interface return all the extended interfaces
+     * as well as superinterfaces for those extended interfaces.
+     *
+     * @param  type       type whose implemented or
+     *                    super interfaces are sought.
+     * @param  configuration the current configuration of the doclet.
+     * @param  sort if true, return list of interfaces sorted alphabetically.
+     * @return List of all the required interfaces.
+     */
+    public List<Type> getAllInterfaces(Type type,
+            Configuration configuration, boolean sort) {
+        Map<ClassDoc,Type> results = sort ?
+                new TreeMap<ClassDoc,Type>() :
+                new LinkedHashMap<ClassDoc,Type>();
+        Type[] interfaceTypes = null;
+        Type superType = null;
+        if (type instanceof ParameterizedType) {
+            interfaceTypes = ((ParameterizedType) type).interfaceTypes();
+            superType = ((ParameterizedType) type).superclassType();
+        } else if (type instanceof ClassDoc) {
+            interfaceTypes = ((ClassDoc) type).interfaceTypes();
+            superType = ((ClassDoc) type).superclassType();
+        } else {
+            interfaceTypes = type.asClassDoc().interfaceTypes();
+            superType = type.asClassDoc().superclassType();
+        }
+
+        for (Type interfaceType : interfaceTypes) {
+            ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
+            if (!(interfaceClassDoc.isPublic() ||
+                  (configuration == null ||
+                   isLinkable(interfaceClassDoc, configuration)))) {
+                continue;
+            }
+            results.put(interfaceClassDoc, interfaceType);
+            for (Type t : getAllInterfaces(interfaceType, configuration, sort)) {
+                results.put(t.asClassDoc(), t);
+            }
+        }
+        if (superType == null)
+            return new ArrayList<>(results.values());
+        //Try walking the tree.
+        addAllInterfaceTypes(results,
+            superType,
+            interfaceTypesOf(superType),
+            false, configuration);
+        List<Type> resultsList = new ArrayList<>(results.values());
+        if (sort) {
+                Collections.sort(resultsList, new TypeComparator());
+        }
+        return resultsList;
+    }
+
+    private Type[] interfaceTypesOf(Type type) {
+        if (type instanceof AnnotatedType)
+            type = ((AnnotatedType)type).underlyingType();
+        return type instanceof ClassDoc ?
+                ((ClassDoc)type).interfaceTypes() :
+                ((ParameterizedType)type).interfaceTypes();
+    }
+
+    public List<Type> getAllInterfaces(Type type, Configuration configuration) {
+        return getAllInterfaces(type, configuration, true);
+    }
+
+    private void findAllInterfaceTypes(Map<ClassDoc,Type> results, ClassDoc c, boolean raw,
+            Configuration configuration) {
+        Type superType = c.superclassType();
+        if (superType == null)
+            return;
+        addAllInterfaceTypes(results, superType,
+                interfaceTypesOf(superType),
+                raw, configuration);
+    }
+
+    private void findAllInterfaceTypes(Map<ClassDoc,Type> results, ParameterizedType p,
+            Configuration configuration) {
+        Type superType = p.superclassType();
+        if (superType == null)
+            return;
+        addAllInterfaceTypes(results, superType,
+                interfaceTypesOf(superType),
+                false, configuration);
+    }
+
+    private void addAllInterfaceTypes(Map<ClassDoc,Type> results, Type type,
+            Type[] interfaceTypes, boolean raw,
+            Configuration configuration) {
+        for (Type interfaceType : interfaceTypes) {
+            ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
+            if (!(interfaceClassDoc.isPublic() ||
+                  (configuration != null &&
+                   isLinkable(interfaceClassDoc, configuration)))) {
+                continue;
+            }
+            if (raw)
+                interfaceType = interfaceType.asClassDoc();
+            results.put(interfaceClassDoc, interfaceType);
+            List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration);
+            for (Type superInterface : superInterfaces) {
+                results.put(superInterface.asClassDoc(), superInterface);
+            }
+        }
+        if (type instanceof AnnotatedType)
+            type = ((AnnotatedType)type).underlyingType();
+
+        if (type instanceof ParameterizedType)
+            findAllInterfaceTypes(results, (ParameterizedType) type, configuration);
+        else if (((ClassDoc) type).typeParameters().length == 0)
+            findAllInterfaceTypes(results, (ClassDoc) type, raw, configuration);
+        else
+            findAllInterfaceTypes(results, (ClassDoc) type, true, configuration);
+    }
+
+    /**
+     * Enclose in quotes, used for paths and filenames that contains spaces
+     */
+    public String quote(String filepath) {
+        return ("\"" + filepath + "\"");
+    }
+
+    /**
+     * Given a package, return its name.
+     * @param packageDoc the package to check.
+     * @return the name of the given package.
+     */
+    public String getPackageName(PackageDoc packageDoc) {
+        return packageDoc == null || packageDoc.name().length() == 0 ?
+            DocletConstants.DEFAULT_PACKAGE_NAME : packageDoc.name();
+    }
+
+    /**
+     * Given a package, return its file name without the extension.
+     * @param packageDoc the package to check.
+     * @return the file name of the given package.
+     */
+    public String getPackageFileHeadName(PackageDoc packageDoc) {
+        return packageDoc == null || packageDoc.name().length() == 0 ?
+            DocletConstants.DEFAULT_PACKAGE_FILE_NAME : packageDoc.name();
+    }
+
+    /**
+     * Given a string, replace all occurrences of 'newStr' with 'oldStr'.
+     * @param originalStr the string to modify.
+     * @param oldStr the string to replace.
+     * @param newStr the string to insert in place of the old string.
+     */
+    public String replaceText(String originalStr, String oldStr,
+            String newStr) {
+        if (oldStr == null || newStr == null || oldStr.equals(newStr)) {
+            return originalStr;
+        }
+        return originalStr.replace(oldStr, newStr);
+    }
+
+    /**
+     * Given an annotation, return true if it should be documented and false
+     * otherwise.
+     *
+     * @param annotationDoc the annotation to check.
+     *
+     * @return true return true if it should be documented and false otherwise.
+     */
+    public boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) {
+        for (AnnotationDesc anno : annotationDoc.annotations()) {
+            if (anno.annotationType().qualifiedName().equals(
+                    Documented.class.getName())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private boolean isDeclarationTarget(AnnotationDesc targetAnno) {
+        // The error recovery steps here are analogous to TypeAnnotations
+        ElementValuePair[] elems = targetAnno.elementValues();
+        if (elems == null
+            || elems.length != 1
+            || !"value".equals(elems[0].element().name())
+            || !(elems[0].value().value() instanceof AnnotationValue[]))
+            return true;    // error recovery
+
+        for (AnnotationValue aValue : (AnnotationValue[])elems[0].value().value()) {
+            Object value = aValue.value();
+            if (!(value instanceof FieldDoc))
+                return true; // error recovery
+
+            FieldDoc eValue = (FieldDoc) value;
+            if (isJava5DeclarationElementType(eValue)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Returns true if the {@code annotationDoc} is to be treated
+     * as a declaration annotation, when targeting the
+     * {@code elemType} element type.
+     *
+     * @param annotationDoc the annotationDoc to check
+     * @param elemType  the targeted elemType
+     * @return true if annotationDoc is a declaration annotation
+     */
+    public boolean isDeclarationAnnotation(AnnotationTypeDoc annotationDoc,
+            boolean isJava5DeclarationLocation) {
+        if (!isJava5DeclarationLocation)
+            return false;
+        AnnotationDesc[] annotationDescList = annotationDoc.annotations();
+        // Annotations with no target are treated as declaration as well
+        if (annotationDescList.length==0)
+            return true;
+        for (AnnotationDesc anno : annotationDescList) {
+            if (anno.annotationType().qualifiedName().equals(
+                    Target.class.getName())) {
+                if (isDeclarationTarget(anno))
+                    return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Return true if this class is linkable and false if we can't link to the
+     * desired class.
+     * <br>
+     * <b>NOTE:</b>  You can only link to external classes if they are public or
+     * protected.
+     *
+     * @param classDoc the class to check.
+     * @param configuration the current configuration of the doclet.
+     *
+     * @return true if this class is linkable and false if we can't link to the
+     * desired class.
+     */
+    public boolean isLinkable(ClassDoc classDoc,
+            Configuration configuration) {
+        return
+            ((classDoc.isIncluded() && configuration.isGeneratedDoc(classDoc))) ||
+            (configuration.extern.isExternal(classDoc) &&
+                (classDoc.isPublic() || classDoc.isProtected()));
+    }
+
+    /**
+     * Given a class, return the closest visible super class.
+     *
+     * @param classDoc the class we are searching the parent for.
+     * @param configuration the current configuration of the doclet.
+     * @return the closest visible super class.  Return null if it cannot
+     *         be found (i.e. classDoc is java.lang.Object).
+     */
+    public Type getFirstVisibleSuperClass(ClassDoc classDoc,
+            Configuration configuration) {
+        if (classDoc == null) {
+            return null;
+        }
+        Type sup = classDoc.superclassType();
+        ClassDoc supClassDoc = classDoc.superclass();
+        while (sup != null &&
+                  (! (supClassDoc.isPublic() ||
+                              isLinkable(supClassDoc, configuration))) ) {
+            if (supClassDoc.superclass().qualifiedName().equals(supClassDoc.qualifiedName()))
+                break;
+            sup = supClassDoc.superclassType();
+            supClassDoc = supClassDoc.superclass();
+        }
+        if (classDoc.equals(supClassDoc)) {
+            return null;
+        }
+        return sup;
+    }
+
+    /**
+     * Given a class, return the closest visible super class.
+     *
+     * @param classDoc the class we are searching the parent for.
+     * @param configuration the current configuration of the doclet.
+     * @return the closest visible super class.  Return null if it cannot
+     *         be found (i.e. classDoc is java.lang.Object).
+     */
+    public ClassDoc getFirstVisibleSuperClassCD(ClassDoc classDoc,
+            Configuration configuration) {
+        if (classDoc == null) {
+            return null;
+        }
+        ClassDoc supClassDoc = classDoc.superclass();
+        while (supClassDoc != null &&
+                  (! (supClassDoc.isPublic() ||
+                              isLinkable(supClassDoc, configuration))) ) {
+            supClassDoc = supClassDoc.superclass();
+        }
+        if (classDoc.equals(supClassDoc)) {
+            return null;
+        }
+        return supClassDoc;
+    }
+
+    /**
+     * Given a ClassDoc, return the name of its type (Class, Interface, etc.).
+     *
+     * @param cd the ClassDoc to check.
+     * @param lowerCaseOnly true if you want the name returned in lower case.
+     *                      If false, the first letter of the name is capitalized.
+     * @return
+     */
+    public String getTypeName(Configuration config,
+        ClassDoc cd, boolean lowerCaseOnly) {
+        String typeName = "";
+        if (cd.isOrdinaryClass()) {
+            typeName = "doclet.Class";
+        } else if (cd.isInterface()) {
+            typeName = "doclet.Interface";
+        } else if (cd.isException()) {
+            typeName = "doclet.Exception";
+        } else if (cd.isError()) {
+            typeName = "doclet.Error";
+        } else if (cd.isAnnotationType()) {
+            typeName = "doclet.AnnotationType";
+        } else if (cd.isEnum()) {
+            typeName = "doclet.Enum";
+        }
+        return config.getText(
+            lowerCaseOnly ? StringUtils.toLowerCase(typeName) : typeName);
+    }
+
+    /**
+     * Replace all tabs in a string with the appropriate number of spaces.
+     * The string may be a multi-line string.
+     * @param configuration the doclet configuration defining the setting for the
+     *                      tab length.
+     * @param text the text for which the tabs should be expanded
+     * @return the text with all tabs expanded
+     */
+    public String replaceTabs(Configuration configuration, String text) {
+        if (!text.contains("\t"))
+            return text;
+
+        final int tabLength = configuration.sourcetab;
+        final String whitespace = configuration.tabSpaces;
+        final int textLength = text.length();
+        StringBuilder result = new StringBuilder(textLength);
+        int pos = 0;
+        int lineLength = 0;
+        for (int i = 0; i < textLength; i++) {
+            char ch = text.charAt(i);
+            switch (ch) {
+                case '\n': case '\r':
+                    lineLength = 0;
+                    break;
+                case '\t':
+                    result.append(text, pos, i);
+                    int spaceCount = tabLength - lineLength % tabLength;
+                    result.append(whitespace, 0, spaceCount);
+                    lineLength += spaceCount;
+                    pos = i + 1;
+                    break;
+                default:
+                    lineLength++;
+            }
+        }
+        result.append(text, pos, textLength);
+        return result.toString();
+    }
+
+    public String normalizeNewlines(String text) {
+        StringBuilder sb = new StringBuilder();
+        final int textLength = text.length();
+        final String NL = DocletConstants.NL;
+        int pos = 0;
+        for (int i = 0; i < textLength; i++) {
+            char ch = text.charAt(i);
+            switch (ch) {
+                case '\n':
+                    sb.append(text, pos, i);
+                    sb.append(NL);
+                    pos = i + 1;
+                    break;
+                case '\r':
+                    sb.append(text, pos, i);
+                    sb.append(NL);
+                    if (i + 1 < textLength && text.charAt(i + 1) == '\n')
+                        i++;
+                    pos = i + 1;
+                    break;
+            }
+        }
+        sb.append(text, pos, textLength);
+        return sb.toString();
+    }
+
+    /**
+     * The documentation for values() and valueOf() in Enums are set by the
+     * doclet.
+     */
+    public void setEnumDocumentation(Configuration configuration,
+            ClassDoc classDoc) {
+        for (MethodDoc currentMethod : classDoc.methods()) {
+            if (currentMethod.name().equals("values") &&
+                currentMethod.parameters().length == 0) {
+                StringBuilder sb = new StringBuilder();
+                sb.append(configuration.getText("doclet.enum_values_doc.main", classDoc.name()));
+                sb.append("\n@return ");
+                sb.append(configuration.getText("doclet.enum_values_doc.return"));
+                currentMethod.setRawCommentText(sb.toString());
+            } else if (currentMethod.name().equals("valueOf") &&
+                     currentMethod.parameters().length == 1) {
+                Type paramType = currentMethod.parameters()[0].type();
+                if (paramType != null &&
+                    paramType.qualifiedTypeName().equals(String.class.getName())) {
+                    StringBuilder sb = new StringBuilder();
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
+                    sb.append("\n@param name ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
+                    sb.append("\n@return ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
+                    sb.append("\n@throws IllegalArgumentException ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
+                    sb.append("\n@throws NullPointerException ");
+                    sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
+                    currentMethod.setRawCommentText(sb.toString());
+                }
+            }
+        }
+    }
+
+    /**
+     *  Return true if the given Doc is deprecated.
+     *
+     * @param doc the Doc to check.
+     * @return true if the given Doc is deprecated.
+     */
+    public boolean isDeprecated(Doc doc) {
+        if (doc.tags("deprecated").length > 0) {
+            return true;
+        }
+        AnnotationDesc[] annotationDescList;
+        if (doc instanceof PackageDoc)
+            annotationDescList = ((PackageDoc)doc).annotations();
+        else
+            annotationDescList = ((ProgramElementDoc)doc).annotations();
+        for (AnnotationDesc anno : annotationDescList) {
+            if (anno.annotationType().qualifiedName().equals(
+                    Deprecated.class.getName())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * A convenience method to get property name from the name of the
+     * getter or setter method.
+     * @param name name of the getter or setter method.
+     * @return the name of the property of the given setter of getter.
+     */
+    public String propertyNameFromMethodName(Configuration configuration, String name) {
+        String propertyName = null;
+        if (name.startsWith("get") || name.startsWith("set")) {
+            propertyName = name.substring(3);
+        } else if (name.startsWith("is")) {
+            propertyName = name.substring(2);
+        }
+        if ((propertyName == null) || propertyName.isEmpty()){
+            return "";
+        }
+        return propertyName.substring(0, 1).toLowerCase(configuration.getLocale())
+                + propertyName.substring(1);
+    }
+
+    /**
+     * In case of JavaFX mode on, filters out classes that are private,
+     * package private or having the @treatAsPrivate annotation. Those are not
+     * documented in JavaFX mode.
+     *
+     * @param classes array of classes to be filtered.
+     * @param javafx set to true if in JavaFX mode.
+     * @return list of filtered classes.
+     */
+    public ClassDoc[] filterOutPrivateClasses(final ClassDoc[] classes,
+                                                     boolean javafx) {
+        if (!javafx) {
+            return classes;
+        }
+        final List<ClassDoc> filteredOutClasses = new ArrayList<>(classes.length);
+        for (ClassDoc classDoc : classes) {
+            if (classDoc.isPrivate() || classDoc.isPackagePrivate()) {
+                continue;
+            }
+            Tag[] aspTags = classDoc.tags("treatAsPrivate");
+            if (aspTags != null && aspTags.length > 0) {
+                continue;
+            }
+            filteredOutClasses.add(classDoc);
+        }
+
+        return filteredOutClasses.toArray(new ClassDoc[0]);
+    }
+
+    /**
+     * Test whether the given FieldDoc is one of the declaration annotation ElementTypes
+     * defined in Java 5.
+     * Instead of testing for one of the new enum constants added in Java 8, test for
+     * the old constants. This prevents bootstrapping problems.
+     *
+     * @param elt The FieldDoc to test
+     * @return true, iff the given ElementType is one of the constants defined in Java 5
+     * @since 1.8
+     */
+    public boolean isJava5DeclarationElementType(FieldDoc elt) {
+        return elt.name().contentEquals(ElementType.ANNOTATION_TYPE.name()) ||
+                elt.name().contentEquals(ElementType.CONSTRUCTOR.name()) ||
+                elt.name().contentEquals(ElementType.FIELD.name()) ||
+                elt.name().contentEquals(ElementType.LOCAL_VARIABLE.name()) ||
+                elt.name().contentEquals(ElementType.METHOD.name()) ||
+                elt.name().contentEquals(ElementType.PACKAGE.name()) ||
+                elt.name().contentEquals(ElementType.PARAMETER.name()) ||
+                elt.name().contentEquals(ElementType.TYPE.name());
+    }
+
+    /**
+     * A general purpose case insensitive String comparator, which compares two Strings using a Collator
+     * strength of "TERTIARY".
+     *
+     * @param s1 first String to compare.
+     * @param s2 second String to compare.
+     * @return a negative integer, zero, or a positive integer as the first
+     *         argument is less than, equal to, or greater than the second.
+     */
+    public static int compareStrings(String s1, String s2) {
+        return compareStrings(true, s1, s2);
+    }
+    /**
+     * A general purpose case sensitive String comparator, which compares two Strings using a Collator
+     * strength of "SECONDARY".
+     *
+     * @param s1 first String to compare.
+     * @param s2 second String to compare.
+     * @return a negative integer, zero, or a positive integer as the first
+     *         argument is less than, equal to, or greater than the second.
+     */
+    public static int compareCaseCompare(String s1, String s2) {
+        return compareStrings(false, s1, s2);
+    }
+    private static int compareStrings(boolean caseSensitive, String s1, String s2) {
+        Collator collator = Collator.getInstance();
+        collator.setStrength(caseSensitive ? Collator.TERTIARY : Collator.SECONDARY);
+        return collator.compare(s1, s2);
+    }
+
+    /**
+     * A comparator for index file presentations, and are sorted as follows:
+     *  1. sort on simple names of entities
+     *  2. if equal, then compare the DocKind ex: Package, Interface etc.
+     *  3a. if equal and if the type is of ExecutableMemberDoc(Constructor, Methods),
+     *      a case insensitive comparison of parameter the type signatures
+     *  3b. if equal, case sensitive comparison of the type signatures
+     *  4. finally, if equal, compare the FQNs of the entities
+     * @return a comparator for index file use
+     */
+    public Comparator<Doc> makeComparatorForIndexUse() {
+        return new Utils.DocComparator<Doc>() {
+            /**
+             * Compare two given Doc entities, first sort on names, then on the kinds,
+             * then on the parameters only if the type is an instance of ExecutableMemberDocs,
+             * the parameters are compared and finally the fully qualified names.
+             *
+             * @param d1 - a Doc element.
+             * @param d2 - a Doc element.
+             * @return a negative integer, zero, or a positive integer as the first
+             *         argument is less than, equal to, or greater than the second.
+             */
+            public int compare(Doc d1, Doc d2) {
+                int result = compareNames(d1, d2);
+                if (result != 0) {
+                    return result;
+                }
+                result = compareDocKinds(d1, d2);
+                if (result != 0) {
+                    return result;
+                }
+                if (hasParameters(d1)) {
+                    Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters();
+                    Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters();
+                    result = compareParameters(false, param1, param2);
+                    if (result != 0) {
+                        return result;
+                    }
+                    result = compareParameters(true, param1, param2);
+                    if (result != 0) {
+                        return result;
+                    }
+                }
+                return compareFullyQualifiedNames(d1, d2);
+            }
+        };
+    }
+    /**
+     * Comparator for ClassUse presentations, and sorted as follows,
+     * 1. compares simple names of entities
+     * 2. if equal, the fully qualified names of the entities
+     * 3. if equal and if applicable, the string representation of parameter types
+     * 3a. first by using case insensitive comparison
+     * 3b. second by using a case sensitive comparison
+     * 4. finally the Doc kinds ie. package, class, interface etc.
+     * @return a comparator to sort classes and members for class use
+     */
+    public Comparator<Doc> makeComparatorForClassUse() {
+        return new Utils.DocComparator<Doc>() {
+            /**
+             * Compares two given Doc entities, first sort on name, and if
+             * applicable on the fully qualified name, and if applicable
+             * on the parameter types, and finally the DocKind.
+             * @param d1 - a Doc element.
+             * @param d2 - a Doc element.
+             * @return a negative integer, zero, or a positive integer as the first
+             *         argument is less than, equal to, or greater than the second.
+             */
+            public int compare(Doc d1, Doc d2) {
+                int result = compareNames(d1, d2);
+                if (result != 0) {
+                    return result;
+                }
+                result = compareFullyQualifiedNames(d1, d2);
+                if (result != 0) {
+                    return result;
+                }
+                if (hasParameters(d1) && hasParameters(d2)) {
+                    Parameter[] param1 = ((ExecutableMemberDoc) d1).parameters();
+                    Parameter[] param2 = ((ExecutableMemberDoc) d2).parameters();
+                    result = compareParameters(false, param1, param2);
+                    if (result != 0) {
+                        return result;
+                    }
+                    return compareParameters(true, param1, param2);
+                }
+                return compareDocKinds(d1, d2);
+            }
+        };
+    }
+    /**
+     * A general purpose comparator to sort Doc entities, basically provides the building blocks
+     * for creating specific comparators for an use-case.
+     * @param <T> a Doc entity
+     */
+    static abstract class DocComparator<T extends Doc> implements Comparator<Doc> {
+        static enum DocKind {
+           PACKAGE,
+           CLASS,
+           ENUM,
+           INTERFACE,
+           ANNOTATION,
+           FIELD,
+           CONSTRUCTOR,
+           METHOD
+        };
+        boolean hasParameters(Doc d) {
+            return d instanceof ExecutableMemberDoc;
+        }
+        DocKind getDocKind(Doc d) {
+            if (d.isAnnotationType() || d.isAnnotationTypeElement()) {
+                return DocKind.ANNOTATION;
+            } else if (d.isEnum() || d.isEnumConstant()) {
+                return DocKind.ENUM;
+            } else if (d.isField()) {
+                return DocKind.FIELD;
+            } else if (d.isInterface()) {
+                return DocKind.INTERFACE;
+            } else if (d.isClass()) {
+                return DocKind.CLASS;
+            } else if (d.isConstructor()) {
+                return DocKind.CONSTRUCTOR;
+            } else if (d.isMethod()) {
+                return DocKind.METHOD;
+            } else {
+                return DocKind.PACKAGE;
+            }
+        }
+        /**
+         * Compares two Doc entities' kinds, and these are ordered as defined in
+         * the DocKind enumeration.
+         * @param d1 the first Doc object
+         * @param d2 the second Doc object
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareDocKinds(Doc d1, Doc d2) {
+            return getDocKind(d1).compareTo(getDocKind(d2));
+        }
+        /**
+         * Compares arrays of parameters as a string representation of their types.
+         *
+         * @param ignoreCase specifies case sensitive or insensitive comparison.
+         * @param params1 the first parameter array.
+         * @param params2 the first parameter array.
+         * @return a negative integer, zero, or a positive integer as the first argument is less
+         * than, equal to, or greater than the second.
+         */
+        protected int compareParameters(boolean caseSensitive,
+                                        Parameter[] params1,
+                                        Parameter[] params2) {
+            String s1 = getParametersAsString(params1);
+            String s2 = getParametersAsString(params2);
+            return compareStrings(caseSensitive, s1, s2);
+        }
+        /*
+         * This method returns a string representation solely for comparison purposes.
+         */
+        protected String getParametersAsString(Parameter[] params) {
+            StringBuilder sb = new StringBuilder();
+            for (Parameter param : params) {
+                Type t = param.type();
+                // add parameter type to arrays, as TypeMirror does.
+                String tname = (t.asParameterizedType() != null && t.getElementType() != null)
+                        ? t.getElementType() + t.dimension()
+                        : t.toString();
+                // prefix P for primitive and R for reference types, thus items will
+                // be ordered naturally.
+                sb.append(t.isPrimitive() ? "P" : "R").append("-").append(tname).append("-");
+            }
+            return sb.toString();
+        }
+
+        /**
+         * Compares two Doc entities typically the simple name of a method,
+         * field, constructor etc.
+         * @param d1 the first Doc.
+         * @param d2 the second Doc.
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareNames(Doc d1, Doc d2) {
+            return compareStrings(d1.name(), d2.name());
+        }
+
+        /**
+         * Compares the fully qualified names of the entities
+         * @param d1 the first entity
+         * @param d2 the second entity
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareFullyQualifiedNames(Doc d1, Doc d2) {
+            String name1 = (d1 instanceof ProgramElementDoc)
+                    ? ((ProgramElementDoc)d1).qualifiedName()
+                    : d1.name();
+            String name2 = (d2 instanceof ProgramElementDoc)
+                    ? ((ProgramElementDoc)d2).qualifiedName()
+                    : d2.name();
+            return compareStrings(name1, name2);
+        }
+    }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -99,6 +99,7 @@
      * The configuration this VisibleMemberMap was created with.
      */
     private final Configuration configuration;
+    private final Utils utils;
 
     private static final Map<ClassDoc, ProgramElementDoc[]> propertiesCache = new HashMap<>();
     private static final Map<ProgramElementDoc, ProgramElementDoc> classPropertiesMap = new HashMap<>();
@@ -121,6 +122,7 @@
         this.classdoc = classdoc;
         this.kind = kind;
         this.configuration = configuration;
+        this.utils = configuration.utils;
         new ClassMembers(classdoc, STARTLEVEL).build();
     }
 
@@ -173,7 +175,7 @@
         for (ClassDoc currentClass : visibleClasses) {
             if (currentClass != classdoc &&
                 currentClass.isPackagePrivate() &&
-                !Util.isLinkable(currentClass, configuration)) {
+                !utils.isLinkable(currentClass, configuration)) {
                 // Document these members in the child class because
                 // the parent is inaccessible.
                 results.addAll(getMembersFor(currentClass));
@@ -270,7 +272,7 @@
 
         public boolean isEqual(MethodDoc member) {
             for (ProgramElementDoc element : members) {
-                if (Util.executableMembersEqual(member, (MethodDoc) element)) {
+                if (utils.executableMembersEqual(member, (MethodDoc) element)) {
                     members.add(member);
                     return true;
                 }
@@ -465,7 +467,7 @@
             }
             // Deprected members should be excluded or not?
             if (configuration.nodeprecated) {
-                return Util.excludeDeprecatedMembersAsList(members);
+                return utils.excludeDeprecatedMembersAsList(members);
             }
             return Arrays.asList(members);
         }
@@ -496,7 +498,7 @@
 
         private boolean found(List<ProgramElementDoc> list, ProgramElementDoc elem) {
             for (ProgramElementDoc pgmelem : list) {
-                if (Util.matches(pgmelem, elem)) {
+                if (utils.matches(pgmelem, elem)) {
                     return true;
                 }
             }
@@ -692,7 +694,7 @@
         private boolean isPropertyGetterOrSetter(MethodDoc[] members,
                                                  MethodDoc methodDoc) {
             boolean found = false;
-            String propertyName = Util.propertyNameFromMethodName(configuration, methodDoc.name());
+            String propertyName = utils.propertyNameFromMethodName(configuration, methodDoc.name());
             if (!propertyName.isEmpty()) {
                 String propertyMethodName = propertyName + "Property";
                 for (MethodDoc member: members) {
--- a/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -30,12 +30,12 @@
 import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.HashMap;
-import java.util.Locale;
 import java.util.Map;
 
 import javax.lang.model.element.Name;
 
 import static com.sun.tools.doclint.HtmlTag.Attr.*;
+
 import com.sun.tools.javac.util.StringUtils;
 
 /**
@@ -58,6 +58,15 @@
     A(BlockType.INLINE, EndKind.REQUIRED,
             attrs(AttrKind.OK, HREF, TARGET, NAME)),
 
+    ABBR(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
+
+    ACRONYM(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
+
+    ADDRESS(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
+
     B(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
@@ -87,6 +96,10 @@
     DD(BlockType.LIST_ITEM, EndKind.OPTIONAL,
             EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE, Flag.EXPECT_CONTENT)),
 
+    DEL(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST),
+            attrs(AttrKind.OK, Attr.CITE, Attr.DATETIME)),
+
     DFN(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
 
@@ -138,6 +151,13 @@
             attrs(AttrKind.OBSOLETE, NAME),
             attrs(AttrKind.USE_CSS, ALIGN, HSPACE, VSPACE, BORDER)),
 
+    INS(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST),
+            attrs(AttrKind.OK, Attr.CITE, Attr.DATETIME)),
+
+    KBD(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
+
     LI(BlockType.LIST_ITEM, EndKind.OPTIONAL,
             EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
             attrs(AttrKind.OK, VALUE)),
@@ -183,6 +203,15 @@
         }
     },
 
+    Q(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
+
+    S(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
+
+    SAMP(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT, Flag.NO_NEST)),
+
     SCRIPT(BlockType.OTHER, EndKind.REQUIRED),
 
     SMALL(BlockType.INLINE, EndKind.REQUIRED,
@@ -191,6 +220,9 @@
     SPAN(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT)),
 
+    STRIKE(BlockType.INLINE, EndKind.REQUIRED,
+            EnumSet.of(Flag.EXPECT_CONTENT)),
+
     STRONG(BlockType.INLINE, EndKind.REQUIRED,
             EnumSet.of(Flag.EXPECT_CONTENT)),
 
@@ -229,7 +261,7 @@
 
     TD(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
             EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
-            attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS,
+            attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, Attr.ABBR, AXIS,
                 ALIGN, CHAR, CHAROFF, VALIGN),
             attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)),
 
@@ -243,7 +275,7 @@
 
     TH(BlockType.TABLE_ITEM, EndKind.OPTIONAL,
             EnumSet.of(Flag.ACCEPTS_BLOCK, Flag.ACCEPTS_INLINE),
-            attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, ABBR, AXIS,
+            attrs(AttrKind.OK, COLSPAN, ROWSPAN, HEADERS, SCOPE, Attr.ABBR, AXIS,
                 ALIGN, CHAR, CHAROFF, VALIGN),
             attrs(AttrKind.USE_CSS, WIDTH, BGCOLOR, HEIGHT, NOWRAP)),
 
@@ -321,11 +353,13 @@
         CELLPADDING,
         CHAR,
         CHAROFF,
+        CITE,
         CLEAR,
         CLASS,
         COLOR,
         COLSPAN,
         COMPACT,
+        DATETIME,
         FACE,
         FRAME,
         HEADERS,
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacScope.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacScope.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -46,18 +46,33 @@
  * @author Jonathan Gibbons;
  */
 public class JavacScope implements com.sun.source.tree.Scope {
+
+    static JavacScope create(Env<AttrContext> env) {
+        if (env.outer == null || env.outer == env) {
+            //the "top-level" scope needs to return both imported and defined elements
+            //see test CheckLocalElements
+            return new JavacScope(env) {
+                @Override
+                public Iterable<? extends Element> getLocalElements() {
+                    return env.toplevel.namedImportScope.getSymbols();
+                }
+            };
+        } else {
+            return new JavacScope(env);
+        }
+    }
+
     protected final Env<AttrContext> env;
 
-    /** Creates a new instance of JavacScope */
-    JavacScope(Env<AttrContext> env) {
+    private JavacScope(Env<AttrContext> env) {
         env.getClass(); // null-check
         this.env = env;
     }
 
     public JavacScope getEnclosingScope() {
-        if (env.outer != null && env.outer != env)
-            return  new JavacScope(env.outer);
-        else {
+        if (env.outer != null && env.outer != env) {
+            return create(env.outer);
+        } else {
             // synthesize an outermost "star-import" scope
             return new JavacScope(env) {
                 public boolean isStarImportScope() {
@@ -67,7 +82,7 @@
                     return null;
                 }
                 public Iterable<? extends Element> getLocalElements() {
-                    return env.toplevel.starImportScope.getElements();
+                    return env.toplevel.starImportScope.getSymbols();
                 }
             };
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Wed Jul 05 19:50:06 2017 +0200
@@ -456,10 +456,9 @@
         }
         searched.add(tsym);
 
-        for (com.sun.tools.javac.code.Scope.Entry e = tsym.members().lookup(fieldName);
-                e.scope != null; e = e.next()) {
-            if (e.sym.kind == Kinds.VAR) {
-                return (VarSymbol)e.sym;
+        for (Symbol sym : tsym.members().getSymbolsByName(fieldName)) {
+            if (sym.kind == Kinds.VAR) {
+                return (VarSymbol)sym;
             }
         }
 
@@ -499,11 +498,10 @@
 
     /** @see com.sun.tools.javadoc.ClassDocImpl#findConstructor */
     MethodSymbol findConstructor(ClassSymbol tsym, List<Type> paramTypes) {
-        for (com.sun.tools.javac.code.Scope.Entry e = tsym.members().lookup(names.init);
-                e.scope != null; e = e.next()) {
-            if (e.sym.kind == Kinds.MTH) {
-                if (hasParameterTypes((MethodSymbol) e.sym, paramTypes)) {
-                    return (MethodSymbol) e.sym;
+        for (Symbol sym : tsym.members().getSymbolsByName(names.init)) {
+            if (sym.kind == Kinds.MTH) {
+                if (hasParameterTypes((MethodSymbol) sym, paramTypes)) {
+                    return (MethodSymbol) sym;
                 }
             }
         }
@@ -529,7 +527,6 @@
         searched.add(tsym);
 
         // search current class
-        com.sun.tools.javac.code.Scope.Entry e = tsym.members().lookup(methodName);
 
         //### Using modifier filter here isn't really correct,
         //### but emulates the old behavior.  Instead, we should
@@ -542,10 +539,10 @@
             // In order to provide textually identical results, we
             // attempt to emulate the old behavior.
             MethodSymbol lastFound = null;
-            for (; e.scope != null; e = e.next()) {
-                if (e.sym.kind == Kinds.MTH) {
-                    if (e.sym.name == methodName) {
-                        lastFound = (MethodSymbol)e.sym;
+            for (Symbol sym : tsym.members().getSymbolsByName(methodName)) {
+                if (sym.kind == Kinds.MTH) {
+                    if (sym.name == methodName) {
+                        lastFound = (MethodSymbol)sym;
                     }
                 }
             }
@@ -553,11 +550,11 @@
                 return lastFound;
             }
         } else {
-            for (; e.scope != null; e = e.next()) {
-                if (e.sym != null &&
-                    e.sym.kind == Kinds.MTH) {
-                    if (hasParameterTypes((MethodSymbol) e.sym, paramTypes)) {
-                        return (MethodSymbol) e.sym;
+            for (Symbol sym : tsym.members().getSymbolsByName(methodName)) {
+                if (sym != null &&
+                    sym.kind == Kinds.MTH) {
+                    if (hasParameterTypes((MethodSymbol) sym, paramTypes)) {
+                        return (MethodSymbol) sym;
                     }
                 }
             }
@@ -684,7 +681,7 @@
     }
 
     public JavacScope getScope(TreePath path) {
-        return new JavacScope(getAttrContext(path));
+        return JavacScope.create(getAttrContext(path));
     }
 
     public String getDocComment(TreePath path) {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/ClassFinder.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/ClassFinder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -37,6 +37,7 @@
 import static javax.tools.StandardLocation.*;
 
 import com.sun.tools.javac.comp.Annotate;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.jvm.ClassReader;
 import com.sun.tools.javac.util.*;
@@ -218,7 +219,7 @@
         if (c.owner.kind == PCK) {
             Symbol owner = c.owner;
             for (Name name : Convert.enclosingCandidates(Convert.shortName(c.name))) {
-                Symbol encl = owner.members().lookup(name).sym;
+                Symbol encl = owner.members().findFirst(name);
                 if (encl == null)
                     encl = syms.classes.get(TypeSymbol.formFlatName(name, owner));
                 if (encl != null)
@@ -335,7 +336,7 @@
         boolean isPkgInfo = classname == names.package_info;
         ClassSymbol c = isPkgInfo
             ? p.package_info
-            : (ClassSymbol) p.members_field.lookup(classname).sym;
+            : (ClassSymbol) p.members_field.findFirst(classname);
         if (c == null) {
             c = syms.enterClass(classname, p);
             if (c.classfile == null) // only update the file if's it's newly created
@@ -399,7 +400,7 @@
      */
     private void fillIn(PackageSymbol p) throws IOException {
         if (p.members_field == null)
-            p.members_field = new Scope(p);
+            p.members_field = WriteableScope.create(p);
 
         preferCurrent = false;
         if (userPathsFirst) {
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Scope.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -25,440 +25,588 @@
 
 package com.sun.tools.javac.code;
 
-import java.util.Iterator;
+import java.util.*;
 
 import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.List;
+
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+import static com.sun.tools.javac.code.Scope.LookupKind.RECURSIVE;
 
 /** A scope represents an area of visibility in a Java program. The
  *  Scope class is a container for symbols which provides
  *  efficient access to symbols given their names. Scopes are implemented
  *  as hash tables with "open addressing" and "double hashing".
- *  Scopes can be nested; the next field of a scope points
- *  to its next outer scope. Nested scopes can share their hash tables.
+ *  Scopes can be nested. Nested scopes can share their hash tables.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-public class Scope {
-
-    /** The number of scopes that share this scope's hash table.
-     */
-    private int shared;
-
-    /** Next enclosing scope (with whom this scope may share a hashtable)
-     */
-    public Scope next;
+public abstract class Scope {
 
     /** The scope's owner.
      */
-    public Symbol owner;
+    public final Symbol owner;
+
+    protected Scope(Symbol owner) {
+        this.owner = owner;
+    }
 
-    /** A hash table for the scope's entries.
+    /**Returns all Symbols in this Scope. Symbols from outward Scopes are included.
+     */
+    public final Iterable<Symbol> getSymbols() {
+        return getSymbols(noFilter);
+    }
+
+    /**Returns Symbols that match the given filter. Symbols from outward Scopes are included.
+     */
+    public final Iterable<Symbol> getSymbols(Filter<Symbol> sf) {
+        return getSymbols(sf, RECURSIVE);
+    }
+
+    /**Returns all Symbols in this Scope. Symbols from outward Scopes are included
+     * iff lookupKind == RECURSIVE.
      */
-    Entry[] table;
+    public final Iterable<Symbol> getSymbols(LookupKind lookupKind) {
+        return getSymbols(noFilter, lookupKind);
+    }
+
+    /**Returns Symbols that match the given filter. Symbols from outward Scopes are included
+     * iff lookupKind == RECURSIVE.
+     */
+    public abstract Iterable<Symbol> getSymbols(Filter<Symbol> sf, LookupKind lookupKind);
 
-    /** Mask for hash codes, always equal to (table.length - 1).
+    /**Returns Symbols with the given name. Symbols from outward Scopes are included.
+     */
+    public final Iterable<Symbol> getSymbolsByName(Name name) {
+        return getSymbolsByName(name, RECURSIVE);
+    }
+
+    /**Returns Symbols with the given name that match the given filter.
+     * Symbols from outward Scopes are included.
      */
-    int hashMask;
+    public final Iterable<Symbol> getSymbolsByName(final Name name, final Filter<Symbol> sf) {
+        return getSymbolsByName(name, sf, RECURSIVE);
+    }
+
+    /**Returns Symbols with the given name. Symbols from outward Scopes are included
+     * iff lookupKind == RECURSIVE.
+     */
+    public final Iterable<Symbol> getSymbolsByName(Name name, LookupKind lookupKind) {
+        return getSymbolsByName(name, noFilter, lookupKind);
+    }
 
-    /** A linear list that also contains all entries in
-     *  reverse order of appearance (i.e later entries are pushed on top).
+    /**Returns Symbols with the given name that match the given filter.
+     * Symbols from outward Scopes are included iff lookupKind == RECURSIVE.
+     */
+    public abstract Iterable<Symbol> getSymbolsByName(final Name name, final Filter<Symbol> sf,
+            final LookupKind lookupKind);
+
+    /** Return the first Symbol from this or outward scopes with the given name.
+     * Returns null if none.
      */
-    public Entry elems;
+    public final Symbol findFirst(Name name) {
+        return findFirst(name, noFilter);
+    }
+
+    /** Return the first Symbol from this or outward scopes with the given name that matches the
+     *  given filter. Returns null if none.
+     */
+    public Symbol findFirst(Name name, Filter<Symbol> sf) {
+        Iterator<Symbol> it = getSymbolsByName(name, sf).iterator();
+        return it.hasNext() ? it.next() : null;
+    }
 
-    /** The number of elements in this scope.
-     * This includes deleted elements, whose value is the sentinel.
+    /** Returns true iff there are is at least one Symbol in this scope matching the given filter.
+     *  Does not inspect outward scopes.
+     */
+    public boolean anyMatch(Filter<Symbol> filter) {
+        return getSymbols(filter, NON_RECURSIVE).iterator().hasNext();
+    }
+
+    /** Returns true iff the given Symbol is in this scope or any outward scope.
      */
-    int nelems = 0;
+    public boolean includes(final Symbol sym) {
+        return getSymbolsByName(sym.name, new Filter<Symbol>() {
+            @Override
+            public boolean accepts(Symbol t) {
+                return t == sym;
+            }
+        }).iterator().hasNext();
+    }
+
+    /** Returns true iff this scope does not contain any Symbol. Does not inspect outward scopes.
+     */
+    public boolean isEmpty() {
+        return !getSymbols(NON_RECURSIVE).iterator().hasNext();
+    }
+
+    /** Returns the Scope from which the givins Symbol originates in this scope.
+     */
+    public abstract Scope getOrigin(Symbol byName);
+
+    /** Returns true iff the given Symbol is part of this scope due to a static import.
+     */
+    public abstract boolean isStaticallyImported(Symbol byName);
+
+    private static final Filter<Symbol> noFilter = null;
 
     /** A list of scopes to be notified if items are to be removed from this scope.
      */
     List<ScopeListener> listeners = List.nil();
 
-    /** Use as a "not-found" result for lookup.
-     * Also used to mark deleted entries in the table.
-     */
-    private static final Entry sentinel = new Entry(null, null, null, null);
-
-    /** The hash table's initial size.
-     */
-    private static final int INITIAL_SIZE = 0x10;
-
-    /** A value for the empty scope.
-     */
-    public static final Scope emptyScope = new Scope(null, null, new Entry[]{});
-
-    /** Construct a new scope, within scope next, with given owner, using
-     *  given table. The table's length must be an exponent of 2.
-     */
-    private Scope(Scope next, Symbol owner, Entry[] table) {
-        this.next = next;
-        Assert.check(emptyScope == null || owner != null);
-        this.owner = owner;
-        this.table = table;
-        this.hashMask = table.length - 1;
-    }
-
-    /** Convenience constructor used for dup and dupUnshared. */
-    private Scope(Scope next, Symbol owner, Entry[] table, int nelems) {
-        this(next, owner, table);
-        this.nelems = nelems;
-    }
-
-    /** Construct a new scope, within scope next, with given owner,
-     *  using a fresh table of length INITIAL_SIZE.
-     */
-    public Scope(Symbol owner) {
-        this(null, owner, new Entry[INITIAL_SIZE]);
-    }
-
-    /** Construct a fresh scope within this scope, with same owner,
-     *  which shares its table with the outer scope. Used in connection with
-     *  method leave if scope access is stack-like in order to avoid allocation
-     *  of fresh tables.
-     */
-    public Scope dup() {
-        return dup(this.owner);
-    }
-
-    /** Construct a fresh scope within this scope, with new owner,
-     *  which shares its table with the outer scope. Used in connection with
-     *  method leave if scope access is stack-like in order to avoid allocation
-     *  of fresh tables.
-     */
-    public Scope dup(Symbol newOwner) {
-        Scope result = new Scope(this, newOwner, this.table, this.nelems);
-        shared++;
-        // System.out.println("====> duping scope " + this.hashCode() + " owned by " + newOwner + " to " + result.hashCode());
-        // new Error().printStackTrace(System.out);
-        return result;
-    }
-
-    /** Construct a fresh scope within this scope, with same owner,
-     *  with a new hash table, whose contents initially are those of
-     *  the table of its outer scope.
-     */
-    public Scope dupUnshared() {
-        return new Scope(this, this.owner, this.table.clone(), this.nelems);
+    public void addScopeListener(ScopeListener sl) {
+        listeners = listeners.prepend(sl);
     }
 
-    /** Remove all entries of this scope from its table, if shared
-     *  with next.
-     */
-    public Scope leave() {
-        Assert.check(shared == 0);
-        if (table != next.table) return next;
-        while (elems != null) {
-            int hash = getIndex(elems.sym.name);
-            Entry e = table[hash];
-            Assert.check(e == elems, elems.sym);
-            table[hash] = elems.shadowed;
-            elems = elems.sibling;
-        }
-        Assert.check(next.shared > 0);
-        next.shared--;
-        next.nelems = nelems;
-        // System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode());
-        // new Error().printStackTrace(System.out);
-        return next;
-    }
-
-    /** Double size of hash table.
-     */
-    private void dble() {
-        Assert.check(shared == 0);
-        Entry[] oldtable = table;
-        Entry[] newtable = new Entry[oldtable.length * 2];
-        for (Scope s = this; s != null; s = s.next) {
-            if (s.table == oldtable) {
-                Assert.check(s == this || s.shared != 0);
-                s.table = newtable;
-                s.hashMask = newtable.length - 1;
-            }
-        }
-        int n = 0;
-        for (int i = oldtable.length; --i >= 0; ) {
-            Entry e = oldtable[i];
-            if (e != null && e != sentinel) {
-                table[getIndex(e.sym.name)] = e;
-                n++;
-            }
-        }
-        // We don't need to update nelems for shared inherited scopes,
-        // since that gets handled by leave().
-        nelems = n;
-    }
-
-    /** Enter symbol sym in this scope.
-     */
-    public void enter(Symbol sym) {
-        Assert.check(shared == 0);
-        enter(sym, this);
-    }
-
-    public void enter(Symbol sym, Scope s) {
-        enter(sym, s, s, false);
-    }
-
-    /**
-     * Enter symbol sym in this scope, but mark that it comes from
-     * given scope `s' accessed through `origin'.  The last two
-     * arguments are only used in import scopes.
-     */
-    public void enter(Symbol sym, Scope s, Scope origin, boolean staticallyImported) {
-        Assert.check(shared == 0);
-        if (nelems * 3 >= hashMask * 2)
-            dble();
-        int hash = getIndex(sym.name);
-        Entry old = table[hash];
-        if (old == null) {
-            old = sentinel;
-            nelems++;
-        }
-        Entry e = makeEntry(sym, old, elems, s, origin, staticallyImported);
-        table[hash] = e;
-        elems = e;
-
-        //notify listeners
-        for (List<ScopeListener> l = listeners; l.nonEmpty(); l = l.tail) {
-            l.head.symbolAdded(sym, this);
-        }
-    }
-
-    Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope, Scope origin, boolean staticallyImported) {
-        return new Entry(sym, shadowed, sibling, scope);
-    }
-
-
     public interface ScopeListener {
         public void symbolAdded(Symbol sym, Scope s);
         public void symbolRemoved(Symbol sym, Scope s);
     }
 
-    public void addScopeListener(ScopeListener sl) {
-        listeners = listeners.prepend(sl);
-    }
-
-    /** Remove symbol from this scope.  Used when an inner class
-     *  attribute tells us that the class isn't a package member.
-     */
-    public void remove(Symbol sym) {
-        Assert.check(shared == 0);
-        Entry e = lookup(sym.name);
-        if (e.scope == null) return;
-
-        // remove e from table and shadowed list;
-        int i = getIndex(sym.name);
-        Entry te = table[i];
-        if (te == e)
-            table[i] = e.shadowed;
-        else while (true) {
-            if (te.shadowed == e) {
-                te.shadowed = e.shadowed;
-                break;
-            }
-            te = te.shadowed;
-        }
-
-        // remove e from elems and sibling list
-        te = elems;
-        if (te == e)
-            elems = e.sibling;
-        else while (true) {
-            if (te.sibling == e) {
-                te.sibling = e.sibling;
-                break;
-            }
-            te = te.sibling;
-        }
-
-        //notify listeners
-        for (List<ScopeListener> l = listeners; l.nonEmpty(); l = l.tail) {
-            l.head.symbolRemoved(sym, this);
-        }
+    public enum LookupKind {
+        RECURSIVE,
+        NON_RECURSIVE;
     }
 
-    /** Enter symbol sym in this scope if not already there.
-     */
-    public void enterIfAbsent(Symbol sym) {
-        Assert.check(shared == 0);
-        Entry e = lookup(sym.name);
-        while (e.scope == this && e.sym.kind != sym.kind) e = e.next();
-        if (e.scope != this) enter(sym);
-    }
+    /**A scope into which Symbols can be added.*/
+    public abstract static class WriteableScope extends Scope {
+
+        public WriteableScope(Symbol owner) {
+            super(owner);
+        }
 
-    /** Given a class, is there already a class with same fully
-     *  qualified name in this (import) scope?
-     */
-    public boolean includes(Symbol c) {
-        for (Scope.Entry e = lookup(c.name);
-             e.scope == this;
-             e = e.next()) {
-            if (e.sym == c) return true;
+        /** Enter the given Symbol into this scope.
+         */
+        public abstract void enter(Symbol c);
+        /** Enter symbol sym in this scope if not already there.
+         */
+        public abstract void enterIfAbsent(Symbol c);
+
+        public abstract void remove(Symbol c);
+
+        /** Construct a fresh scope within this scope, with same owner. The new scope may
+         *  shares internal structures with the this scope. Used in connection with
+         *  method leave if scope access is stack-like in order to avoid allocation
+         *  of fresh tables.
+         */
+        public final WriteableScope dup() {
+            return dup(this.owner);
         }
-        return false;
-    }
 
-    static final Filter<Symbol> noFilter = new Filter<Symbol>() {
-        public boolean accepts(Symbol s) {
-            return true;
-        }
-    };
+        /** Construct a fresh scope within this scope, with new owner. The new scope may
+         *  shares internal structures with the this scope. Used in connection with
+         *  method leave if scope access is stack-like in order to avoid allocation
+         *  of fresh tables.
+         */
+        public abstract WriteableScope dup(Symbol newOwner);
+
+        /** Must be called on dup-ed scopes to be able to work with the outward scope again.
+         */
+        public abstract WriteableScope leave();
 
-    /** Return the entry associated with given name, starting in
-     *  this scope and proceeding outwards. If no entry was found,
-     *  return the sentinel, which is characterized by having a null in
-     *  both its scope and sym fields, whereas both fields are non-null
-     *  for regular entries.
-     */
-    public Entry lookup(Name name) {
-        return lookup(name, noFilter);
-    }
+        /** Construct a fresh scope within this scope, with same owner. The new scope
+         *  will not share internal structures with this scope.
+         */
+        public final WriteableScope dupUnshared() {
+            return dupUnshared(owner);
+        }
 
-    public Entry lookup(Name name, Filter<Symbol> sf) {
-        Entry e = table[getIndex(name)];
-        if (e == null || e == sentinel)
-            return sentinel;
-        while (e.scope != null && (e.sym.name != name || !sf.accepts(e.sym)))
-            e = e.shadowed;
-        return e;
+        /** Construct a fresh scope within this scope, with new owner. The new scope
+         *  will not share internal structures with this scope.
+         */
+        public abstract WriteableScope dupUnshared(Symbol newOwner);
+
+        /** Create a new WriteableScope.
+         */
+        public static WriteableScope create(Symbol owner) {
+            return new ScopeImpl(owner);
+        }
+
     }
 
-    /*void dump (java.io.PrintStream out) {
-        out.println(this);
-        for (int l=0; l < table.length; l++) {
-            Entry le = table[l];
-            out.print("#"+l+": ");
-            if (le==sentinel) out.println("sentinel");
-            else if(le == null) out.println("null");
-            else out.println(""+le+" s:"+le.sym);
-        }
-    }*/
+    private static class ScopeImpl extends WriteableScope {
+        /** The number of scopes that share this scope's hash table.
+         */
+        private int shared;
+
+        /** Next enclosing scope (with whom this scope may share a hashtable)
+         */
+        public ScopeImpl next;
+
+        /** A hash table for the scope's entries.
+         */
+        Entry[] table;
+
+        /** Mask for hash codes, always equal to (table.length - 1).
+         */
+        int hashMask;
+
+        /** A linear list that also contains all entries in
+         *  reverse order of appearance (i.e later entries are pushed on top).
+         */
+        public Entry elems;
+
+        /** The number of elements in this scope.
+         * This includes deleted elements, whose value is the sentinel.
+         */
+        int nelems = 0;
+
+        /** Use as a "not-found" result for lookup.
+         * Also used to mark deleted entries in the table.
+         */
+        private static final Entry sentinel = new Entry(null, null, null, null);
+
+        /** The hash table's initial size.
+         */
+        private static final int INITIAL_SIZE = 0x10;
 
-    /** Look for slot in the table.
-     *  We use open addressing with double hashing.
-     */
-    int getIndex (Name name) {
-        int h = name.hashCode();
-        int i = h & hashMask;
-        // The expression below is always odd, so it is guaranteed
-        // to be mutually prime with table.length, a power of 2.
-        int x = hashMask - ((h + (h >> 16)) << 1);
-        int d = -1; // Index of a deleted item.
-        for (;;) {
-            Entry e = table[i];
-            if (e == null)
-                return d >= 0 ? d : i;
-            if (e == sentinel) {
-                // We have to keep searching even if we see a deleted item.
-                // However, remember the index in case we fail to find the name.
-                if (d < 0)
-                    d = i;
-            } else if (e.sym.name == name)
-                return i;
-            i = (i + x) & hashMask;
+        /** Construct a new scope, within scope next, with given owner, using
+         *  given table. The table's length must be an exponent of 2.
+         */
+        private ScopeImpl(ScopeImpl next, Symbol owner, Entry[] table) {
+            super(owner);
+            this.next = next;
+            Assert.check(owner != null);
+            this.table = table;
+            this.hashMask = table.length - 1;
+        }
+
+        /** Convenience constructor used for dup and dupUnshared. */
+        private ScopeImpl(ScopeImpl next, Symbol owner, Entry[] table, int nelems) {
+            this(next, owner, table);
+            this.nelems = nelems;
         }
-    }
 
-    public boolean anyMatch(Filter<Symbol> sf) {
-        return getElements(sf).iterator().hasNext();
-    }
-
-    public Iterable<Symbol> getElements() {
-        return getElements(noFilter);
-    }
+        /** Construct a new scope, within scope next, with given owner,
+         *  using a fresh table of length INITIAL_SIZE.
+         */
+        public ScopeImpl(Symbol owner) {
+            this(null, owner, new Entry[INITIAL_SIZE]);
+        }
 
-    public Iterable<Symbol> getElements(final Filter<Symbol> sf) {
-        return new Iterable<Symbol>() {
-            public Iterator<Symbol> iterator() {
-                return new Iterator<Symbol>() {
-                    private Scope currScope = Scope.this;
-                    private Scope.Entry currEntry = elems;
-                    {
-                        update();
-                    }
+        /** Construct a fresh scope within this scope, with new owner,
+         *  which shares its table with the outer scope. Used in connection with
+         *  method leave if scope access is stack-like in order to avoid allocation
+         *  of fresh tables.
+         */
+        public WriteableScope dup(Symbol newOwner) {
+            ScopeImpl result = new ScopeImpl(this, newOwner, this.table, this.nelems);
+            shared++;
+            // System.out.println("====> duping scope " + this.hashCode() + " owned by " + newOwner + " to " + result.hashCode());
+            // new Error().printStackTrace(System.out);
+            return result;
+        }
 
-                    public boolean hasNext() {
-                        return currEntry != null;
-                    }
+        /** Construct a fresh scope within this scope, with new owner,
+         *  with a new hash table, whose contents initially are those of
+         *  the table of its outer scope.
+         */
+        public WriteableScope dupUnshared(Symbol newOwner) {
+            return new ScopeImpl(this, newOwner, this.table.clone(), this.nelems);
+        }
 
-                    public Symbol next() {
-                        Symbol sym = (currEntry == null ? null : currEntry.sym);
-                        if (currEntry != null) {
-                            currEntry = currEntry.sibling;
-                        }
-                        update();
-                        return sym;
-                    }
-
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
+        /** Remove all entries of this scope from its table, if shared
+         *  with next.
+         */
+        public WriteableScope leave() {
+            Assert.check(shared == 0);
+            if (table != next.table) return next;
+            while (elems != null) {
+                int hash = getIndex(elems.sym.name);
+                Entry e = table[hash];
+                Assert.check(e == elems, elems.sym);
+                table[hash] = elems.shadowed;
+                elems = elems.sibling;
+            }
+            Assert.check(next.shared > 0);
+            next.shared--;
+            next.nelems = nelems;
+            // System.out.println("====> leaving scope " + this.hashCode() + " owned by " + this.owner + " to " + next.hashCode());
+            // new Error().printStackTrace(System.out);
+            return next;
+        }
 
-                    private void update() {
-                        skipToNextMatchingEntry();
-                        while (currEntry == null && currScope.next != null) {
-                            currScope = currScope.next;
-                            currEntry = currScope.elems;
-                            skipToNextMatchingEntry();
-                        }
-                    }
-
-                    void skipToNextMatchingEntry() {
-                        while (currEntry != null && !sf.accepts(currEntry.sym)) {
-                            currEntry = currEntry.sibling;
-                        }
-                    }
-                };
+        /** Double size of hash table.
+         */
+        private void dble() {
+            Assert.check(shared == 0);
+            Entry[] oldtable = table;
+            Entry[] newtable = new Entry[oldtable.length * 2];
+            for (ScopeImpl s = this; s != null; s = s.next) {
+                if (s.table == oldtable) {
+                    Assert.check(s == this || s.shared != 0);
+                    s.table = newtable;
+                    s.hashMask = newtable.length - 1;
+                }
             }
-        };
-    }
+            int n = 0;
+            for (int i = oldtable.length; --i >= 0; ) {
+                Entry e = oldtable[i];
+                if (e != null && e != sentinel) {
+                    table[getIndex(e.sym.name)] = e;
+                    n++;
+                }
+            }
+            // We don't need to update nelems for shared inherited scopes,
+            // since that gets handled by leave().
+            nelems = n;
+        }
 
-    public Iterable<Symbol> getElementsByName(Name name) {
-        return getElementsByName(name, noFilter);
-    }
+        /** Enter symbol sym in this scope.
+         */
+        public void enter(Symbol sym) {
+            Assert.check(shared == 0);
+            if (nelems * 3 >= hashMask * 2)
+                dble();
+            int hash = getIndex(sym.name);
+            Entry old = table[hash];
+            if (old == null) {
+                old = sentinel;
+                nelems++;
+            }
+            Entry e = new Entry(sym, old, elems, this);
+            table[hash] = e;
+            elems = e;
 
-    public Iterable<Symbol> getElementsByName(final Name name, final Filter<Symbol> sf) {
-        return new Iterable<Symbol>() {
-            public Iterator<Symbol> iterator() {
-                 return new Iterator<Symbol>() {
-                    Scope.Entry currentEntry = lookup(name, sf);
+            //notify listeners
+            for (List<ScopeListener> l = listeners; l.nonEmpty(); l = l.tail) {
+                l.head.symbolAdded(sym, this);
+            }
+        }
 
-                    public boolean hasNext() {
-                        return currentEntry.scope != null;
-                    }
-                    public Symbol next() {
-                        Scope.Entry prevEntry = currentEntry;
-                        currentEntry = currentEntry.next(sf);
-                        return prevEntry.sym;
-                    }
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
-                };
+        /** Remove symbol from this scope.  Used when an inner class
+         *  attribute tells us that the class isn't a package member.
+         */
+        public void remove(Symbol sym) {
+            Assert.check(shared == 0);
+            Entry e = lookup(sym.name);
+            if (e.scope == null) return;
+
+            // remove e from table and shadowed list;
+            int i = getIndex(sym.name);
+            Entry te = table[i];
+            if (te == e)
+                table[i] = e.shadowed;
+            else while (true) {
+                if (te.shadowed == e) {
+                    te.shadowed = e.shadowed;
+                    break;
+                }
+                te = te.shadowed;
             }
-        };
-    }
 
-    public String toString() {
-        StringBuilder result = new StringBuilder();
-        result.append("Scope[");
-        for (Scope s = this; s != null ; s = s.next) {
-            if (s != this) result.append(" | ");
-            for (Entry e = s.elems; e != null; e = e.sibling) {
-                if (e != s.elems) result.append(", ");
-                result.append(e.sym);
+            // remove e from elems and sibling list
+            te = elems;
+            if (te == e)
+                elems = e.sibling;
+            else while (true) {
+                if (te.sibling == e) {
+                    te.sibling = e.sibling;
+                    break;
+                }
+                te = te.sibling;
+            }
+
+            //notify listeners
+            for (List<ScopeListener> l = listeners; l.nonEmpty(); l = l.tail) {
+                l.head.symbolRemoved(sym, this);
             }
         }
-        result.append("]");
-        return result.toString();
+
+        /** Enter symbol sym in this scope if not already there.
+         */
+        public void enterIfAbsent(Symbol sym) {
+            Assert.check(shared == 0);
+            Entry e = lookup(sym.name);
+            while (e.scope == this && e.sym.kind != sym.kind) e = e.next();
+            if (e.scope != this) enter(sym);
+        }
+
+        /** Given a class, is there already a class with same fully
+         *  qualified name in this (import) scope?
+         */
+        public boolean includes(Symbol c) {
+            for (Scope.Entry e = lookup(c.name);
+                 e.scope == this;
+                 e = e.next()) {
+                if (e.sym == c) return true;
+            }
+            return false;
+        }
+
+        /** Return the entry associated with given name, starting in
+         *  this scope and proceeding outwards. If no entry was found,
+         *  return the sentinel, which is characterized by having a null in
+         *  both its scope and sym fields, whereas both fields are non-null
+         *  for regular entries.
+         */
+        protected Entry lookup(Name name) {
+            return lookup(name, noFilter);
+        }
+
+        protected Entry lookup(Name name, Filter<Symbol> sf) {
+            Entry e = table[getIndex(name)];
+            if (e == null || e == sentinel)
+                return sentinel;
+            while (e.scope != null && (e.sym.name != name || (sf != null && !sf.accepts(e.sym))))
+                e = e.shadowed;
+            return e;
+        }
+
+        public Symbol findFirst(Name name, Filter<Symbol> sf) {
+            return lookup(name, sf).sym;
+        }
+
+        /*void dump (java.io.PrintStream out) {
+            out.println(this);
+            for (int l=0; l < table.length; l++) {
+                Entry le = table[l];
+                out.print("#"+l+": ");
+                if (le==sentinel) out.println("sentinel");
+                else if(le == null) out.println("null");
+                else out.println(""+le+" s:"+le.sym);
+            }
+        }*/
+
+        /** Look for slot in the table.
+         *  We use open addressing with double hashing.
+         */
+        int getIndex (Name name) {
+            int h = name.hashCode();
+            int i = h & hashMask;
+            // The expression below is always odd, so it is guaranteed
+            // to be mutually prime with table.length, a power of 2.
+            int x = hashMask - ((h + (h >> 16)) << 1);
+            int d = -1; // Index of a deleted item.
+            for (;;) {
+                Entry e = table[i];
+                if (e == null)
+                    return d >= 0 ? d : i;
+                if (e == sentinel) {
+                    // We have to keep searching even if we see a deleted item.
+                    // However, remember the index in case we fail to find the name.
+                    if (d < 0)
+                        d = i;
+                } else if (e.sym.name == name)
+                    return i;
+                i = (i + x) & hashMask;
+            }
+        }
+
+        public boolean anyMatch(Filter<Symbol> sf) {
+            return getSymbols(sf, NON_RECURSIVE).iterator().hasNext();
+        }
+
+        public Iterable<Symbol> getSymbols(final Filter<Symbol> sf,
+                                           final LookupKind lookupKind) {
+            return new Iterable<Symbol>() {
+                public Iterator<Symbol> iterator() {
+                    return new Iterator<Symbol>() {
+                        private ScopeImpl currScope = ScopeImpl.this;
+                        private Scope.Entry currEntry = elems;
+                        {
+                            update();
+                        }
+
+                        public boolean hasNext() {
+                            return currEntry != null;
+                        }
+
+                        public Symbol next() {
+                            Symbol sym = (currEntry == null ? null : currEntry.sym);
+                            if (currEntry != null) {
+                                currEntry = currEntry.sibling;
+                            }
+                            update();
+                            return sym;
+                        }
+
+                        public void remove() {
+                            throw new UnsupportedOperationException();
+                        }
+
+                        private void update() {
+                            skipToNextMatchingEntry();
+                            if (lookupKind == RECURSIVE) {
+                                while (currEntry == null && currScope.next != null) {
+                                    currScope = currScope.next;
+                                    currEntry = currScope.elems;
+                                    skipToNextMatchingEntry();
+                                }
+                            }
+                        }
+
+                        void skipToNextMatchingEntry() {
+                            while (currEntry != null && sf != null && !sf.accepts(currEntry.sym)) {
+                                currEntry = currEntry.sibling;
+                            }
+                        }
+                    };
+                }
+            };
+        }
+
+        public Iterable<Symbol> getSymbolsByName(final Name name,
+                                                 final Filter<Symbol> sf,
+                                                 final LookupKind lookupKind) {
+            return new Iterable<Symbol>() {
+                public Iterator<Symbol> iterator() {
+                     return new Iterator<Symbol>() {
+                        Scope.Entry currentEntry = lookup(name, sf);
+
+                        public boolean hasNext() {
+                            return currentEntry.scope != null &&
+                                    (lookupKind == RECURSIVE ||
+                                     currentEntry.scope == ScopeImpl.this);
+                        }
+                        public Symbol next() {
+                            Scope.Entry prevEntry = currentEntry;
+                            currentEntry = currentEntry.next(sf);
+                            return prevEntry.sym;
+                        }
+                        public void remove() {
+                            throw new UnsupportedOperationException();
+                        }
+                    };
+                }
+            };
+        }
+
+        public Scope getOrigin(Symbol s) {
+            for (Scope.Entry e = lookup(s.name); e.scope != null ; e = e.next()) {
+                if (e.sym == s) {
+                    return this;
+                }
+            }
+            return null;
+        }
+
+        @Override
+        public boolean isStaticallyImported(Symbol s) {
+            return false;
+        }
+
+        public String toString() {
+            StringBuilder result = new StringBuilder();
+            result.append("Scope[");
+            for (ScopeImpl s = this; s != null ; s = s.next) {
+                if (s != this) result.append(" | ");
+                for (Entry e = s.elems; e != null; e = e.sibling) {
+                    if (e != s.elems) result.append(", ");
+                    result.append(e.sym);
+                }
+            }
+            result.append("]");
+            return result.toString();
+        }
     }
 
     /** A class for scope entries.
      */
-    public static class Entry {
+    private static class Entry {
 
         /** The referenced symbol.
          *  sym == null   iff   this == sentinel
@@ -475,8 +623,6 @@
 
         /** The entry's scope.
          *  scope == null   iff   this == sentinel
-         *  for an entry in an import scope, this is the scope
-         *  where the entry came from (i.e. was imported from).
          */
         public Scope scope;
 
@@ -495,101 +641,201 @@
         }
 
         public Entry next(Filter<Symbol> sf) {
-            if (shadowed.sym == null || sf.accepts(shadowed.sym)) return shadowed;
+            if (shadowed.sym == null || sf == null || sf.accepts(shadowed.sym)) return shadowed;
             else return shadowed.next(sf);
         }
 
-        public boolean isStaticallyImported() {
-            return false;
+    }
+
+    public static class NamedImportScope extends CompoundScope {
+
+        public NamedImportScope(Symbol owner, Scope currentFileScope) {
+            super(owner);
+            prependSubScope(currentFileScope);
+        }
+
+        public void importByName(Scope delegate, Scope origin, Name name, ImportFilter filter) {
+            appendScope(new FilterImportScope(delegate, origin, name, filter, true));
+        }
+
+        public void importType(Scope delegate, Scope origin, Symbol sym) {
+            appendScope(new SingleEntryScope(delegate.owner, sym, origin));
+        }
+
+        private void appendScope(Scope newScope) {
+            List<Scope> existingScopes = this.subScopes.reverse();
+            subScopes = List.of(existingScopes.head);
+            subScopes = subScopes.prepend(newScope);
+            for (Scope s : existingScopes.tail) {
+                subScopes = subScopes.prepend(s);
+            }
         }
 
-        public Scope getOrigin() {
-            // The origin is only recorded for import scopes.  For all
-            // other scope entries, the "enclosing" type is available
-            // from other sources.  See Attr.visitSelect and
-            // Attr.visitIdent.  Rather than throwing an assertion
-            // error, we return scope which will be the same as origin
-            // in many cases.
-            return scope;
+        private static class SingleEntryScope extends Scope {
+
+            private final Symbol sym;
+            private final List<Symbol> content;
+            private final Scope origin;
+
+            public SingleEntryScope(Symbol owner, Symbol sym, Scope origin) {
+                super(owner);
+                this.sym = sym;
+                this.content = List.of(sym);
+                this.origin = origin;
+            }
+
+            @Override
+            public Iterable<Symbol> getSymbols(Filter<Symbol> sf, LookupKind lookupKind) {
+                return sf == null || sf.accepts(sym) ? content : Collections.<Symbol>emptyList();
+            }
+
+            @Override
+            public Iterable<Symbol> getSymbolsByName(Name name,
+                                                     Filter<Symbol> sf,
+                                                     LookupKind lookupKind) {
+                return sym.name == name &&
+                       (sf == null || sf.accepts(sym)) ? content : Collections.<Symbol>emptyList();
+            }
+
+            @Override
+            public Scope getOrigin(Symbol byName) {
+                return sym == byName ? origin : null;
+            }
+
+            @Override
+            public boolean isStaticallyImported(Symbol byName) {
+                return false;
+            }
+
         }
     }
 
-    public static class ImportScope extends Scope {
-
-        public ImportScope(Symbol owner) {
-            super(owner);
-        }
-
-        @Override
-        Entry makeEntry(Symbol sym, Entry shadowed, Entry sibling, Scope scope,
-                final Scope origin, final boolean staticallyImported) {
-            return new Entry(sym, shadowed, sibling, scope) {
-                @Override
-                public Scope getOrigin() {
-                    return origin;
-                }
-
-                @Override
-                public boolean isStaticallyImported() {
-                    return staticallyImported;
-                }
-            };
-        }
-    }
-
-    public static class StarImportScope extends ImportScope implements ScopeListener {
+    public static class StarImportScope extends CompoundScope {
 
         public StarImportScope(Symbol owner) {
             super(owner);
         }
 
-        public void importAll (Scope fromScope) {
-            for (Scope.Entry e = fromScope.elems; e != null; e = e.sibling) {
-                if (e.sym.kind == Kinds.TYP && !includes(e.sym))
-                    enter(e.sym, fromScope);
+        public void importAll(Scope delegate,
+                              Scope origin,
+                              ImportFilter filter,
+                              boolean staticImport) {
+            for (Scope existing : subScopes) {
+                Assert.check(existing instanceof FilterImportScope);
+                FilterImportScope fis = (FilterImportScope) existing;
+                if (fis.delegate == delegate && fis.origin == origin &&
+                    fis.filter == filter && fis.staticImport == staticImport)
+                    return ; //avoid entering the same scope twice
             }
-            // Register to be notified when imported items are removed
-            fromScope.addScopeListener(this);
+            prependSubScope(new FilterImportScope(delegate, origin, null, filter, staticImport));
         }
 
-        public void symbolRemoved(Symbol sym, Scope s) {
-            remove(sym);
-        }
-        public void symbolAdded(Symbol sym, Scope s) { }
+    }
+
+    public interface ImportFilter {
+        public boolean accepts(Scope origin, Symbol sym);
     }
 
-    /** An empty scope, into which you can't place anything.  Used for
-     *  the scope for a variable initializer.
-     */
-    public static class DelegatedScope extends Scope {
-        Scope delegatee;
-        public static final Entry[] emptyTable = new Entry[0];
+    private static class FilterImportScope extends Scope {
+
+        private final Scope delegate;
+        private final Scope origin;
+        private final Name  filterName;
+        private final ImportFilter filter;
+        private final boolean staticImport;
+
+        public FilterImportScope(Scope delegate,
+                                 Scope origin,
+                                 Name  filterName,
+                                 ImportFilter filter,
+                                 boolean staticImport) {
+            super(delegate.owner);
+            this.delegate = delegate;
+            this.origin = origin;
+            this.filterName = filterName;
+            this.filter = filter;
+            this.staticImport = staticImport;
+        }
 
-        public DelegatedScope(Scope outer) {
-            super(outer, outer.owner, emptyTable);
-            delegatee = outer;
+        @Override
+        public Iterable<Symbol> getSymbols(Filter<Symbol> sf, LookupKind lookupKind) {
+            if (filterName != null)
+                return getSymbolsByName(filterName, sf, lookupKind);
+            return new FilteredIterable(delegate.getSymbols(sf, lookupKind));
         }
-        public Scope dup() {
-            return new DelegatedScope(next);
+
+        @Override
+        public Iterable<Symbol> getSymbolsByName(Name name,
+                                                 Filter<Symbol> sf,
+                                                 LookupKind lookupKind) {
+            if (filterName != null && filterName != name)
+                return Collections.emptyList();
+            return new FilteredIterable(delegate.getSymbolsByName(name, sf, lookupKind));
+        }
+
+        @Override
+        public Scope getOrigin(Symbol byName) {
+            return origin;
+        }
+
+        @Override
+        public boolean isStaticallyImported(Symbol byName) {
+            return staticImport;
         }
-        public Scope dupUnshared() {
-            return new DelegatedScope(next);
-        }
-        public Scope leave() {
-            return next;
-        }
-        public void enter(Symbol sym) {
-            // only anonymous classes could be put here
+
+        private class FilteredIterator implements Iterator<Symbol> {
+            private final Iterator<Symbol> delegate;
+            private Symbol next;
+
+            public FilteredIterator(Iterator<Symbol> delegate) {
+                this.delegate = delegate;
+                update();
+            }
+
+            void update() {
+                while (delegate.hasNext()) {
+                    if (filter.accepts(origin, next = delegate.next()))
+                        return;
+                }
+
+                next = null;
+            }
+
+            @Override
+            public boolean hasNext() {
+                return next != null;
+            }
+
+            @Override
+            public Symbol next() {
+                Symbol result = next;
+
+                update();
+
+                return result;
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException("Not supported.");
+            }
+
         }
-        public void enter(Symbol sym, Scope s) {
-            // only anonymous classes could be put here
+
+        private class FilteredIterable implements Iterable<Symbol> {
+
+            private final Iterable<Symbol> unfiltered;
+
+            public FilteredIterable(Iterable<Symbol> unfiltered) {
+                this.unfiltered = unfiltered;
+            }
+
+            @Override
+            public Iterator<Symbol> iterator() {
+                return new FilteredIterator(unfiltered.iterator());
+            }
         }
-        public void remove(Symbol sym) {
-            throw new AssertionError(sym);
-        }
-        public Entry lookup(Name name) {
-            return delegatee.lookup(name);
-        }
+
     }
 
     /** A class scope adds capabilities to keep track of changes in related
@@ -600,16 +846,14 @@
      */
     public static class CompoundScope extends Scope implements ScopeListener {
 
-        public static final Entry[] emptyTable = new Entry[0];
-
-        private List<Scope> subScopes = List.nil();
+        List<Scope> subScopes = List.nil();
         private int mark = 0;
 
         public CompoundScope(Symbol owner) {
-            super(null, owner, emptyTable);
+            super(owner);
         }
 
-        public void addSubScope(Scope that) {
+        public void prependSubScope(Scope that) {
            if (that != null) {
                 subScopes = subScopes.prepend(that);
                 that.addScopeListener(this);
@@ -618,7 +862,7 @@
                     sl.symbolAdded(null, this); //propagate upwards in case of nested CompoundScopes
                 }
            }
-         }
+        }
 
         public void symbolAdded(Symbol sym, Scope s) {
             mark++;
@@ -653,12 +897,13 @@
         }
 
         @Override
-        public Iterable<Symbol> getElements(final Filter<Symbol> sf) {
+        public Iterable<Symbol> getSymbols(final Filter<Symbol> sf,
+                                           final LookupKind lookupKind) {
             return new Iterable<Symbol>() {
                 public Iterator<Symbol> iterator() {
                     return new CompoundScopeIterator(subScopes) {
                         Iterator<Symbol> nextIterator(Scope s) {
-                            return s.getElements(sf).iterator();
+                            return s.getSymbols(sf, lookupKind).iterator();
                         }
                     };
                 }
@@ -666,18 +911,40 @@
         }
 
         @Override
-        public Iterable<Symbol> getElementsByName(final Name name, final Filter<Symbol> sf) {
+        public Iterable<Symbol> getSymbolsByName(final Name name,
+                                                 final Filter<Symbol> sf,
+                                                 final LookupKind lookupKind) {
             return new Iterable<Symbol>() {
                 public Iterator<Symbol> iterator() {
                     return new CompoundScopeIterator(subScopes) {
                         Iterator<Symbol> nextIterator(Scope s) {
-                            return s.getElementsByName(name, sf).iterator();
+                            return s.getSymbolsByName(name, sf, lookupKind).iterator();
                         }
                     };
                 }
             };
         }
 
+        @Override
+        public Scope getOrigin(Symbol sym) {
+            for (Scope delegate : subScopes) {
+                if (delegate.includes(sym))
+                    return delegate.getOrigin(sym);
+            }
+
+            return null;
+        }
+
+        @Override
+        public boolean isStaticallyImported(Symbol sym) {
+            for (Scope delegate : subScopes) {
+                if (delegate.includes(sym))
+                    return delegate.isStaticallyImported(sym);
+            }
+
+            return false;
+        }
+
         abstract class CompoundScopeIterator implements Iterator<Symbol> {
 
             private Iterator<Symbol> currentIterator;
@@ -715,41 +982,21 @@
                 currentIterator = null;
             }
         }
-
-        @Override
-        public Entry lookup(Name name, Filter<Symbol> sf) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Scope dup(Symbol newOwner) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void enter(Symbol sym, Scope s, Scope origin, boolean staticallyImported) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void remove(Symbol sym) {
-            throw new UnsupportedOperationException();
-        }
     }
 
     /** An error scope, for which the owner should be an error symbol. */
-    public static class ErrorScope extends Scope {
-        ErrorScope(Scope next, Symbol errSymbol, Entry[] table) {
+    public static class ErrorScope extends ScopeImpl {
+        ErrorScope(ScopeImpl next, Symbol errSymbol, Entry[] table) {
             super(next, /*owner=*/errSymbol, table);
         }
         public ErrorScope(Symbol errSymbol) {
             super(errSymbol);
         }
-        public Scope dup() {
-            return new ErrorScope(this, owner, table);
+        public WriteableScope dup(Symbol newOwner) {
+            return new ErrorScope(this, newOwner, table);
         }
-        public Scope dupUnshared() {
-            return new ErrorScope(this, owner, table.clone());
+        public WriteableScope dupUnshared(Symbol newOwner) {
+            return new ErrorScope(this, newOwner, table.clone());
         }
         public Entry lookup(Name name) {
             Entry e = super.lookup(name);
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Wed Jul 05 19:50:06 2017 +0200
@@ -105,7 +105,11 @@
         this.name = name;
     }
 
-    public static final Source DEFAULT = JDK1_9;
+    public static final Source MIN = Source.JDK1_6;
+
+    private static final Source MAX = values()[values().length - 1];
+
+    public static final Source DEFAULT = MAX;
 
     public static Source lookup(String name) {
         return tab.get(name);
@@ -121,19 +125,6 @@
         return Target.JDK1_1;
     }
 
-    /** Allow encoding errors, giving only warnings. */
-    public boolean allowEncodingErrors() {
-        return compareTo(JDK1_6) < 0;
-    }
-    public boolean allowAsserts() {
-        return compareTo(JDK1_4) >= 0;
-    }
-    public boolean allowCovariantReturns() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean allowGenerics() {
-        return compareTo(JDK1_5) >= 0;
-    }
     public boolean allowDiamond() {
         return compareTo(JDK1_7) >= 0;
     }
@@ -146,37 +137,6 @@
     public boolean allowImprovedCatchAnalysis() {
         return compareTo(JDK1_7) >= 0;
     }
-    public boolean allowEnums() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean allowForeach() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean allowStaticImport() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean allowBoxing() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean allowVarargs() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean allowAnnotations() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    // hex floating-point literals supported?
-    public boolean allowHexFloats() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean allowAnonOuterThis() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean addBridges() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean enforceMandatoryWarnings() {
-        return compareTo(JDK1_5) >= 0;
-    }
     public boolean allowTryWithResources() {
         return compareTo(JDK1_7) >= 0;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Jul 05 19:50:06 2017 +0200
@@ -33,19 +33,21 @@
 import javax.lang.model.element.*;
 import javax.tools.JavaFileObject;
 
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.jvm.*;
+import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.Name;
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.code.TypeTag.FORALL;
 import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
-import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
 
 /** Root class for Java symbols. It contains subclasses
  *  for specific sorts of symbols, such as variables, methods and operators,
@@ -376,7 +378,7 @@
 
     /** If this is a class or package, its members, otherwise null.
      */
-    public Scope members() {
+    public WriteableScope members() {
         return null;
     }
 
@@ -475,15 +477,13 @@
         if (currentClass == owner) {
             return this;
         }
-        Scope.Entry e = currentClass.members().lookup(name);
-        while (e.scope != null) {
-            if (e.sym.kind == kind &&
+        for (Symbol sym : currentClass.members().getSymbolsByName(name)) {
+            if (sym.kind == kind &&
                     (kind != MTH ||
-                    (e.sym.flags() & STATIC) != 0 &&
-                    types.isSubSignature(e.sym.type, type))) {
-                return e.sym;
+                    (sym.flags() & STATIC) != 0 &&
+                    types.isSubSignature(sym.type, type))) {
+                return sym;
             }
-            e = e.next();
         }
         Symbol hiddenSym = null;
         for (Type st : types.interfaces(currentClass.type)
@@ -632,7 +632,7 @@
         public boolean isConstructor() { return other.isConstructor(); }
         public Name getQualifiedName() { return other.getQualifiedName(); }
         public Name flatName() { return other.flatName(); }
-        public Scope members() { return other.members(); }
+        public WriteableScope members() { return other.members(); }
         public boolean isInner() { return other.isInner(); }
         public boolean hasOuterInstance() { return other.hasOuterInstance(); }
         public ClassSymbol enclClass() { return other.enclClass(); }
@@ -721,9 +721,9 @@
             if (kind == TYP && type.hasTag(TYPEVAR)) {
                 return list;
             }
-            for (Scope.Entry e = members().elems; e != null; e = e.sibling) {
-                if (e.sym != null && (e.sym.flags() & SYNTHETIC) == 0 && e.sym.owner == this)
-                    list = list.prepend(e.sym);
+            for (Symbol sym : members().getSymbols(NON_RECURSIVE)) {
+                if (sym != null && (sym.flags() & SYNTHETIC) == 0 && sym.owner == this)
+                    list = list.prepend(sym);
             }
             return list;
         }
@@ -818,7 +818,7 @@
     public static class PackageSymbol extends TypeSymbol
         implements PackageElement {
 
-        public Scope members_field;
+        public WriteableScope members_field;
         public Name fullname;
         public ClassSymbol package_info; // see bug 6443073
 
@@ -845,7 +845,7 @@
             return name.isEmpty() && owner != null;
         }
 
-        public Scope members() {
+        public WriteableScope members() {
             if (completer != null) complete();
             return members_field;
         }
@@ -910,7 +910,7 @@
         /** a scope for all class members; variables, methods and inner classes
          *  type parameters are not part of this scope
          */
-        public Scope members_field;
+        public WriteableScope members_field;
 
         /** the fully qualified name of the class, i.e. pck.outer.inner.
          *  null for anonymous classes
@@ -971,7 +971,7 @@
             return flags_field;
         }
 
-        public Scope members() {
+        public WriteableScope members() {
             if (completer != null) complete();
             return members_field;
         }
@@ -1397,15 +1397,13 @@
 
         public Symbol implementedIn(TypeSymbol c, Types types) {
             Symbol impl = null;
-            for (Scope.Entry e = c.members().lookup(name);
-                 impl == null && e.scope != null;
-                 e = e.next()) {
-                if (this.overrides(e.sym, (TypeSymbol)owner, types, true) &&
+            for (Symbol sym : c.members().getSymbolsByName(name)) {
+                if (this.overrides(sym, (TypeSymbol)owner, types, true) &&
                     // FIXME: I suspect the following requires a
                     // subst() for a parametric return type.
                     types.isSameType(type.getReturnType(),
-                                     types.memberType(owner.type, e.sym).getReturnType())) {
-                    impl = e.sym;
+                                     types.memberType(owner.type, sym).getReturnType())) {
+                    impl = sym;
                 }
             }
             return impl;
@@ -1441,12 +1439,10 @@
          */
         public MethodSymbol binaryImplementation(ClassSymbol origin, Types types) {
             for (TypeSymbol c = origin; c != null; c = types.supertype(c.type).tsym) {
-                for (Scope.Entry e = c.members().lookup(name);
-                     e.scope != null;
-                     e = e.next()) {
-                    if (e.sym.kind == MTH &&
-                        ((MethodSymbol)e.sym).binaryOverrides(this, origin, types))
-                        return (MethodSymbol)e.sym;
+                for (Symbol sym : c.members().getSymbolsByName(name)) {
+                    if (sym.kind == MTH &&
+                        ((MethodSymbol)sym).binaryOverrides(this, origin, types))
+                        return (MethodSymbol)sym;
                 }
             }
             return null;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java	Wed Jul 05 19:50:06 2017 +0200
@@ -34,6 +34,7 @@
 import javax.tools.JavaFileObject;
 
 
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.Completer;
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
@@ -366,11 +367,9 @@
                     } catch (CompletionFailure e) {
                         sym.flags_field |= PUBLIC;
                         ((ClassType) sym.type).supertype_field = objectType;
-                        Name n = target.boxWithConstructors() ? names.init : names.valueOf;
                         MethodSymbol boxMethod =
-                            new MethodSymbol(PUBLIC | STATIC,
-                                n,
-                                new MethodType(List.of(type), sym.type,
+                            new MethodSymbol(PUBLIC | STATIC, names.valueOf,
+                                             new MethodType(List.of(type), sym.type,
                                     List.<Type>nil(), methodClass),
                                 sym);
                         sym.members().enter(boxMethod);
@@ -396,7 +395,7 @@
         sym.completer = null;
         sym.flags_field = PUBLIC|ACYCLIC|ANNOTATION|INTERFACE;
         sym.erasure_field = type;
-        sym.members_field = new Scope(sym);
+        sym.members_field = WriteableScope.create(sym);
         type.typarams_field = List.nil();
         type.allparams_field = List.nil();
         type.supertype_field = annotationType;
@@ -466,7 +465,7 @@
 
         // Create class to hold all predefined constants and operations.
         predefClass = new ClassSymbol(PUBLIC|ACYCLIC, names.empty, rootPackage);
-        Scope scope = new Scope(predefClass);
+        WriteableScope scope = WriteableScope.create(predefClass);
         predefClass.members_field = scope;
 
         // Get the initial completer for Symbols from the ClassFinder
@@ -527,9 +526,7 @@
         comparableType = enterClass("java.lang.Comparable");
         comparatorType = enterClass("java.util.Comparator");
         arraysType = enterClass("java.util.Arrays");
-        iterableType = target.hasIterable()
-            ? enterClass("java.lang.Iterable")
-            : enterClass("java.util.Collection");
+        iterableType = enterClass("java.lang.Iterable");
         iteratorType = enterClass("java.util.Iterator");
         annotationTargetType = enterClass("java.lang.annotation.Target");
         overrideType = enterClass("java.lang.Override");
@@ -578,7 +575,7 @@
         ClassType arrayClassType = (ClassType)arrayClass.type;
         arrayClassType.supertype_field = objectType;
         arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
-        arrayClass.members_field = new Scope(arrayClass);
+        arrayClass.members_field = WriteableScope.create(arrayClass);
         lengthVar = new VarSymbol(
             PUBLIC | FINAL,
             names.length,
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1050,6 +1050,10 @@
         public <R, P> R accept(TypeVisitor<R, P> v, P p) {
             return v.visitUnion(this, p);
         }
+
+        public Iterable<? extends Type> getAlternativeTypes() {
+            return alternatives_field;
+        }
     }
 
     // a clone of a ClassType that knows about the bounds of an intersection type.
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Wed Jul 05 19:50:06 2017 +0200
@@ -80,8 +80,6 @@
     final Symtab syms;
     final JavacMessages messages;
     final Names names;
-    final boolean allowBoxing;
-    final boolean allowCovariantReturns;
     final boolean allowObjectToPrimitiveCast;
     final Check chk;
     final Enter enter;
@@ -105,8 +103,6 @@
         syms = Symtab.instance(context);
         names = Names.instance(context);
         Source source = Source.instance(context);
-        allowBoxing = source.allowBoxing();
-        allowCovariantReturns = source.allowCovariantReturns();
         allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
         chk = Check.instance(context);
         enter = Enter.instance(context);
@@ -292,7 +288,6 @@
         if (tPrimitive == sPrimitive) {
             return isSubtypeUnchecked(t, s, warn);
         }
-        if (!allowBoxing) return false;
         return tPrimitive
             ? isSubtype(boxedClass(t).type, s)
             : isSubtype(unboxedType(t), s);
@@ -403,7 +398,7 @@
             }
 
             final ListBuffer<Symbol> abstracts = new ListBuffer<>();
-            for (Symbol sym : membersCache.getElements(new DescriptorFilter(origin))) {
+            for (Symbol sym : membersCache.getSymbols(new DescriptorFilter(origin))) {
                 Type mtype = memberType(origin.type, sym);
                 if (abstracts.isEmpty() ||
                         (sym.name == abstracts.first().name &&
@@ -633,7 +628,7 @@
         Type descType = findDescriptorType(targets.head);
         ClassSymbol csym = new ClassSymbol(cflags, name, env.enclClass.sym.outermostClass());
         csym.completer = null;
-        csym.members_field = new Scope(csym);
+        csym.members_field = WriteableScope.create(csym);
         MethodSymbol instDescSym = new MethodSymbol(descSym.flags(), descSym.name, descType, csym);
         csym.members_field.enter(instDescSym);
         Type.ClassType ctype = new Type.ClassType(Type.noType, List.<Type>nil(), csym,
@@ -655,7 +650,7 @@
         Symbol descSym = findDescriptorSymbol(origin);
         CompoundScope members = membersClosure(origin.type, false);
         ListBuffer<Symbol> overridden = new ListBuffer<>();
-        outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) {
+        outer: for (Symbol m2 : members.getSymbolsByName(descSym.name, bridgeFilter)) {
             if (m2 == descSym) continue;
             else if (descSym.overrides(m2, origin, Types.this, false)) {
                 for (Symbol m3 : overridden) {
@@ -1312,7 +1307,8 @@
                 UndetVar undetvar = (UndetVar)t;
                 WildcardType wt = (WildcardType)s;
                 switch(wt.kind) {
-                    case UNBOUND: //similar to ? extends Object
+                    case UNBOUND:
+                        break;
                     case EXTENDS: {
                         Type bound = wildUpperBound(s);
                         undetvar.addBound(InferenceBound.UPPER, bound, this);
@@ -1483,8 +1479,7 @@
             return true;
 
         if (t.isPrimitive() != s.isPrimitive())
-            return allowBoxing && (
-                    isConvertible(t, s, warn)
+            return (isConvertible(t, s, warn)
                     || (allowObjectToPrimitiveCast &&
                         s.isPrimitive() &&
                         isSubtype(boxedClass(s).type, t)));
@@ -2289,7 +2284,7 @@
         bc.erasure_field = (bounds.head.hasTag(TYPEVAR)) ?
                 syms.objectType : // error condition, recover
                 erasure(firstExplicitBound);
-        bc.members_field = new Scope(bc);
+        bc.members_field = WriteableScope.create(bc);
         return bc.type;
     }
 
@@ -2618,8 +2613,8 @@
     }
 
     public boolean overridesObjectMethod(TypeSymbol origin, Symbol msym) {
-        for (Scope.Entry e = syms.objectType.tsym.members().lookup(msym.name) ; e.scope != null ; e = e.next()) {
-            if (msym.overrides(e.sym, origin, Types.this, true)) {
+        for (Symbol sym : syms.objectType.tsym.members().getSymbolsByName(msym.name)) {
+            if (msym.overrides(sym, origin, Types.this, true)) {
                 return true;
             }
         }
@@ -2679,12 +2674,10 @@
                 while (t.hasTag(TYPEVAR))
                     t = t.getUpperBound();
                 TypeSymbol c = t.tsym;
-                for (Scope.Entry e = c.members().lookup(ms.name, implFilter);
-                     e.scope != null;
-                     e = e.next(implFilter)) {
-                    if (e.sym != null &&
-                             e.sym.overrides(ms, origin, Types.this, checkResult))
-                        return (MethodSymbol)e.sym;
+                for (Symbol sym : c.members().getSymbolsByName(ms.name, implFilter)) {
+                    if (sym != null &&
+                             sym.overrides(ms, origin, Types.this, checkResult))
+                        return (MethodSymbol)sym;
                 }
             }
             return null;
@@ -2741,11 +2734,11 @@
                     CompoundScope membersClosure = new CompoundScope(csym);
                     if (!skipInterface) {
                         for (Type i : interfaces(t)) {
-                            membersClosure.addSubScope(visit(i, skipInterface));
+                            membersClosure.prependSubScope(visit(i, skipInterface));
                         }
                     }
-                    membersClosure.addSubScope(visit(supertype(t), skipInterface));
-                    membersClosure.addSubScope(csym.members());
+                    membersClosure.prependSubScope(visit(supertype(t), skipInterface));
+                    membersClosure.prependSubScope(csym.members());
                     e = new Entry(skipInterface, membersClosure);
                     _map.put(csym, e);
                 }
@@ -2774,7 +2767,7 @@
     public List<MethodSymbol> interfaceCandidates(Type site, MethodSymbol ms) {
         Filter<Symbol> filter = new MethodFilter(ms, site);
         List<MethodSymbol> candidates = List.nil();
-            for (Symbol s : membersClosure(site, false).getElements(filter)) {
+            for (Symbol s : membersClosure(site, false).getSymbols(filter)) {
                 if (!site.tsym.isInterface() && !s.owner.isInterface()) {
                     return List.of((MethodSymbol)s);
                 } else if (!candidates.contains(s)) {
@@ -3845,8 +3838,6 @@
 
         if (hasSameArgs(r1, r2))
             return covariantReturnType(r1.getReturnType(), r2res, warner);
-        if (!allowCovariantReturns)
-            return false;
         if (isSubtypeUnchecked(r1.getReturnType(), r2res, warner))
             return true;
         if (!isSubtype(r1.getReturnType(), erasure(r2res)))
@@ -3862,7 +3853,6 @@
     public boolean covariantReturnType(Type t, Type s, Warner warner) {
         return
             isSameType(t, s) ||
-            allowCovariantReturns &&
             !t.isPrimitive() &&
             !s.isPrimitive() &&
             isAssignable(t, s, warner);
@@ -3890,13 +3880,11 @@
      * Return the primitive type corresponding to a boxed type.
      */
     public Type unboxedType(Type t) {
-        if (allowBoxing) {
-            for (int i=0; i<syms.boxedName.length; i++) {
-                Name box = syms.boxedName[i];
-                if (box != null &&
-                    asSuper(t, syms.enterClass(box)) != null)
-                    return syms.typeOfTag[i];
-            }
+        for (int i=0; i<syms.boxedName.length; i++) {
+            Name box = syms.boxedName[i];
+            if (box != null &&
+                asSuper(t, syms.enterClass(box)) != null)
+                return syms.typeOfTag[i];
         }
         return Type.noType;
     }
@@ -4075,10 +4063,6 @@
         }
         if (giveWarning && !isReifiable(reverse ? from : to))
             warn.warn(LintCategory.UNCHECKED);
-        if (!allowCovariantReturns)
-            // reject if there is a common method signature with
-            // incompatible return types.
-            chk.checkCompatibleAbstracts(warn.pos(), from, to);
         return true;
     }
 
@@ -4102,10 +4086,6 @@
         Type t2 = to;
         if (disjointTypes(t1.getTypeArguments(), t2.getTypeArguments()))
             return false;
-        if (!allowCovariantReturns)
-            // reject if there is a common method signature with
-            // incompatible return types.
-            chk.checkCompatibleAbstracts(warn.pos(), from, to);
         if (!isReifiable(target) &&
             (reverse ? giveWarning(t2, t1) : giveWarning(t1, t2)))
             warn.warn(LintCategory.UNCHECKED);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Wed Jul 05 19:50:06 2017 +0200
@@ -690,7 +690,7 @@
         Scope scope = targetContainerType.tsym.members();
         int nr_value_elems = 0;
         boolean error = false;
-        for(Symbol elm : scope.getElementsByName(names.value)) {
+        for(Symbol elm : scope.getSymbolsByName(names.value)) {
             nr_value_elems++;
 
             if (nr_value_elems == 1 &&
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Jul 05 19:50:06 2017 +0200
@@ -37,6 +37,7 @@
 import com.sun.source.util.SimpleTreeVisitor;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Lint.LintCategory;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.comp.Check.CheckContext;
@@ -126,12 +127,6 @@
         Options options = Options.instance(context);
 
         Source source = Source.instance(context);
-        allowGenerics = source.allowGenerics();
-        allowVarargs = source.allowVarargs();
-        allowEnums = source.allowEnums();
-        allowBoxing = source.allowBoxing();
-        allowCovariantReturns = source.allowCovariantReturns();
-        allowAnonOuterThis = source.allowAnonOuterThis();
         allowStringsInSwitch = source.allowStringsInSwitch();
         allowPoly = source.allowPoly();
         allowTypeAnnos = source.allowTypeAnnotations();
@@ -167,26 +162,6 @@
      */
     boolean allowTypeAnnos;
 
-    /** Switch: support generics?
-     */
-    boolean allowGenerics;
-
-    /** Switch: allow variable-arity methods.
-     */
-    boolean allowVarargs;
-
-    /** Switch: support enums?
-     */
-    boolean allowEnums;
-
-    /** Switch: support boxing and unboxing?
-     */
-    boolean allowBoxing;
-
-    /** Switch: support covariant result types?
-     */
-    boolean allowCovariantReturns;
-
     /** Switch: support lambda expressions ?
      */
     boolean allowLambda;
@@ -199,11 +174,6 @@
      */
     boolean allowStaticInterfaceMethods;
 
-    /** Switch: allow references to surrounding object from anonymous
-     * objects during constructor call?
-     */
-    boolean allowAnonOuterThis;
-
     /** Switch: generates a warning if diamond can be safely applied
      *  to a given new expression
      */
@@ -618,14 +588,11 @@
         return newEnv;
     }
 
-    Scope copyScope(Scope sc) {
-        Scope newScope = new Scope(sc.owner);
+    WriteableScope copyScope(WriteableScope sc) {
+        WriteableScope newScope = WriteableScope.create(sc.owner);
         List<Symbol> elemsList = List.nil();
-        while (sc != null) {
-            for (Scope.Entry e = sc.elems ; e != null ; e = e.sibling) {
-                elemsList = elemsList.prepend(e.sym);
-            }
-            sc = sc.next;
+        for (Symbol sym : sc.getSymbols()) {
+            elemsList = elemsList.prepend(sym);
         }
         for (Symbol s : elemsList) {
             newScope.enter(s);
@@ -823,7 +790,7 @@
                 return types.createErrorType(t);
             }
         } else {
-            t = chk.checkClassType(tree.pos(), t, checkExtensible|!allowGenerics);
+            t = chk.checkClassType(tree.pos(), t, checkExtensible);
         }
         if (interfaceExpected && (t.tsym.flags() & INTERFACE) == 0) {
             log.error(tree.pos(), "intf.expected.here");
@@ -1140,12 +1107,12 @@
             // Block is a static or instance initializer;
             // let the owner of the environment be a freshly
             // created BLOCK-method.
-            final Env<AttrContext> localEnv =
-                env.dup(tree, env.info.dup(env.info.scope.dupUnshared()));
-            localEnv.info.scope.owner =
+            Symbol fakeOwner =
                 new MethodSymbol(tree.flags | BLOCK |
                     env.info.scope.owner.flags() & STRICTFP, names.empty, null,
                     env.info.scope.owner);
+            final Env<AttrContext> localEnv =
+                env.dup(tree, env.info.dup(env.info.scope.dupUnshared(fakeOwner)));
 
             if ((tree.flags & STATIC) != 0) localEnv.info.staticLevel++;
             attribStats(tree.stats, localEnv);
@@ -1264,9 +1231,7 @@
 
         try {
 
-            boolean enumSwitch =
-                allowEnums &&
-                (seltype.tsym.flags() & Flags.ENUM) != 0;
+            boolean enumSwitch = (seltype.tsym.flags() & Flags.ENUM) != 0;
             boolean stringSwitch = false;
             if (types.isSameType(seltype, syms.stringType)) {
                 if (allowStringsInSwitch) {
@@ -1328,7 +1293,7 @@
     }
     // where
         /** Add any variables defined in stats to the switch scope. */
-        private static void addVars(List<JCStatement> stats, Scope switchScope) {
+        private static void addVars(List<JCStatement> stats, WriteableScope switchScope) {
             for (;stats.nonEmpty(); stats = stats.tail) {
                 JCTree stat = stats.head;
                 if (stat.hasTag(VARDEF))
@@ -1344,10 +1309,9 @@
         }
         JCIdent ident = (JCIdent)tree;
         Name name = ident.name;
-        for (Scope.Entry e = enumType.tsym.members().lookup(name);
-             e.scope != null; e = e.next()) {
-            if (e.sym.kind == VAR) {
-                Symbol s = ident.sym = e.sym;
+        for (Symbol sym : enumType.tsym.members().getSymbolsByName(name)) {
+            if (sym.kind == VAR) {
+                Symbol s = ident.sym = sym;
                 ((VarSymbol)s).getConstValue(); // ensure initializer is evaluated
                 ident.type = s.type;
                 return ((s.flags_field & Flags.ENUM) == 0)
@@ -1557,9 +1521,9 @@
             if (types.isSameType(thentype, elsetype))
                 return thentype.baseType();
 
-            Type thenUnboxed = (!allowBoxing || thentype.isPrimitive())
+            Type thenUnboxed = (thentype.isPrimitive())
                 ? thentype : types.unboxedType(thentype);
-            Type elseUnboxed = (!allowBoxing || elsetype.isPrimitive())
+            Type elseUnboxed = (elsetype.isPrimitive())
                 ? elsetype : types.unboxedType(elsetype);
 
             // Otherwise, if both arms can be converted to a numeric
@@ -1591,19 +1555,17 @@
             }
 
             // Those were all the cases that could result in a primitive
-            if (allowBoxing) {
-                if (thentype.isPrimitive())
-                    thentype = types.boxedClass(thentype).type;
-                if (elsetype.isPrimitive())
-                    elsetype = types.boxedClass(elsetype).type;
-            }
+            if (thentype.isPrimitive())
+                thentype = types.boxedClass(thentype).type;
+            if (elsetype.isPrimitive())
+                elsetype = types.boxedClass(elsetype).type;
 
             if (types.isSubtype(thentype, elsetype))
                 return elsetype.baseType();
             if (types.isSubtype(elsetype, thentype))
                 return thentype.baseType();
 
-            if (!allowBoxing || thentype.hasTag(VOID) || elsetype.hasTag(VOID)) {
+            if (thentype.hasTag(VOID) || elsetype.hasTag(VOID)) {
                 log.error(pos, "neither.conditional.subtype",
                           thentype, elsetype);
                 return thentype.baseType();
@@ -1856,7 +1818,7 @@
 
                     // if we're calling a java.lang.Enum constructor,
                     // prefix the implicit String and int parameters
-                    if (site.tsym == syms.enumSym && allowEnums)
+                    if (site.tsym == syms.enumSym)
                         argtypes = argtypes.prepend(syms.intType).prepend(syms.stringType);
 
                     // Resolve the called constructor under the assumption
@@ -1935,15 +1897,11 @@
     }
     //where
         Type adjustMethodReturnType(Type qualifierType, Name methodName, List<Type> argtypes, Type restype) {
-            if (allowCovariantReturns &&
-                    methodName == names.clone &&
-                types.isArray(qualifierType)) {
+            if (methodName == names.clone && types.isArray(qualifierType)) {
                 // as a special case, array.clone() has a result that is
                 // the same as static type of the array being cloned
                 return qualifierType;
-            } else if (allowGenerics &&
-                    methodName == names.getClass &&
-                    argtypes.isEmpty()) {
+            } else if (methodName == names.getClass && argtypes.isEmpty()) {
                 // as a special case, x.getClass() has type Class<? extends |X|>
                 return new ClassType(restype.getEnclosingType(),
                               List.<Type>of(new WildcardType(types.erasure(qualifierType),
@@ -2136,10 +2094,9 @@
         // If we have made no mistakes in the class type...
         if (clazztype.hasTag(CLASS)) {
             // Enums may not be instantiated except implicitly
-            if (allowEnums &&
-                (clazztype.tsym.flags_field&Flags.ENUM) != 0 &&
+            if ((clazztype.tsym.flags_field & Flags.ENUM) != 0 &&
                 (!env.tree.hasTag(VARDEF) ||
-                 (((JCVariableDecl) env.tree).mods.flags&Flags.ENUM) == 0 ||
+                 (((JCVariableDecl) env.tree).mods.flags & Flags.ENUM) == 0 ||
                  ((JCVariableDecl) env.tree).init != tree))
                 log.error(tree.pos(), "enum.cant.be.instantiated");
             // Check that class is not abstract
@@ -2343,7 +2300,7 @@
                     Symbol descriptor = types.findDescriptorSymbol(clazztype.tsym);
                     int count = 0;
                     boolean found = false;
-                    for (Symbol sym : csym.members().getElements()) {
+                    for (Symbol sym : csym.members().getSymbols()) {
                         if ((sym.flags() & SYNTHETIC) != 0 ||
                                 sym.isConstructor()) continue;
                         count++;
@@ -2774,15 +2731,15 @@
             Symbol owner = env.info.scope.owner;
             if (owner.kind == VAR && owner.owner.kind == TYP) {
                 //field initializer
-                lambdaEnv = env.dup(that, env.info.dup(env.info.scope.dupUnshared()));
                 ClassSymbol enclClass = owner.enclClass();
+                Symbol newScopeOwner = env.info.scope.owner;
                 /* if the field isn't static, then we can get the first constructor
                  * and use it as the owner of the environment. This is what
                  * LTM code is doing to look for type annotations so we are fine.
                  */
                 if ((owner.flags() & STATIC) == 0) {
-                    for (Symbol s : enclClass.members_field.getElementsByName(names.init)) {
-                        lambdaEnv.info.scope.owner = s;
+                    for (Symbol s : enclClass.members_field.getSymbolsByName(names.init)) {
+                        newScopeOwner = s;
                         break;
                     }
                 } else {
@@ -2798,8 +2755,9 @@
                         clinit.params = List.<VarSymbol>nil();
                         clinits.put(enclClass, clinit);
                     }
-                    lambdaEnv.info.scope.owner = clinit;
+                    newScopeOwner = clinit;
                 }
+                lambdaEnv = env.dup(that, env.info.dup(env.info.scope.dupUnshared(newScopeOwner)));
             } else {
                 lambdaEnv = env.dup(that, env.info.dup(env.info.scope.dup()));
             }
@@ -3372,7 +3330,7 @@
             while (symEnv.outer != null &&
                    !sym.isMemberOf(symEnv.enclClass.sym, types)) {
                 if ((symEnv.enclClass.sym.flags() & NOOUTERTHIS) != 0)
-                    noOuterThisPath = !allowAnonOuterThis;
+                    noOuterThisPath = false;
                 symEnv = symEnv.outer;
             }
         }
@@ -3594,9 +3552,7 @@
                     // In this case, we have already made sure in
                     // visitSelect that qualifier expression is a type.
                     Type t = syms.classType;
-                    List<Type> typeargs = allowGenerics
-                        ? List.of(types.erasure(site))
-                        : List.<Type>nil();
+                    List<Type> typeargs = List.of(types.erasure(site));
                     t = new ClassType(t.getEnclosingType(), typeargs, t.tsym);
                     return new VarSymbol(
                         STATIC | PUBLIC | FINAL, names._class, t, site.tsym);
@@ -3776,8 +3732,7 @@
                 // Test (4): if symbol is an instance field of a raw type,
                 // which is being assigned to, issue an unchecked warning if
                 // its type changes under erasure.
-                if (allowGenerics &&
-                    resultInfo.pkind == VAR &&
+                if (resultInfo.pkind == VAR &&
                     v.owner.kind == TYP &&
                     (v.flags() & STATIC) == 0 &&
                     (site.hasTag(CLASS) || site.hasTag(TYPEVAR))) {
@@ -3957,8 +3912,7 @@
                             List<Type> typeargtypes) {
         // Test (5): if symbol is an instance method of a raw type, issue
         // an unchecked warning if its argument types change under erasure.
-        if (allowGenerics &&
-            (sym.flags() & STATIC) == 0 &&
+        if ((sym.flags() & STATIC) == 0 &&
             (site.hasTag(CLASS) || site.hasTag(TYPEVAR))) {
             Type s = types.asOuterSuper(site, sym.owner);
             if (s != null && s.isRaw() &&
@@ -4515,7 +4469,7 @@
 
         for (List<JCTypeParameter> l = tree.typarams;
              l.nonEmpty(); l = l.tail) {
-             Assert.checkNonNull(env.info.scope.lookup(l.head.name).scope);
+             Assert.checkNonNull(env.info.scope.findFirst(l.head.name));
         }
 
         // Check that a generic class doesn't extend Throwable
@@ -4602,16 +4556,21 @@
         private void checkSerialVersionUID(JCClassDecl tree, ClassSymbol c) {
 
             // check for presence of serialVersionUID
-            Scope.Entry e = c.members().lookup(names.serialVersionUID);
-            while (e.scope != null && e.sym.kind != VAR) e = e.next();
-            if (e.scope == null) {
+            VarSymbol svuid = null;
+            for (Symbol sym : c.members().getSymbolsByName(names.serialVersionUID)) {
+                if (sym.kind == VAR) {
+                    svuid = (VarSymbol)sym;
+                    break;
+                }
+            }
+
+            if (svuid == null) {
                 log.warning(LintCategory.SERIAL,
                         tree.pos(), "missing.SVUID", c);
                 return;
             }
 
             // check that it is static final
-            VarSymbol svuid = (VarSymbol)e.sym;
             if ((svuid.flags() & (STATIC | FINAL)) !=
                 (STATIC | FINAL))
                 log.warning(LintCategory.SERIAL,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Wed Jul 05 19:50:06 2017 +0200
@@ -27,6 +27,7 @@
 
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 
 /** Contains information specific to the attribute and enter
  *  passes, to be used in place of the generic field in environments.
@@ -40,7 +41,7 @@
 
     /** The scope of local symbols.
      */
-    Scope scope = null;
+    WriteableScope scope = null;
 
     /** The number of enclosing `static' modifiers.
      */
@@ -87,7 +88,7 @@
 
     /** Duplicate this context, replacing scope field and copying all others.
      */
-    AttrContext dup(Scope scope) {
+    AttrContext dup(WriteableScope scope) {
         AttrContext info = new AttrContext();
         info.scope = scope;
         info.staticLevel = staticLevel;
@@ -112,7 +113,7 @@
     public Iterable<Symbol> getLocalElements() {
         if (scope == null)
             return List.nil();
-        return scope.getElements();
+        return scope.getSymbols();
     }
 
     boolean lastResolveVarargs() {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Attribute.Compound;
@@ -39,6 +40,8 @@
 
 import com.sun.tools.javac.code.Lint;
 import com.sun.tools.javac.code.Lint.LintCategory;
+import com.sun.tools.javac.code.Scope.NamedImportScope;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
@@ -51,6 +54,7 @@
 import static com.sun.tools.javac.code.Flags.ANNOTATION;
 import static com.sun.tools.javac.code.Flags.SYNCHRONIZED;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.code.TypeTag.WILDCARD;
 
@@ -120,10 +124,6 @@
         fileManager = context.get(JavaFileManager.class);
 
         Source source = Source.instance(context);
-        allowGenerics = source.allowGenerics();
-        allowVarargs = source.allowVarargs();
-        allowAnnotations = source.allowAnnotations();
-        allowCovariantReturns = source.allowCovariantReturns();
         allowSimplifiedVarargs = source.allowSimplifiedVarargs();
         allowDefaultMethods = source.allowDefaultMethods();
         allowStrictMethodClashCheck = source.allowStrictMethodClashCheck();
@@ -142,7 +142,7 @@
         boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION);
         boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED);
         boolean verboseSunApi = lint.isEnabled(LintCategory.SUNAPI);
-        boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings();
+        boolean enforceMandatoryWarnings = true;
 
         deprecationHandler = new MandatoryWarningHandler(log, verboseDeprecated,
                 enforceMandatoryWarnings, "deprecated", LintCategory.DEPRECATION);
@@ -154,22 +154,6 @@
         deferredLintHandler = DeferredLintHandler.instance(context);
     }
 
-    /** Switch: generics enabled?
-     */
-    boolean allowGenerics;
-
-    /** Switch: varargs enabled?
-     */
-    boolean allowVarargs;
-
-    /** Switch: annotations enabled?
-     */
-    boolean allowAnnotations;
-
-    /** Switch: covariant returns enabled?
-     */
-    boolean allowCovariantReturns;
-
     /** Switch: simplified varargs enabled?
      */
     boolean allowSimplifiedVarargs;
@@ -362,16 +346,13 @@
      *  @param s             The scope.
      */
     void checkTransparentVar(DiagnosticPosition pos, VarSymbol v, Scope s) {
-        if (s.next != null) {
-            for (Scope.Entry e = s.next.lookup(v.name);
-                 e.scope != null && e.sym.owner == v.owner;
-                 e = e.next()) {
-                if (e.sym.kind == VAR &&
-                    (e.sym.owner.kind & (VAR | MTH)) != 0 &&
-                    v.name != names.error) {
-                    duplicateError(pos, e.sym);
-                    return;
-                }
+        for (Symbol sym : s.getSymbolsByName(v.name)) {
+            if (sym.owner != v.owner) break;
+            if (sym.kind == VAR &&
+                (sym.owner.kind & (VAR | MTH)) != 0 &&
+                v.name != names.error) {
+                duplicateError(pos, sym);
+                return;
             }
         }
     }
@@ -383,16 +364,13 @@
      *  @param s             The scope.
      */
     void checkTransparentClass(DiagnosticPosition pos, ClassSymbol c, Scope s) {
-        if (s.next != null) {
-            for (Scope.Entry e = s.next.lookup(c.name);
-                 e.scope != null && e.sym.owner == c.owner;
-                 e = e.next()) {
-                if (e.sym.kind == TYP && !e.sym.type.hasTag(TYPEVAR) &&
-                    (e.sym.owner.kind & (VAR | MTH)) != 0 &&
-                    c.name != names.error) {
-                    duplicateError(pos, e.sym);
-                    return;
-                }
+        for (Symbol sym : s.getSymbolsByName(c.name)) {
+            if (sym.owner != c.owner) break;
+            if (sym.kind == TYP && !sym.type.hasTag(TYPEVAR) &&
+                (sym.owner.kind & (VAR | MTH)) != 0 &&
+                c.name != names.error) {
+                duplicateError(pos, sym);
+                return;
             }
         }
     }
@@ -405,9 +383,9 @@
      *  @param s             The enclosing scope.
      */
     boolean checkUniqueClassName(DiagnosticPosition pos, Name name, Scope s) {
-        for (Scope.Entry e = s.lookup(name); e.scope == s; e = e.next()) {
-            if (e.sym.kind == TYP && e.sym.name != names.error) {
-                duplicateError(pos, e.sym);
+        for (Symbol sym : s.getSymbolsByName(name, NON_RECURSIVE)) {
+            if (sym.kind == TYP && sym.name != names.error) {
+                duplicateError(pos, sym);
                 return false;
             }
         }
@@ -905,8 +883,7 @@
                     assertConvertible(arg, arg.type, varArg, warn);
                     args = args.tail;
                 }
-            } else if ((sym.flags() & (VARARGS | SIGNATURE_POLYMORPHIC)) == VARARGS &&
-                    allowVarargs) {
+            } else if ((sym.flags() & (VARARGS | SIGNATURE_POLYMORPHIC)) == VARARGS) {
                 // non-varargs call to varargs method
                 Type varParam = owntype.getParameterTypes().last();
                 Type lastArg = argtypes.last();
@@ -1673,18 +1650,12 @@
         boolean resultTypesOK =
             types.returnTypeSubstitutable(mt, ot, otres, overrideWarner);
         if (!resultTypesOK) {
-            if (!allowCovariantReturns &&
-                m.owner != origin &&
-                m.owner.isSubClass(other.owner, types)) {
-                // allow limited interoperability with covariant returns
-            } else {
-                log.error(TreeInfo.diagnosticPositionFor(m, tree),
-                          "override.incompatible.ret",
-                          cannotOverride(m, other),
-                          mtres, otres);
-                m.flags_field |= BAD_OVERRIDE;
-                return;
-            }
+            log.error(TreeInfo.diagnosticPositionFor(m, tree),
+                      "override.incompatible.ret",
+                      cannotOverride(m, other),
+                      mtres, otres);
+            m.flags_field |= BAD_OVERRIDE;
+            return;
         } else if (overrideWarner.hasNonSilentLint(LintCategory.UNCHECKED)) {
             warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree),
                     "override.unchecked.ret",
@@ -1778,10 +1749,7 @@
         for (Type t1 = sup;
              t1.hasTag(CLASS) && t1.tsym.type.isParameterized();
              t1 = types.supertype(t1)) {
-            for (Scope.Entry e1 = t1.tsym.members().elems;
-                 e1 != null;
-                 e1 = e1.sibling) {
-                Symbol s1 = e1.sym;
+            for (Symbol s1 : t1.tsym.members().getSymbols(NON_RECURSIVE)) {
                 if (s1.kind != MTH ||
                     (s1.flags() & (STATIC|SYNTHETIC|BRIDGE)) != 0 ||
                     !s1.isInheritedIn(site.tsym, types) ||
@@ -1796,10 +1764,7 @@
                 for (Type t2 = sup;
                      t2.hasTag(CLASS);
                      t2 = types.supertype(t2)) {
-                    for (Scope.Entry e2 = t2.tsym.members().lookup(s1.name);
-                         e2.scope != null;
-                         e2 = e2.next()) {
-                        Symbol s2 = e2.sym;
+                    for (Symbol s2 : t2.tsym.members().getSymbolsByName(s1.name)) {
                         if (s2 == s1 ||
                             s2.kind != MTH ||
                             (s2.flags() & (STATIC|SYNTHETIC|BRIDGE)) != 0 ||
@@ -1827,13 +1792,6 @@
      */
     public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
                                             Type t1,
-                                            Type t2) {
-        return checkCompatibleAbstracts(pos, t1, t2,
-                                        types.makeCompoundType(t1, t2));
-    }
-
-    public boolean checkCompatibleAbstracts(DiagnosticPosition pos,
-                                            Type t1,
                                             Type t2,
                                             Type site) {
         if ((site.tsym.flags() & COMPOUND) != 0) {
@@ -1893,15 +1851,13 @@
 
     /** Return the first method in t2 that conflicts with a method from t1. */
     private Symbol firstDirectIncompatibility(DiagnosticPosition pos, Type t1, Type t2, Type site) {
-        for (Scope.Entry e1 = t1.tsym.members().elems; e1 != null; e1 = e1.sibling) {
-            Symbol s1 = e1.sym;
+        for (Symbol s1 : t1.tsym.members().getSymbols(NON_RECURSIVE)) {
             Type st1 = null;
             if (s1.kind != MTH || !s1.isInheritedIn(site.tsym, types) ||
                     (s1.flags() & SYNTHETIC) != 0) continue;
             Symbol impl = ((MethodSymbol)s1).implementation(site.tsym, types, false);
             if (impl != null && (impl.flags() & ABSTRACT) == 0) continue;
-            for (Scope.Entry e2 = t2.tsym.members().lookup(s1.name); e2.scope != null; e2 = e2.next()) {
-                Symbol s2 = e2.sym;
+            for (Symbol s2 : t2.tsym.members().getSymbolsByName(s1.name)) {
                 if (s1 == s2) continue;
                 if (s2.kind != MTH || !s2.isInheritedIn(site.tsym, types) ||
                         (s2.flags() & SYNTHETIC) != 0) continue;
@@ -1944,8 +1900,7 @@
         Type st2 = types.memberType(site, s2);
         closure(site, supertypes);
         for (Type t : supertypes.values()) {
-            for (Scope.Entry e = t.tsym.members().lookup(s1.name); e.scope != null; e = e.next()) {
-                Symbol s3 = e.sym;
+            for (Symbol s3 : t.tsym.members().getSymbolsByName(s1.name)) {
                 if (s3 == s1 || s3 == s2 || s3.kind != MTH || (s3.flags() & (BRIDGE|SYNTHETIC)) != 0) continue;
                 Type st3 = types.memberType(site,s3);
                 if (types.overrideEquivalent(st3, st1) &&
@@ -1995,14 +1950,12 @@
 
     void checkOverride(JCTree tree, Type site, ClassSymbol origin, MethodSymbol m) {
         TypeSymbol c = site.tsym;
-        Scope.Entry e = c.members().lookup(m.name);
-        while (e.scope != null) {
-            if (m.overrides(e.sym, origin, types, false)) {
-                if ((e.sym.flags() & ABSTRACT) == 0) {
-                    checkOverride(tree, m, (MethodSymbol)e.sym, origin);
+        for (Symbol sym : c.members().getSymbolsByName(m.name)) {
+            if (m.overrides(sym, origin, types, false)) {
+                if ((sym.flags() & ABSTRACT) == 0) {
+                    checkOverride(tree, m, (MethodSymbol)sym, origin);
                 }
             }
-            e = e.next();
         }
     }
 
@@ -2037,9 +1990,9 @@
             ClassSymbol someClass) {
         if (lint.isEnabled(LintCategory.OVERRIDES)) {
             MethodSymbol equalsAtObject = (MethodSymbol)syms.objectType
-                    .tsym.members().lookup(names.equals).sym;
+                    .tsym.members().findFirst(names.equals);
             MethodSymbol hashCodeAtObject = (MethodSymbol)syms.objectType
-                    .tsym.members().lookup(names.hashCode).sym;
+                    .tsym.members().findFirst(names.hashCode);
             boolean overridesEquals = types.implementation(equalsAtObject,
                 someClass, false, equalsHasCodeFilter).owner == someClass;
             boolean overridesHashCode = types.implementation(hashCodeAtObject,
@@ -2095,12 +2048,10 @@
             // since they cannot have abstract members.
             if (c == impl || (c.flags() & (ABSTRACT | INTERFACE)) != 0) {
                 Scope s = c.members();
-                for (Scope.Entry e = s.elems;
-                     undef == null && e != null;
-                     e = e.sibling) {
-                    if (e.sym.kind == MTH &&
-                        (e.sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
-                        MethodSymbol absmeth = (MethodSymbol)e.sym;
+                for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
+                    if (sym.kind == MTH &&
+                        (sym.flags() & (ABSTRACT|IPROXY|DEFAULT)) == ABSTRACT) {
+                        MethodSymbol absmeth = (MethodSymbol)sym;
                         MethodSymbol implmeth = absmeth.implementation(impl, types, true);
                         if (implmeth == null || implmeth == absmeth) {
                             //look for default implementations
@@ -2113,6 +2064,7 @@
                         }
                         if (implmeth == null || implmeth == absmeth) {
                             undef = absmeth;
+                            break;
                         }
                     }
                 }
@@ -2335,11 +2287,11 @@
         void checkImplementations(JCTree tree, ClassSymbol origin, ClassSymbol ic) {
             for (List<Type> l = types.closure(ic.type); l.nonEmpty(); l = l.tail) {
                 ClassSymbol lc = (ClassSymbol)l.head.tsym;
-                if ((allowGenerics || origin != lc) && (lc.flags() & ABSTRACT) != 0) {
-                    for (Scope.Entry e=lc.members().elems; e != null; e=e.sibling) {
-                        if (e.sym.kind == MTH &&
-                            (e.sym.flags() & (STATIC|ABSTRACT)) == ABSTRACT) {
-                            MethodSymbol absmeth = (MethodSymbol)e.sym;
+                if ((lc.flags() & ABSTRACT) != 0) {
+                    for (Symbol sym : lc.members().getSymbols(NON_RECURSIVE)) {
+                        if (sym.kind == MTH &&
+                            (sym.flags() & (STATIC|ABSTRACT)) == ABSTRACT) {
+                            MethodSymbol absmeth = (MethodSymbol)sym;
                             MethodSymbol implmeth = absmeth.implementation(origin, types, false);
                             if (implmeth != null && implmeth != absmeth &&
                                 (implmeth.owner.flags() & INTERFACE) ==
@@ -2370,7 +2322,7 @@
             (supertype.tsym.flags() & ABSTRACT) != 0)
             supertypes = supertypes.prepend(supertype);
         for (List<Type> l = supertypes; l.nonEmpty(); l = l.tail) {
-            if (allowGenerics && !l.head.getTypeArguments().isEmpty() &&
+            if (!l.head.getTypeArguments().isEmpty() &&
                 !checkCompatibleAbstracts(pos, l.head, l.head, c))
                 return;
             for (List<Type> m = supertypes; m != l; m = m.tail)
@@ -2382,15 +2334,15 @@
 
     void checkConflicts(DiagnosticPosition pos, Symbol sym, TypeSymbol c) {
         for (Type ct = c.type; ct != Type.noType ; ct = types.supertype(ct)) {
-            for (Scope.Entry e = ct.tsym.members().lookup(sym.name); e.scope == ct.tsym.members(); e = e.next()) {
+            for (Symbol sym2 : ct.tsym.members().getSymbolsByName(sym.name, NON_RECURSIVE)) {
                 // VM allows methods and variables with differing types
-                if (sym.kind == e.sym.kind &&
-                    types.isSameType(types.erasure(sym.type), types.erasure(e.sym.type)) &&
-                    sym != e.sym &&
-                    (sym.flags() & Flags.SYNTHETIC) != (e.sym.flags() & Flags.SYNTHETIC) &&
-                    (sym.flags() & IPROXY) == 0 && (e.sym.flags() & IPROXY) == 0 &&
-                    (sym.flags() & BRIDGE) == 0 && (e.sym.flags() & BRIDGE) == 0) {
-                    syntheticError(pos, (e.sym.flags() & SYNTHETIC) == 0 ? e.sym : sym);
+                if (sym.kind == sym2.kind &&
+                    types.isSameType(types.erasure(sym.type), types.erasure(sym2.type)) &&
+                    sym != sym2 &&
+                    (sym.flags() & Flags.SYNTHETIC) != (sym2.flags() & Flags.SYNTHETIC) &&
+                    (sym.flags() & IPROXY) == 0 && (sym2.flags() & IPROXY) == 0 &&
+                    (sym.flags() & BRIDGE) == 0 && (sym2.flags() & BRIDGE) == 0) {
+                    syntheticError(pos, (sym2.flags() & SYNTHETIC) == 0 ? sym2 : sym);
                     return;
                 }
             }
@@ -2411,7 +2363,7 @@
 
         List<MethodSymbol> potentiallyAmbiguousList = List.nil();
         boolean overridesAny = false;
-        for (Symbol m1 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
+        for (Symbol m1 : types.membersClosure(site, false).getSymbolsByName(sym.name, cf)) {
             if (!sym.overrides(m1, site.tsym, types, false)) {
                 if (m1 == sym) {
                     continue;
@@ -2429,7 +2381,7 @@
             }
 
             //...check each method m2 that is a member of 'site'
-            for (Symbol m2 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
+            for (Symbol m2 : types.membersClosure(site, false).getSymbolsByName(sym.name, cf)) {
                 if (m2 == m1) continue;
                 //if (i) the signature of 'sym' is not a subsignature of m1 (seen as
                 //a member of 'site') and (ii) m1 has the same erasure as m2, issue an error
@@ -2466,7 +2418,7 @@
     void checkHideClashes(DiagnosticPosition pos, Type site, MethodSymbol sym) {
         ClashFilter cf = new ClashFilter(site);
         //for each method m1 that is a member of 'site'...
-        for (Symbol s : types.membersClosure(site, true).getElementsByName(sym.name, cf)) {
+        for (Symbol s : types.membersClosure(site, true).getSymbolsByName(sym.name, cf)) {
             //if (i) the signature of 'sym' is not a subsignature of m1 (seen as
             //a member of 'site') and (ii) 'sym' has the same erasure as m1, issue an error
             if (!types.isSubSignature(sym.type, types.memberType(site, s), allowStrictMethodClashCheck)) {
@@ -2508,7 +2460,7 @@
 
     void checkDefaultMethodClashes(DiagnosticPosition pos, Type site) {
         DefaultMethodClashFilter dcf = new DefaultMethodClashFilter(site);
-        for (Symbol m : types.membersClosure(site, false).getElements(dcf)) {
+        for (Symbol m : types.membersClosure(site, false).getSymbols(dcf)) {
             Assert.check(m.kind == MTH);
             List<MethodSymbol> prov = types.interfaceCandidates(site, (MethodSymbol)m);
             if (prov.size() > 1) {
@@ -2772,11 +2724,11 @@
     void validateAnnotationMethod(DiagnosticPosition pos, MethodSymbol m) {
         for (Type sup = syms.annotationType; sup.hasTag(CLASS); sup = types.supertype(sup)) {
             Scope s = sup.tsym.members();
-            for (Scope.Entry e = s.lookup(m.name); e.scope != null; e = e.next()) {
-                if (e.sym.kind == MTH &&
-                    (e.sym.flags() & (PUBLIC | PROTECTED)) != 0 &&
-                    types.overrideEquivalent(m.type, e.sym.type))
-                    log.error(pos, "intf.annotation.member.clash", e.sym, sup);
+            for (Symbol sym : s.getSymbolsByName(m.name)) {
+                if (sym.kind == MTH &&
+                    (sym.flags() & (PUBLIC | PROTECTED)) != 0 &&
+                    types.overrideEquivalent(m.type, sym.type))
+                    log.error(pos, "intf.annotation.member.clash", sym, sup);
             }
         }
     }
@@ -2856,9 +2808,9 @@
     }
 
     private void validateValue(TypeSymbol container, TypeSymbol contained, DiagnosticPosition pos) {
-        Scope.Entry e = container.members().lookup(names.value);
-        if (e.scope != null && e.sym.kind == MTH) {
-            MethodSymbol m = (MethodSymbol) e.sym;
+        Symbol sym = container.members().findFirst(names.value);
+        if (sym != null && sym.kind == MTH) {
+            MethodSymbol m = (MethodSymbol) sym;
             Type ret = m.getReturnType();
             if (!(ret.hasTag(ARRAY) && types.isSameType(((ArrayType)ret).elemtype, contained.type))) {
                 log.error(pos, "invalid.repeatable.annotation.value.return",
@@ -3003,7 +2955,7 @@
     private void validateDefault(Symbol container, DiagnosticPosition pos) {
         // validate that all other elements of containing type has defaults
         Scope scope = container.members();
-        for(Symbol elm : scope.getElements()) {
+        for(Symbol elm : scope.getSymbols()) {
             if (elm.name != names.value &&
                 elm.kind == Kinds.MTH &&
                 ((MethodSymbol)elm).defaultValue == null) {
@@ -3025,8 +2977,8 @@
             if (sup == owner.type)
                 continue; // skip "this"
             Scope scope = sup.tsym.members();
-            for (Scope.Entry e = scope.lookup(m.name); e.scope != null; e = e.next()) {
-                if (!e.sym.isStatic() && m.overrides(e.sym, owner, types, true))
+            for (Symbol sym : scope.getSymbolsByName(m.name)) {
+                if (!sym.isStatic() && m.overrides(sym, owner, types, true))
                     return true;
             }
         }
@@ -3160,12 +3112,10 @@
         boolean isValid = true;
         // collect an inventory of the annotation elements
         Set<MethodSymbol> members = new LinkedHashSet<>();
-        for (Scope.Entry e = a.annotationType.type.tsym.members().elems;
-                e != null;
-                e = e.sibling)
-            if (e.sym.kind == MTH && e.sym.name != names.clinit &&
-                    (e.sym.flags() & SYNTHETIC) == 0)
-                members.add((MethodSymbol) e.sym);
+        for (Symbol sym : a.annotationType.type.tsym.members().getSymbols(NON_RECURSIVE))
+            if (sym.kind == MTH && sym.name != names.clinit &&
+                    (sym.flags() & SYNTHETIC) == 0)
+                members.add((MethodSymbol) sym);
 
         // remove the ones that are assigned values
         for (JCTree arg : a.args) {
@@ -3220,8 +3170,7 @@
     }
 
     void checkDeprecatedAnnotation(DiagnosticPosition pos, Symbol s) {
-        if (allowAnnotations &&
-            lint.isEnabled(LintCategory.DEP_ANN) &&
+        if (lint.isEnabled(LintCategory.DEP_ANN) &&
             (s.flags() & DEPRECATED) != 0 &&
             !syms.deprecatedType.isErroneous() &&
             s.attribute(syms.deprecatedType.tsym) == null) {
@@ -3293,8 +3242,7 @@
         }
         try {
             tsym.flags_field |= LOCKED;
-            for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
-                Symbol s = e.sym;
+            for (Symbol s : tsym.members().getSymbols(NON_RECURSIVE)) {
                 if (s.kind != Kinds.MTH)
                     continue;
                 checkAnnotationResType(pos, ((MethodSymbol)s).type.getReturnType());
@@ -3436,23 +3384,23 @@
         if (sym.type.isErroneous())
             return true;
         if (sym.owner.name == names.any) return false;
-        for (Scope.Entry e = s.lookup(sym.name); e.scope == s; e = e.next()) {
-            if (sym != e.sym &&
-                    (e.sym.flags() & CLASH) == 0 &&
-                    sym.kind == e.sym.kind &&
+        for (Symbol byName : s.getSymbolsByName(sym.name, NON_RECURSIVE)) {
+            if (sym != byName &&
+                    (byName.flags() & CLASH) == 0 &&
+                    sym.kind == byName.kind &&
                     sym.name != names.error &&
                     (sym.kind != MTH ||
-                     types.hasSameArgs(sym.type, e.sym.type) ||
-                     types.hasSameArgs(types.erasure(sym.type), types.erasure(e.sym.type)))) {
-                if ((sym.flags() & VARARGS) != (e.sym.flags() & VARARGS)) {
-                    varargsDuplicateError(pos, sym, e.sym);
+                     types.hasSameArgs(sym.type, byName.type) ||
+                     types.hasSameArgs(types.erasure(sym.type), types.erasure(byName.type)))) {
+                if ((sym.flags() & VARARGS) != (byName.flags() & VARARGS)) {
+                    varargsDuplicateError(pos, sym, byName);
                     return true;
-                } else if (sym.kind == MTH && !types.hasSameArgs(sym.type, e.sym.type, false)) {
-                    duplicateErasureError(pos, sym, e.sym);
+                } else if (sym.kind == MTH && !types.hasSameArgs(sym.type, byName.type, false)) {
+                    duplicateErasureError(pos, sym, byName);
                     sym.flags_field |= CLASH;
                     return true;
                 } else {
-                    duplicateError(pos, e.sym);
+                    duplicateError(pos, byName);
                     return false;
                 }
             }
@@ -3471,47 +3419,50 @@
     /** Check that single-type import is not already imported or top-level defined,
      *  but make an exception for two single-type imports which denote the same type.
      *  @param pos           Position for error reporting.
+     *  @param toplevel      The file in which in the check is performed.
      *  @param sym           The symbol.
-     *  @param s             The scope
      */
-    boolean checkUniqueImport(DiagnosticPosition pos, Symbol sym, Scope s) {
-        return checkUniqueImport(pos, sym, s, false);
+    boolean checkUniqueImport(DiagnosticPosition pos, JCCompilationUnit toplevel, Symbol sym) {
+        return checkUniqueImport(pos, toplevel, sym, false);
     }
 
     /** Check that static single-type import is not already imported or top-level defined,
      *  but make an exception for two single-type imports which denote the same type.
      *  @param pos           Position for error reporting.
+     *  @param toplevel      The file in which in the check is performed.
      *  @param sym           The symbol.
-     *  @param s             The scope
      */
-    boolean checkUniqueStaticImport(DiagnosticPosition pos, Symbol sym, Scope s) {
-        return checkUniqueImport(pos, sym, s, true);
+    boolean checkUniqueStaticImport(DiagnosticPosition pos, JCCompilationUnit toplevel, Symbol sym) {
+        return checkUniqueImport(pos, toplevel, sym, true);
     }
 
     /** Check that single-type import is not already imported or top-level defined,
      *  but make an exception for two single-type imports which denote the same type.
      *  @param pos           Position for error reporting.
+     *  @param toplevel      The file in which in the check is performed.
      *  @param sym           The symbol.
-     *  @param s             The scope.
      *  @param staticImport  Whether or not this was a static import
      */
-    private boolean checkUniqueImport(DiagnosticPosition pos, Symbol sym, Scope s, boolean staticImport) {
-        for (Scope.Entry e = s.lookup(sym.name); e.scope != null; e = e.next()) {
+    private boolean checkUniqueImport(DiagnosticPosition pos, JCCompilationUnit toplevel, Symbol sym, boolean staticImport) {
+        NamedImportScope namedImportScope = toplevel.namedImportScope;
+        WriteableScope topLevelScope = toplevel.toplevelScope;
+
+        for (Symbol byName : namedImportScope.getSymbolsByName(sym.name)) {
             // is encountered class entered via a class declaration?
-            boolean isClassDecl = e.scope == s;
-            if ((isClassDecl || sym != e.sym) &&
-                sym.kind == e.sym.kind &&
+            boolean isClassDecl = namedImportScope.getOrigin(byName) == topLevelScope;
+            if ((isClassDecl || sym != byName) &&
+                sym.kind == byName.kind &&
                 sym.name != names.error &&
-                (!staticImport || !e.isStaticallyImported())) {
-                if (!e.sym.type.isErroneous()) {
+                (!staticImport || !namedImportScope.isStaticallyImported(byName))) {
+                if (!byName.type.isErroneous()) {
                     if (!isClassDecl) {
                         if (staticImport)
-                            log.error(pos, "already.defined.static.single.import", e.sym);
+                            log.error(pos, "already.defined.static.single.import", byName);
                         else
-                        log.error(pos, "already.defined.single.import", e.sym);
+                        log.error(pos, "already.defined.single.import", byName);
                     }
-                    else if (sym != e.sym)
-                        log.error(pos, "already.defined.this.unit", e.sym);
+                    else if (sym != byName)
+                        log.error(pos, "already.defined.this.unit", byName);
                 }
                 return false;
             }
@@ -3610,4 +3561,68 @@
             }
         }
     }
+
+    public void checkImportsResolvable(final JCCompilationUnit toplevel) {
+        for (final JCImport imp : toplevel.getImports()) {
+            if (!imp.staticImport || !imp.qualid.hasTag(SELECT))
+                continue;
+            final JCFieldAccess select = (JCFieldAccess) imp.qualid;
+            final Symbol origin;
+            if (select.name == names.asterisk || (origin = TreeInfo.symbol(select.selected)) == null || origin.kind != TYP)
+                continue;
+
+            JavaFileObject prev = log.useSource(toplevel.sourcefile);
+            try {
+                TypeSymbol site = (TypeSymbol) TreeInfo.symbol(select.selected);
+                if (!checkTypeContainsImportableElement(site, site, toplevel.packge, select.name, new HashSet<Symbol>())) {
+                    log.error(imp.pos(), "cant.resolve.location",
+                              KindName.STATIC,
+                              select.name, List.<Type>nil(), List.<Type>nil(),
+                              Kinds.typeKindName(TreeInfo.symbol(select.selected).type),
+                              TreeInfo.symbol(select.selected).type);
+                }
+            } finally {
+                log.useSource(prev);
+            }
+        }
+    }
+
+    private boolean checkTypeContainsImportableElement(TypeSymbol tsym, TypeSymbol origin, PackageSymbol packge, Name name, Set<Symbol> processed) {
+        if (tsym == null || !processed.add(tsym))
+            return false;
+
+            // also search through inherited names
+        if (checkTypeContainsImportableElement(types.supertype(tsym.type).tsym, origin, packge, name, processed))
+            return true;
+
+        for (Type t : types.interfaces(tsym.type))
+            if (checkTypeContainsImportableElement(t.tsym, origin, packge, name, processed))
+                return true;
+
+        for (Symbol sym : tsym.members().getSymbolsByName(name)) {
+            if (sym.isStatic() &&
+                staticImportAccessible(sym, packge) &&
+                sym.isMemberOf(origin, types)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    // is the sym accessible everywhere in packge?
+    public boolean staticImportAccessible(Symbol sym, PackageSymbol packge) {
+        int flags = (int)(sym.flags() & AccessFlags);
+        switch (flags) {
+        default:
+        case PUBLIC:
+            return true;
+        case PRIVATE:
+            return false;
+        case 0:
+        case PROTECTED:
+            return sym.packge() == packge;
+        }
+    }
+
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Wed Jul 05 19:50:06 2017 +0200
@@ -376,9 +376,8 @@
                              ResultInfo resultInfo,
                              Annotate.PositionCreator creator) {
         final JCTree newTree = new TreeCopier<>(make).copy(tree);
-        Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared()));
+        Env<AttrContext> speculativeEnv = env.dup(newTree, env.info.dup(env.info.scope.dupUnshared(env.info.scope.owner)));
         speculativeEnv.info.isSpeculative = true;
-        speculativeEnv.info.scope.owner = env.info.scope.owner;
         Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
                 new Log.DeferredDiagnosticHandler(log, new Filter<JCDiagnostic>() {
             public boolean accepts(final JCDiagnostic d) {
@@ -517,13 +516,11 @@
                     }
                 }
                 if (!progress) {
-                    DeferredAttrContext dac = this;
-                    while (dac != emptyDeferredAttrContext) {
-                        if (dac.mode == AttrMode.SPECULATIVE) {
-                            //unsticking does not take place during overload
-                            break;
+                    if (insideOverloadPhase()) {
+                        for (DeferredAttrNode deferredNode: deferredAttrNodes) {
+                            deferredNode.dt.tree.type = Type.noType;
                         }
-                        dac = dac.parent;
+                        return;
                     }
                     //remove all variables that have already been instantiated
                     //from the list of stuck variables
@@ -539,6 +536,17 @@
                 }
             }
         }
+
+        private boolean insideOverloadPhase() {
+            DeferredAttrContext dac = this;
+            if (dac == emptyDeferredAttrContext) {
+                return false;
+            }
+            if (dac.mode == AttrMode.SPECULATIVE) {
+                return true;
+            }
+            return dac.parent.insideOverloadPhase();
+        }
     }
 
     /**
@@ -599,6 +607,8 @@
                             return false;
                         }
                     } else {
+                        Assert.check(!deferredAttrContext.insideOverloadPhase(),
+                                "attribution shouldn't be happening here");
                         ResultInfo instResultInfo =
                                 resultInfo.dup(deferredAttrContext.inferenceContext.asInstType(resultInfo.pt));
                         dt.check(instResultInfo, dummyStuckPolicy, basicCompleter);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -191,7 +191,7 @@
      */
     public Env<AttrContext> classEnv(JCClassDecl tree, Env<AttrContext> env) {
         Env<AttrContext> localEnv =
-            env.dup(tree, env.info.dup(new Scope(tree.sym)));
+            env.dup(tree, env.info.dup(WriteableScope.create(tree.sym)));
         localEnv.enclClass = tree;
         localEnv.outer = env;
         localEnv.info.isSelfCall = false;
@@ -207,9 +207,10 @@
         Env<AttrContext> localEnv = new Env<>(tree, new AttrContext());
         localEnv.toplevel = tree;
         localEnv.enclClass = predefClassDef;
-        tree.namedImportScope = new ImportScope(tree.packge);
+        tree.toplevelScope = WriteableScope.create(tree.packge);
+        tree.namedImportScope = new NamedImportScope(tree.packge, tree.toplevelScope);
         tree.starImportScope = new StarImportScope(tree.packge);
-        localEnv.info.scope = tree.namedImportScope;
+        localEnv.info.scope = tree.toplevelScope;
         localEnv.info.lint = lint;
         return localEnv;
     }
@@ -218,7 +219,7 @@
         Env<AttrContext> localEnv = new Env<>(tree, new AttrContext());
         localEnv.toplevel = tree;
         localEnv.enclClass = predefClassDef;
-        localEnv.info.scope = tree.namedImportScope;
+        localEnv.info.scope = tree.toplevelScope;
         localEnv.info.lint = lint;
         return localEnv;
     }
@@ -228,7 +229,7 @@
      *  where the local scope is for type variables, and the this and super symbol
      *  only, and members go into the class member scope.
      */
-    Scope enterScope(Env<AttrContext> env) {
+    WriteableScope enterScope(Env<AttrContext> env) {
         return (env.tree.hasTag(JCTree.Tag.CLASSDEF))
             ? ((JCClassDecl) env.tree).sym.members_field
             : env.info.scope;
@@ -324,7 +325,7 @@
             c.flatname = names.fromString(tree.packge + "." + name);
             c.sourcefile = tree.sourcefile;
             c.completer = null;
-            c.members_field = new Scope(c);
+            c.members_field = WriteableScope.create(c);
             tree.packge.package_info = c;
         }
         classEnter(tree.defs, topEnv);
@@ -338,7 +339,7 @@
     @Override
     public void visitClassDef(JCClassDecl tree) {
         Symbol owner = env.info.scope.owner;
-        Scope enclScope = enterScope(env);
+        WriteableScope enclScope = enterScope(env);
         ClassSymbol c;
         if (owner.kind == PCK) {
             // We are seeing a toplevel class.
@@ -392,7 +393,7 @@
         c.completer = memberEnter;
         c.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, c, tree);
         c.sourcefile = env.toplevel.sourcefile;
-        c.members_field = new Scope(c);
+        c.members_field = WriteableScope.create(c);
 
         ClassType ct = (ClassType)c.type;
         if (owner.kind != PCK && (c.flags_field & STATIC) == 0) {
@@ -495,7 +496,7 @@
                 // if there remain any unimported toplevels (these must have
                 // no classes at all), process their import statements as well.
                 for (JCCompilationUnit tree : trees) {
-                    if (tree.starImportScope.elems == null) {
+                    if (tree.starImportScope.isEmpty()) {
                         JavaFileObject prev = log.useSource(tree.sourcefile);
                         Env<AttrContext> topEnv = topLevelEnv(tree);
                         memberEnter.memberEnter(tree, topEnv);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Wed Jul 05 19:50:06 2017 +0200
@@ -30,6 +30,7 @@
 import java.util.HashMap;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -1419,7 +1420,7 @@
 
         /** The list of unreferenced automatic resources.
          */
-        Scope unrefdResources;
+        WriteableScope unrefdResources;
 
         /** Set when processing a loop body the second time for DU analysis. */
         FlowKind flowKind = FlowKind.NORMAL;
@@ -2410,7 +2411,7 @@
                 nextadr = 0;
                 pendingExits = new ListBuffer<>();
                 this.classDef = null;
-                unrefdResources = new Scope(env.enclClass.sym);
+                unrefdResources = WriteableScope.create(env.enclClass.sym);
                 scan(tree);
             } finally {
                 // note that recursive invocations of this method fail hard
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Wed Jul 05 19:50:06 2017 +0200
@@ -31,7 +31,7 @@
 import com.sun.tools.javac.tree.TreeTranslator;
 import com.sun.tools.javac.code.Attribute;
 import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.DynamicMethodSymbol;
@@ -448,7 +448,7 @@
                 make.at(prevPos);
             }
             // Replace the entered symbol for this variable
-            Scope sc = tree.sym.owner.members();
+            WriteableScope sc = tree.sym.owner.members();
             if (sc != null) {
                 sc.remove(tree.sym);
                 sc.enter(xsym);
@@ -1475,7 +1475,7 @@
                 return clinit;
             } else {
                 //get the first constructor and treat it as the instance init sym
-                for (Symbol s : csym.members_field.getElementsByName(names.init)) {
+                for (Symbol s : csym.members_field.getSymbolsByName(names.init)) {
                     return s;
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 import java.util.*;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.main.Option.PkgInfo;
 import com.sun.tools.javac.tree.*;
@@ -45,6 +46,7 @@
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Flags.BLOCK;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.jvm.ByteCodes.*;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
@@ -80,7 +82,6 @@
     private final Target target;
     private final Source source;
     private final TypeEnvs typeEnvs;
-    private final boolean allowEnums;
     private final Name dollarAssertionsDisabled;
     private final Name classDollar;
     private final Types types;
@@ -101,7 +102,6 @@
         target = Target.instance(context);
         source = Source.instance(context);
         typeEnvs = TypeEnvs.instance(context);
-        allowEnums = source.allowEnums();
         dollarAssertionsDisabled = names.
             fromString(target.syntheticNameChar() + "assertionsDisabled");
         classDollar = names.
@@ -299,7 +299,7 @@
             Symbol sym = _sym;
             if (sym.kind == VAR || sym.kind == MTH) {
                 while (sym != null && sym.owner != owner)
-                    sym = proxies.lookup(proxyName(sym.name)).sym;
+                    sym = proxies.findFirst(proxyName(sym.name));
                 if (sym != null && sym.owner == owner) {
                     VarSymbol v = (VarSymbol)sym;
                     if (v.getConstValue() == null) {
@@ -644,7 +644,7 @@
         }
         c.sourcefile = owner.sourcefile;
         c.completer = null;
-        c.members_field = new Scope(c);
+        c.members_field = WriteableScope.create(c);
         c.flags_field = flags;
         ClassType ctype = (ClassType) c.type;
         ctype.supertype_field = syms.objectType;
@@ -678,7 +678,7 @@
      *  @param sym           The symbol.
      *  @param s             The scope.
      */
-    private void enterSynthetic(DiagnosticPosition pos, Symbol sym, Scope s) {
+    private void enterSynthetic(DiagnosticPosition pos, Symbol sym, WriteableScope s) {
         s.enter(sym);
     }
 
@@ -746,7 +746,7 @@
      *  @param name         The name.
      */
     private Symbol lookupSynthetic(Name name, Scope s) {
-        Symbol sym = s.lookup(name).sym;
+        Symbol sym = s.findFirst(name);
         return (sym==null || (sym.flags()&SYNTHETIC)==0) ? null : sym;
     }
 
@@ -901,11 +901,9 @@
     /** Return binary operator that corresponds to given access code.
      */
     private OperatorSymbol binaryAccessOperator(int acode) {
-        for (Scope.Entry e = syms.predefClass.members().elems;
-             e != null;
-             e = e.sibling) {
-            if (e.sym instanceof OperatorSymbol) {
-                OperatorSymbol op = (OperatorSymbol)e.sym;
+        for (Symbol sym : syms.predefClass.members().getSymbols(NON_RECURSIVE)) {
+            if (sym instanceof OperatorSymbol) {
+                OperatorSymbol op = (OperatorSymbol)sym;
                 if (accessCode(op.opcode) == acode) return op;
             }
         }
@@ -1143,7 +1141,7 @@
                 return makeLit(sym.type, cv);
             }
             // Otherwise replace the variable by its proxy.
-            sym = proxies.lookup(proxyName(sym.name)).sym;
+            sym = proxies.findFirst(proxyName(sym.name));
             Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
             tree = make.at(tree.pos).Ident(sym);
         }
@@ -1459,12 +1457,12 @@
      *  in an additional innermost scope, where they represent the constructor
      *  parameters.
      */
-    Scope proxies;
+    WriteableScope proxies;
 
     /** A scope containing all unnamed resource variables/saved
      *  exception variables for translated TWR blocks
      */
-    Scope twrVars;
+    WriteableScope twrVars;
 
     /** A stack containing the this$n field of the currently translated
      *  classes (if needed) in innermost first order.
@@ -1492,9 +1490,6 @@
     List<JCVariableDecl> freevarDefs(int pos, List<VarSymbol> freevars, Symbol owner,
             long additionalFlags) {
         long flags = FINAL | SYNTHETIC | additionalFlags;
-        if (owner.kind == TYP &&
-            target.usePrivateSyntheticFields())
-            flags |= PRIVATE;
         List<JCVariableDecl> defs = List.nil();
         for (List<VarSymbol> l = freevars; l.nonEmpty(); l = l.tail) {
             VarSymbol v = l.head;
@@ -1519,15 +1514,12 @@
             nestingLevel++;
         }
         Name result = names.fromString("this" + target.syntheticNameChar() + nestingLevel);
-        while (owner.kind == TYP && ((ClassSymbol)owner).members().lookup(result).scope != null)
+        while (owner.kind == TYP && ((ClassSymbol)owner).members().findFirst(result) != null)
             result = names.fromString(result.toString() + target.syntheticNameChar());
         return result;
     }
 
     private VarSymbol makeOuterThisVarSymbol(Symbol owner, long flags) {
-        if (owner.kind == TYP &&
-            target.usePrivateSyntheticFields())
-            flags |= PRIVATE;
         Type target = types.erasure(owner.enclClass().type.getEnclosingType());
         VarSymbol outerThis =
             new VarSymbol(flags, outerThisName(target, owner), target, owner);
@@ -1859,10 +1851,10 @@
      *  name is the name of a free variable.
      */
     JCStatement initField(int pos, Name name) {
-        Scope.Entry e = proxies.lookup(name);
-        Symbol rhs = e.sym;
+        Iterator<Symbol> it = proxies.getSymbolsByName(name).iterator();
+        Symbol rhs = it.next();
         Assert.check(rhs.owner.kind == MTH);
-        Symbol lhs = e.next().sym;
+        Symbol lhs = it.next();
         Assert.check(rhs.owner.owner == lhs.owner);
         make.at(pos);
         return
@@ -1900,13 +1892,11 @@
      */
     private ClassSymbol outerCacheClass() {
         ClassSymbol clazz = outermostClassDef.sym;
-        if ((clazz.flags() & INTERFACE) == 0 &&
-            !target.useInnerCacheClass()) return clazz;
         Scope s = clazz.members();
-        for (Scope.Entry e = s.elems; e != null; e = e.sibling)
-            if (e.sym.kind == TYP &&
-                e.sym.name == names.empty &&
-                (e.sym.flags() & INTERFACE) == 0) return (ClassSymbol) e.sym;
+        for (Symbol sym : s.getSymbols(NON_RECURSIVE))
+            if (sym.kind == TYP &&
+                sym.name == names.empty &&
+                (sym.flags() & INTERFACE) == 0) return (ClassSymbol) sym;
         return makeEmptyClass(STATIC | SYNTHETIC, clazz).sym;
     }
 
@@ -1958,79 +1948,54 @@
 
         JCBlock returnResult;
 
-        // in 1.4.2 and above, we use
-        // Class.forName(String name, boolean init, ClassLoader loader);
-        // which requires we cache the current loader in cl$
-        if (target.classLiteralsNoInit()) {
-            // clsym = "private static ClassLoader cl$"
-            VarSymbol clsym = new VarSymbol(STATIC|SYNTHETIC,
-                                            names.fromString("cl" + target.syntheticNameChar()),
-                                            syms.classLoaderType,
-                                            outerCacheClass);
-            enterSynthetic(pos, clsym, outerCacheClass.members());
-
-            // emit "private static ClassLoader cl$;"
-            JCVariableDecl cldef = make.VarDef(clsym, null);
-            JCClassDecl outerCacheClassDef = classDef(outerCacheClass);
-            outerCacheClassDef.defs = outerCacheClassDef.defs.prepend(cldef);
-
-            // newcache := "new cache$1[0]"
-            JCNewArray newcache = make.
-                NewArray(make.Type(outerCacheClass.type),
-                         List.<JCExpression>of(make.Literal(INT, 0).setType(syms.intType)),
-                         null);
-            newcache.type = new ArrayType(types.erasure(outerCacheClass.type),
-                                          syms.arrayClass, Type.noAnnotations);
-
-            // forNameSym := java.lang.Class.forName(
-            //     String s,boolean init,ClassLoader loader)
-            Symbol forNameSym = lookupMethod(make_pos, names.forName,
-                                             types.erasure(syms.classType),
-                                             List.of(syms.stringType,
-                                                     syms.booleanType,
-                                                     syms.classLoaderType));
-            // clvalue := "(cl$ == null) ?
-            // $newcache.getClass().getComponentType().getClassLoader() : cl$"
-            JCExpression clvalue =
+        // cache the current loader in cl$
+        // clsym = "private static ClassLoader cl$"
+        VarSymbol clsym = new VarSymbol(STATIC | SYNTHETIC,
+                                        names.fromString("cl" + target.syntheticNameChar()),
+                                        syms.classLoaderType,
+                                        outerCacheClass);
+        enterSynthetic(pos, clsym, outerCacheClass.members());
+
+        // emit "private static ClassLoader cl$;"
+        JCVariableDecl cldef = make.VarDef(clsym, null);
+        JCClassDecl outerCacheClassDef = classDef(outerCacheClass);
+        outerCacheClassDef.defs = outerCacheClassDef.defs.prepend(cldef);
+
+        // newcache := "new cache$1[0]"
+        JCNewArray newcache = make.NewArray(make.Type(outerCacheClass.type),
+                                            List.<JCExpression>of(make.Literal(INT, 0).setType(syms.intType)),
+                                            null);
+        newcache.type = new ArrayType(types.erasure(outerCacheClass.type),
+                                      syms.arrayClass, Type.noAnnotations);
+
+        // forNameSym := java.lang.Class.forName(
+        //     String s,boolean init,ClassLoader loader)
+        Symbol forNameSym = lookupMethod(make_pos, names.forName,
+                                         types.erasure(syms.classType),
+                                         List.of(syms.stringType,
+                                                 syms.booleanType,
+                                                 syms.classLoaderType));
+        // clvalue := "(cl$ == null) ?
+        // $newcache.getClass().getComponentType().getClassLoader() : cl$"
+        JCExpression clvalue =
                 make.Conditional(
-                    makeBinary(EQ, make.Ident(clsym), makeNull()),
-                    make.Assign(
-                        make.Ident(clsym),
-                        makeCall(
-                            makeCall(makeCall(newcache,
-                                              names.getClass,
-                                              List.<JCExpression>nil()),
-                                     names.getComponentType,
-                                     List.<JCExpression>nil()),
-                            names.getClassLoader,
-                            List.<JCExpression>nil())).setType(syms.classLoaderType),
-                    make.Ident(clsym)).setType(syms.classLoaderType);
-
-            // returnResult := "{ return Class.forName(param1, false, cl$); }"
-            List<JCExpression> args = List.of(make.Ident(md.params.head.sym),
-                                              makeLit(syms.booleanType, 0),
-                                              clvalue);
-            returnResult = make.
-                Block(0, List.<JCStatement>of(make.
-                              Call(make. // return
-                                   App(make.
-                                       Ident(forNameSym), args))));
-        } else {
-            // forNameSym := java.lang.Class.forName(String s)
-            Symbol forNameSym = lookupMethod(make_pos,
-                                             names.forName,
-                                             types.erasure(syms.classType),
-                                             List.of(syms.stringType));
-            // returnResult := "{ return Class.forName(param1); }"
-            returnResult = make.
-                Block(0, List.of(make.
-                          Call(make. // return
-                              App(make.
-                                  QualIdent(forNameSym),
-                                  List.<JCExpression>of(make.
-                                                        Ident(md.params.
-                                                              head.sym))))));
-        }
+                        makeBinary(EQ, make.Ident(clsym), makeNull()),
+                        make.Assign(make.Ident(clsym),
+                                    makeCall(
+                                            makeCall(makeCall(newcache,
+                                                              names.getClass,
+                                                              List.<JCExpression>nil()),
+                                                     names.getComponentType,
+                                                     List.<JCExpression>nil()),
+                                            names.getClassLoader,
+                                            List.<JCExpression>nil())).setType(syms.classLoaderType),
+                        make.Ident(clsym)).setType(syms.classLoaderType);
+
+        // returnResult := "{ return Class.forName(param1, false, cl$); }"
+        List<JCExpression> args = List.of(make.Ident(md.params.head.sym),
+                                          makeLit(syms.booleanType, 0),
+                                          clvalue);
+        returnResult = make.Block(0, List.<JCStatement>of(make.Call(make.App(make.Ident(forNameSym), args))));
 
         // catchParam := ClassNotFoundException e1
         VarSymbol catchParam =
@@ -2039,27 +2004,13 @@
                           classDollarSym);
 
         JCStatement rethrow;
-        if (target.hasInitCause()) {
-            // rethrow = "throw new NoClassDefFoundError().initCause(e);
-            JCExpression throwExpr =
-                makeCall(makeNewClass(syms.noClassDefFoundErrorType,
-                                      List.<JCExpression>nil()),
-                         names.initCause,
-                         List.<JCExpression>of(make.Ident(catchParam)));
-            rethrow = make.Throw(throwExpr);
-        } else {
-            // getMessageSym := ClassNotFoundException.getMessage()
-            Symbol getMessageSym = lookupMethod(make_pos,
-                                                names.getMessage,
-                                                syms.classNotFoundExceptionType,
-                                                List.<Type>nil());
-            // rethrow = "throw new NoClassDefFoundError(e.getMessage());"
-            rethrow = make.
-                Throw(makeNewClass(syms.noClassDefFoundErrorType,
-                          List.<JCExpression>of(make.App(make.Select(make.Ident(catchParam),
-                                                                     getMessageSym),
-                                                         List.<JCExpression>nil()))));
-        }
+        // rethrow = "throw new NoClassDefFoundError().initCause(e);
+        JCExpression throwExpr =
+            makeCall(makeNewClass(syms.noClassDefFoundErrorType,
+                                  List.<JCExpression>nil()),
+                     names.initCause,
+                     List.<JCExpression>of(make.Ident(catchParam)));
+        rethrow = make.Throw(throwExpr);
 
         // rethrowStmt := "( $rethrow )"
         JCBlock rethrowStmt = make.Block(0, List.of(rethrow));
@@ -2147,29 +2098,10 @@
                 ((VarSymbol)typeSym).getConstValue(); // ensure initializer is evaluated
             return make.QualIdent(typeSym);
         case CLASS: case ARRAY:
-            if (target.hasClassLiterals()) {
                 VarSymbol sym = new VarSymbol(
                         STATIC | PUBLIC | FINAL, names._class,
                         syms.classType, type.tsym);
                 return make_at(pos).Select(make.Type(type), sym);
-            }
-            // replace with <cache == null ? cache = class$(tsig) : cache>
-            // where
-            //  - <tsig>  is the type signature of T,
-            //  - <cache> is the cache variable for tsig.
-            String sig =
-                writer.xClassName(type).toString().replace('/', '.');
-            Symbol cs = cacheSym(pos, sig);
-            return make_at(pos).Conditional(
-                makeBinary(EQ, make.Ident(cs), makeNull()),
-                make.Assign(
-                    make.Ident(cs),
-                    make.App(
-                        make.Ident(classDollarSym(pos)),
-                        List.<JCExpression>of(make.Literal(CLASS, sig)
-                                              .setType(syms.stringType))))
-                .setType(types.erasure(syms.classType)),
-                make.Ident(cs)).setType(types.erasure(syms.classType));
         default:
             throw new AssertionError();
         }
@@ -2415,9 +2347,8 @@
 
         Name name = names.package_info;
         long flags = Flags.ABSTRACT | Flags.INTERFACE;
-        if (target.isPackageInfoSynthetic())
-            // package-info is marked SYNTHETIC in JDK 1.6 and later releases
-            flags = flags | Flags.SYNTHETIC;
+        // package-info is marked SYNTHETIC in JDK 1.6 and later releases
+        flags = flags | Flags.SYNTHETIC;
         JCClassDecl packageAnnotationsClass
             = make.ClassDef(make.Modifiers(flags, tree.getAnnotations()),
                             name, List.<JCTypeParameter>nil(),
@@ -2549,8 +2480,7 @@
         if (tree.extending == null)
             tree.extending = make.Type(types.supertype(tree.type));
 
-        // classOfType adds a cache field to tree.defs unless
-        // target.hasClassLiterals().
+        // classOfType adds a cache field to tree.defs
         JCExpression e_class = classOfType(tree.sym.type, tree.pos()).
             setType(types.erasure(syms.classType));
 
@@ -2574,7 +2504,7 @@
 
         // private static final T[] #VALUES = { a, b, c };
         Name valuesName = names.fromString(target.syntheticNameChar() + "VALUES");
-        while (tree.sym.members().lookup(valuesName).scope != null) // avoid name clash
+        while (tree.sym.members().findFirst(valuesName) != null) // avoid name clash
             valuesName = names.fromString(valuesName + "" + target.syntheticNameChar());
         Type arrayType = new ArrayType(types.erasure(tree.type),
                                        syms.arrayClass, Type.noAnnotations);
@@ -2602,7 +2532,7 @@
         } else {
             // template: T[] $result = new T[$values.length];
             Name resultName = names.fromString(target.syntheticNameChar() + "result");
-            while (tree.sym.members().lookup(resultName).scope != null) // avoid name clash
+            while (tree.sym.members().findFirst(resultName) != null) // avoid name clash
                 resultName = names.fromString(resultName + "" + target.syntheticNameChar());
             VarSymbol resultVar = new VarSymbol(FINAL|SYNTHETIC,
                                                 resultName,
@@ -2683,8 +2613,7 @@
         private MethodSymbol systemArraycopyMethod;
         private boolean useClone() {
             try {
-                Scope.Entry e = syms.objectType.tsym.members().lookup(names.clone);
-                return (e.sym != null);
+                return syms.objectType.tsym.members().findFirst(names.clone) != null;
             }
             catch (CompletionFailure e) {
                 return false;
@@ -2786,7 +2715,7 @@
                         final Name pName = proxyName(l.head.name);
                         m.capturedLocals =
                             m.capturedLocals.append((VarSymbol)
-                                                    (proxies.lookup(pName).sym));
+                                                    (proxies.findFirst(pName)));
                         added = added.prepend(
                           initField(tree.body.pos, pName));
                     }
@@ -2811,11 +2740,7 @@
             // recursively translate following local statements and
             // combine with this- or super-call
             List<JCStatement> stats = translate(tree.body.stats.tail);
-            if (target.initializeFieldsBeforeSuper())
-                tree.body.stats = stats.prepend(selfCall).prependList(added);
-            else
-                tree.body.stats = stats.prependList(added).prepend(selfCall);
-
+            tree.body.stats = stats.prepend(selfCall).prependList(added);
             outerThisStack = prevOuterThisStack;
         } else {
             Map<Symbol, Symbol> prevLambdaTranslationMap =
@@ -3057,9 +2982,7 @@
     public void visitApply(JCMethodInvocation tree) {
         Symbol meth = TreeInfo.symbol(tree.meth);
         List<Type> argtypes = meth.type.getParameterTypes();
-        if (allowEnums &&
-            meth.name==names.init &&
-            meth.owner == syms.enumSym)
+        if (meth.name == names.init && meth.owner == syms.enumSym)
             argtypes = argtypes.tail.tail;
         tree.args = boxArgs(argtypes, tree.args, tree.varargsElement);
         tree.varargsElement = null;
@@ -3196,20 +3119,12 @@
     /** Box up a single primitive expression. */
     JCExpression boxPrimitive(JCExpression tree, Type box) {
         make_at(tree.pos());
-        if (target.boxWithConstructors()) {
-            Symbol ctor = lookupConstructor(tree.pos(),
-                                            box,
-                                            List.<Type>nil()
-                                            .prepend(tree.type));
-            return make.Create(ctor, List.of(tree));
-        } else {
-            Symbol valueOfSym = lookupMethod(tree.pos(),
-                                             names.valueOf,
-                                             box,
-                                             List.<Type>nil()
-                                             .prepend(tree.type));
-            return make.App(make.QualIdent(valueOfSym), List.of(tree));
-        }
+        Symbol valueOfSym = lookupMethod(tree.pos(),
+                                         names.valueOf,
+                                         box,
+                                         List.<Type>nil()
+                                         .prepend(tree.type));
+        return make.App(make.QualIdent(valueOfSym), List.of(tree));
     }
 
     /** Unbox an object to a primitive value. */
@@ -3969,8 +3884,8 @@
             classdefs = new HashMap<>();
             actualSymbols = new HashMap<>();
             freevarCache = new HashMap<>();
-            proxies = new Scope(syms.noSymbol);
-            twrVars = new Scope(syms.noSymbol);
+            proxies = WriteableScope.create(syms.noSymbol);
+            twrVars = WriteableScope.create(syms.noSymbol);
             outerThisStack = List.nil();
             accessNums = new HashMap<>();
             accessSyms = new HashMap<>();
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -25,12 +25,18 @@
 
 package com.sun.tools.javac.comp;
 
+import java.util.Collections;
 import java.util.HashSet;
+import java.util.IdentityHashMap;
 import java.util.Set;
 
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Scope.ImportFilter;
+import com.sun.tools.javac.code.Scope.NamedImportScope;
+import com.sun.tools.javac.code.Scope.StarImportScope;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
@@ -43,6 +49,7 @@
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Flags.ANNOTATION;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.code.TypeTag.ERROR;
 import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
@@ -151,7 +158,7 @@
                            final TypeSymbol tsym,
                            Env<AttrContext> env) {
         // Check that packages imported from exist (JLS ???).
-        if (tsym.kind == PCK && tsym.members().elems == null && !tsym.exists()) {
+        if (tsym.kind == PCK && tsym.members().isEmpty() && !tsym.exists()) {
             // If we can't find java.lang, exit immediately.
             if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) {
                 JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang");
@@ -160,7 +167,7 @@
                 log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym);
             }
         }
-        env.toplevel.starImportScope.importAll(tsym.members());
+        env.toplevel.starImportScope.importAll(tsym.members(), tsym.members(), typeImportFilter, false);
     }
 
     /** Import all static members of a class or package on demand.
@@ -171,82 +178,16 @@
     private void importStaticAll(int pos,
                                  final TypeSymbol tsym,
                                  Env<AttrContext> env) {
-        final JavaFileObject sourcefile = env.toplevel.sourcefile;
-        final Scope toScope = env.toplevel.starImportScope;
+        final StarImportScope toScope = env.toplevel.starImportScope;
         final PackageSymbol packge = env.toplevel.packge;
         final TypeSymbol origin = tsym;
 
         // enter imported types immediately
-        new Object() {
-            Set<Symbol> processed = new HashSet<>();
-            void importFrom(TypeSymbol tsym) {
-                if (tsym == null || !processed.add(tsym))
-                    return;
-
-                // also import inherited names
-                importFrom(types.supertype(tsym.type).tsym);
-                for (Type t : types.interfaces(tsym.type))
-                    importFrom(t.tsym);
-
-                final Scope fromScope = tsym.members();
-                for (Scope.Entry e = fromScope.elems; e != null; e = e.sibling) {
-                    Symbol sym = e.sym;
-                    if (sym.kind == TYP &&
-                        (sym.flags() & STATIC) != 0 &&
-                        staticImportAccessible(sym, packge) &&
-                        sym.isMemberOf(origin, types) &&
-                        !toScope.includes(sym))
-                        toScope.enter(sym, fromScope, origin.members(), true);
-                }
+        new SymbolImporter() {
+            void doImport(TypeSymbol tsym) {
+                toScope.importAll(tsym.members(), origin.members(), staticImportFilter, true);
             }
         }.importFrom(tsym);
-
-        // enter non-types before annotations that might use them
-        annotate.earlier(new Annotate.Worker() {
-            Set<Symbol> processed = new HashSet<>();
-
-            public String toString() {
-                return "import static " + tsym + ".*" + " in " + sourcefile;
-            }
-            void importFrom(TypeSymbol tsym) {
-                if (tsym == null || !processed.add(tsym))
-                    return;
-
-                // also import inherited names
-                importFrom(types.supertype(tsym.type).tsym);
-                for (Type t : types.interfaces(tsym.type))
-                    importFrom(t.tsym);
-
-                final Scope fromScope = tsym.members();
-                for (Scope.Entry e = fromScope.elems; e != null; e = e.sibling) {
-                    Symbol sym = e.sym;
-                    if (sym.isStatic() && sym.kind != TYP &&
-                        staticImportAccessible(sym, packge) &&
-                        !toScope.includes(sym) &&
-                        sym.isMemberOf(origin, types)) {
-                        toScope.enter(sym, fromScope, origin.members(), true);
-                    }
-                }
-            }
-            public void run() {
-                importFrom(tsym);
-            }
-        });
-    }
-
-    // is the sym accessible everywhere in packge?
-    boolean staticImportAccessible(Symbol sym, PackageSymbol packge) {
-        int flags = (int)(sym.flags() & AccessFlags);
-        switch (flags) {
-        default:
-        case PUBLIC:
-            return true;
-        case PRIVATE:
-            return false;
-        case 0:
-        case PROTECTED:
-            return sym.packge() == packge;
-        }
     }
 
     /** Import statics types of a given name.  Non-types are handled in Attr.
@@ -265,12 +206,46 @@
             return;
         }
 
-        final Scope toScope = env.toplevel.namedImportScope;
-        final PackageSymbol packge = env.toplevel.packge;
-        final TypeSymbol origin = tsym;
+        final NamedImportScope toScope = env.toplevel.namedImportScope;
+        final Scope originMembers = tsym.members();
 
         // enter imported types immediately
-        new Object() {
+        new SymbolImporter() {
+            void doImport(TypeSymbol tsym) {
+                Set<Symbol> maskedOut = null;
+                for (Symbol sym : tsym.members().getSymbolsByName(name)) {
+                    if (sym.kind == TYP &&
+                        staticImportFilter.accepts(originMembers, sym) &&
+                        !chk.checkUniqueStaticImport(pos, env.toplevel, sym)) {
+                        if (maskedOut == null)
+                            maskedOut = Collections.newSetFromMap(new IdentityHashMap<Symbol, Boolean>());
+                        maskedOut.add(sym);
+                    }
+                }
+                ImportFilter importFilter = maskedOut != null ?
+                        new MaskedImportFilter(staticImportFilter, maskedOut) :
+                        staticImportFilter;
+                toScope.importByName(tsym.members(), originMembers, name, importFilter);
+            }
+        }.importFrom(tsym);
+    }
+    //where:
+        class MaskedImportFilter implements ImportFilter {
+
+            private final ImportFilter delegate;
+            private final Set<Symbol> maskedOut;
+
+            public MaskedImportFilter(ImportFilter delegate, Set<Symbol> maskedOut) {
+                this.delegate = delegate;
+                this.maskedOut = maskedOut;
+            }
+
+            @Override
+            public boolean accepts(Scope origin, Symbol sym) {
+                return !maskedOut.contains(sym) && delegate.accepts(origin, sym);
+            }
+        }
+        abstract class SymbolImporter {
             Set<Symbol> processed = new HashSet<>();
             void importFrom(TypeSymbol tsym) {
                 if (tsym == null || !processed.add(tsym))
@@ -281,78 +256,21 @@
                 for (Type t : types.interfaces(tsym.type))
                     importFrom(t.tsym);
 
-                for (Scope.Entry e = tsym.members().lookup(name);
-                     e.scope != null;
-                     e = e.next()) {
-                    Symbol sym = e.sym;
-                    if (sym.isStatic() &&
-                        sym.kind == TYP &&
-                        staticImportAccessible(sym, packge) &&
-                        sym.isMemberOf(origin, types) &&
-                        chk.checkUniqueStaticImport(pos, sym, toScope))
-                        toScope.enter(sym, sym.owner.members(), origin.members(), true);
-                }
+                doImport(tsym);
             }
-        }.importFrom(tsym);
-
-        // enter non-types before annotations that might use them
-        annotate.earlier(new Annotate.Worker() {
-            Set<Symbol> processed = new HashSet<>();
-            boolean found = false;
-
-            public String toString() {
-                return "import static " + tsym + "." + name;
-            }
-            void importFrom(TypeSymbol tsym) {
-                if (tsym == null || !processed.add(tsym))
-                    return;
-
-                // also import inherited names
-                importFrom(types.supertype(tsym.type).tsym);
-                for (Type t : types.interfaces(tsym.type))
-                    importFrom(t.tsym);
+            abstract void doImport(TypeSymbol tsym);
+        }
 
-                for (Scope.Entry e = tsym.members().lookup(name);
-                     e.scope != null;
-                     e = e.next()) {
-                    Symbol sym = e.sym;
-                    if (sym.isStatic() &&
-                        staticImportAccessible(sym, packge) &&
-                        sym.isMemberOf(origin, types)) {
-                        found = true;
-                        if (sym.kind != TYP) {
-                            toScope.enter(sym, sym.owner.members(), origin.members(), true);
-                        }
-                    }
-                }
-            }
-            public void run() {
-                JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
-                try {
-                    importFrom(tsym);
-                    if (!found) {
-                        log.error(pos, "cant.resolve.location",
-                                  KindName.STATIC,
-                                  name, List.<Type>nil(), List.<Type>nil(),
-                                  Kinds.typeKindName(tsym.type),
-                                  tsym.type);
-                    }
-                } finally {
-                    log.useSource(prev);
-                }
-            }
-        });
-    }
     /** Import given class.
      *  @param pos           Position to be used for error reporting.
      *  @param tsym          The class to be imported.
      *  @param env           The environment containing the named import
      *                  scope to add to.
      */
-    private void importNamed(DiagnosticPosition pos, Symbol tsym, Env<AttrContext> env) {
+    private void importNamed(DiagnosticPosition pos, final Symbol tsym, Env<AttrContext> env) {
         if (tsym.kind == TYP &&
-            chk.checkUniqueImport(pos, tsym, env.toplevel.namedImportScope))
-            env.toplevel.namedImportScope.enter(tsym, tsym.owner.members());
+            chk.checkUniqueImport(pos, env.toplevel, tsym))
+            env.toplevel.namedImportScope.importType(tsym.owner.members(), tsym.owner.members(), tsym);
     }
 
     /** Construct method type from method signature.
@@ -482,6 +400,32 @@
  * Visitor methods for member enter
  *********************************************************************/
 
+    ImportFilter staticImportFilter;
+    ImportFilter typeImportFilter = new ImportFilter() {
+        @Override
+        public boolean accepts(Scope origin, Symbol t) {
+            return t.kind == Kinds.TYP;
+        }
+    };
+
+    protected void memberEnter(JCCompilationUnit tree, Env<AttrContext> env) {
+        ImportFilter prevStaticImportFilter = staticImportFilter;
+        try {
+            final PackageSymbol packge = env.toplevel.packge;
+            this.staticImportFilter = new ImportFilter() {
+                @Override
+                public boolean accepts(Scope origin, Symbol sym) {
+                    return sym.isStatic() &&
+                           chk.staticImportAccessible(sym, packge) &&
+                           sym.isMemberOf((TypeSymbol) origin.owner, types);
+                }
+            };
+            memberEnter((JCTree) tree, env);
+        } finally {
+            this.staticImportFilter = prevStaticImportFilter;
+        }
+    }
+
     /** Visitor argument: the current environment
      */
     protected Env<AttrContext> env;
@@ -570,7 +514,7 @@
     }
 
     public void visitTopLevel(JCCompilationUnit tree) {
-        if (tree.starImportScope.elems != null) {
+        if (!tree.starImportScope.isEmpty()) {
             // we must have already processed this toplevel
             return;
         }
@@ -640,7 +584,7 @@
     }
 
     public void visitMethodDef(JCMethodDecl tree) {
-        Scope enclScope = enter.enterScope(env);
+        WriteableScope enclScope = enter.enterScope(env);
         MethodSymbol m = new MethodSymbol(0, tree.name, null, enclScope.owner);
         m.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, m, tree);
         tree.sym = m;
@@ -696,9 +640,8 @@
      */
     Env<AttrContext> methodEnv(JCMethodDecl tree, Env<AttrContext> env) {
         Env<AttrContext> localEnv =
-            env.dup(tree, env.info.dup(env.info.scope.dupUnshared()));
+            env.dup(tree, env.info.dup(env.info.scope.dupUnshared(tree.sym)));
         localEnv.enclMethod = tree;
-        localEnv.info.scope.owner = tree.sym;
         if (tree.sym.type != null) {
             //when this is called in the enter stage, there's no type to be set
             localEnv.info.returnResult = attr.new ResultInfo(VAL, tree.sym.type.getReturnType());
@@ -739,7 +682,7 @@
                 ArrayType atype = (ArrayType)tree.vartype.type;
                 tree.vartype.type = atype.makeVarargs();
             }
-            Scope enclScope = enter.enterScope(env);
+            WriteableScope enclScope = enter.enterScope(env);
             VarSymbol v =
                 new VarSymbol(0, tree.name, tree.vartype.type, enclScope.owner);
             v.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, v, tree);
@@ -875,8 +818,7 @@
     Env<AttrContext> initEnv(JCVariableDecl tree, Env<AttrContext> env) {
         Env<AttrContext> localEnv = env.dupto(new AttrContextEnv(tree, env.info.dup()));
         if (tree.sym.owner.kind == TYP) {
-            localEnv.info.scope = env.info.scope.dupUnshared();
-            localEnv.info.scope.owner = tree.sym;
+            localEnv.info.scope = env.info.scope.dupUnshared(tree.sym);
         }
         if ((tree.mods.flags & STATIC) != 0 ||
                 ((env.enclClass.sym.flags() & INTERFACE) != 0 && env.enclMethod == null))
@@ -1220,23 +1162,30 @@
         // Enter all member fields and methods of a set of half completed
         // classes in a second phase.
         if (wasFirst) {
+            Set<JCCompilationUnit> topLevels = new HashSet<>();
             try {
                 while (halfcompleted.nonEmpty()) {
                     Env<AttrContext> toFinish = halfcompleted.next();
+                    topLevels.add(toFinish.toplevel);
                     finish(toFinish);
                 }
             } finally {
                 isFirst = true;
             }
+
+            for (JCCompilationUnit toplevel : topLevels) {
+                chk.checkImportsResolvable(toplevel);
+            }
+
         }
     }
 
     private Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
-        Scope baseScope = new Scope(tree.sym);
+        WriteableScope baseScope = WriteableScope.create(tree.sym);
         //import already entered local classes into base scope
-        for (Scope.Entry e = env.outer.info.scope.elems ; e != null ; e = e.sibling) {
-            if (e.sym.isLocal()) {
-                baseScope.enter(e.sym);
+        for (Symbol sym : env.outer.info.scope.getSymbols(NON_RECURSIVE)) {
+            if (sym.isLocal()) {
+                baseScope.enter(sym);
             }
         }
         //import current type-parameters into base scope
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Jul 05 19:50:06 2017 +0200
@@ -28,6 +28,7 @@
 import com.sun.source.tree.MemberReferenceTree.ReferenceMode;
 import com.sun.tools.javac.api.Formattable.LocalizedString;
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.comp.Attr.ResultInfo;
@@ -53,11 +54,9 @@
 
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
 import java.util.Map;
 
 import javax.lang.model.element.ElementVisitor;
@@ -91,16 +90,14 @@
     TreeInfo treeinfo;
     Types types;
     JCDiagnostic.Factory diags;
-    public final boolean boxingEnabled;
-    public final boolean varargsEnabled;
     public final boolean allowMethodHandles;
     public final boolean allowFunctionalInterfaceMostSpecific;
-    public final boolean checkVarargsAccessDuringResolution;
+    public final boolean checkVarargsAccessAfterResolution;
     private final boolean debugResolve;
     private final boolean compactMethodDiags;
     final EnumSet<VerboseResolutionMode> verboseResolutionMode;
 
-    Scope polymorphicSignatureScope;
+    WriteableScope polymorphicSignatureScope;
 
     protected Resolve(Context context) {
         context.put(resolveKey, this);
@@ -127,8 +124,6 @@
         types = Types.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
         Source source = Source.instance(context);
-        boxingEnabled = source.allowBoxing();
-        varargsEnabled = source.allowVarargs();
         Options options = Options.instance(context);
         debugResolve = options.isSet("debugresolve");
         compactMethodDiags = options.isSet(Option.XDIAGS, "compact") ||
@@ -137,9 +132,9 @@
         Target target = Target.instance(context);
         allowMethodHandles = target.hasMethodHandles();
         allowFunctionalInterfaceMostSpecific = source.allowFunctionalInterfaceMostSpecific();
-        checkVarargsAccessDuringResolution =
+        checkVarargsAccessAfterResolution =
                 source.allowPostApplicabilityVarargsAccessCheck();
-        polymorphicSignatureScope = new Scope(syms.noSymbol);
+        polymorphicSignatureScope = WriteableScope.create(syms.noSymbol);
 
         inapplicableMethodException = new InapplicableMethodException(diags);
     }
@@ -836,13 +831,16 @@
                                     Warner warn) {
             super.argumentsAcceptable(env, deferredAttrContext, argtypes, formals, warn);
             //should we expand formals?
-            if ((!checkVarargsAccessDuringResolution ||
-                (checkVarargsAccessDuringResolution &&
-                 deferredAttrContext.mode == AttrMode.CHECK)) &&
-                deferredAttrContext.phase.isVarargsRequired()) {
-                //check varargs element type accessibility
-                varargsAccessible(env, types.elemtype(formals.last()),
-                        deferredAttrContext.inferenceContext);
+            if (deferredAttrContext.phase.isVarargsRequired()) {
+                Type typeToCheck = null;
+                if (!checkVarargsAccessAfterResolution) {
+                    typeToCheck = types.elemtype(formals.last());
+                } else if (deferredAttrContext.mode == AttrMode.CHECK) {
+                    typeToCheck = types.erasure(types.elemtype(formals.last()));
+                }
+                if (typeToCheck != null) {
+                    varargsAccessible(env, typeToCheck, deferredAttrContext.inferenceContext);
+                }
             }
         }
 
@@ -1296,13 +1294,11 @@
             c = c.type.getUpperBound().tsym;
         Symbol bestSoFar = varNotFound;
         Symbol sym;
-        Scope.Entry e = c.members().lookup(name);
-        while (e.scope != null) {
-            if (e.sym.kind == VAR && (e.sym.flags_field & SYNTHETIC) == 0) {
-                return isAccessible(env, site, e.sym)
-                    ? e.sym : new AccessError(env, site, e.sym);
+        for (Symbol s : c.members().getSymbolsByName(name)) {
+            if (s.kind == VAR && (s.flags_field & SYNTHETIC) == 0) {
+                return isAccessible(env, site, s)
+                    ? s : new AccessError(env, site, s);
             }
-            e = e.next();
         }
         Type st = types.supertype(c.type);
         if (st != null && (st.hasTag(CLASS) || st.hasTag(TYPEVAR))) {
@@ -1345,20 +1341,20 @@
      */
     Symbol findVar(Env<AttrContext> env, Name name) {
         Symbol bestSoFar = varNotFound;
-        Symbol sym;
         Env<AttrContext> env1 = env;
         boolean staticOnly = false;
         while (env1.outer != null) {
+            Symbol sym = null;
             if (isStatic(env1)) staticOnly = true;
-            Scope.Entry e = env1.info.scope.lookup(name);
-            while (e.scope != null &&
-                   (e.sym.kind != VAR ||
-                    (e.sym.flags_field & SYNTHETIC) != 0))
-                e = e.next();
-            sym = (e.scope != null)
-                ? e.sym
-                : findField(
-                    env1, env1.enclClass.sym.type, name, env1.enclClass.sym);
+            for (Symbol s : env1.info.scope.getSymbolsByName(name)) {
+                if (s.kind == VAR && (s.flags_field & SYNTHETIC) == 0) {
+                    sym = s;
+                    break;
+                }
+            }
+            if (sym == null) {
+                sym = findField(env1, env1.enclClass.sym.type, name, env1.enclClass.sym);
+            }
             if (sym.exists()) {
                 if (staticOnly &&
                     sym.kind == VAR &&
@@ -1375,7 +1371,7 @@
             env1 = env1.outer;
         }
 
-        sym = findField(env, syms.predefClass.type, name, syms.predefClass);
+        Symbol sym = findField(env, syms.predefClass.type, name, syms.predefClass);
         if (sym.exists())
             return sym;
         if (bestSoFar.exists())
@@ -1383,18 +1379,16 @@
 
         Symbol origin = null;
         for (Scope sc : new Scope[] { env.toplevel.namedImportScope, env.toplevel.starImportScope }) {
-            Scope.Entry e = sc.lookup(name);
-            for (; e.scope != null; e = e.next()) {
-                sym = e.sym;
-                if (sym.kind != VAR)
+            for (Symbol currentSymbol : sc.getSymbolsByName(name)) {
+                if (currentSymbol.kind != VAR)
                     continue;
                 // invariant: sym.kind == VAR
-                if (bestSoFar.kind < AMBIGUOUS && sym.owner != bestSoFar.owner)
-                    return new AmbiguityError(bestSoFar, sym);
+                if (bestSoFar.kind < AMBIGUOUS && currentSymbol.owner != bestSoFar.owner)
+                    return new AmbiguityError(bestSoFar, currentSymbol);
                 else if (bestSoFar.kind >= VAR) {
-                    origin = e.getOrigin().owner;
-                    bestSoFar = isAccessible(env, origin.type, sym)
-                        ? sym : new AccessError(env, origin.type, sym);
+                    origin = sc.getOrigin(currentSymbol).owner;
+                    bestSoFar = isAccessible(env, origin.type, currentSymbol)
+                        ? currentSymbol : new AccessError(env, origin.type, currentSymbol);
                 }
             }
             if (bestSoFar.exists()) break;
@@ -1624,7 +1618,7 @@
             boolean useVarargs,
             boolean operator,
             boolean abstractok) {
-        for (Symbol s : sc.getElementsByName(name, new LookupFilter(abstractok))) {
+        for (Symbol s : sc.getSymbolsByName(name, new LookupFilter(abstractok))) {
             bestSoFar = selectBest(env, site, argtypes, typeargtypes, s,
                     bestSoFar, allowBoxing, useVarargs, operator);
         }
@@ -1824,12 +1818,11 @@
                    List<Type> argtypes, List<Type> typeargtypes,
                    boolean allowBoxing, boolean useVarargs) {
         Symbol bestSoFar = methodNotFound;
-        Symbol sym;
         Env<AttrContext> env1 = env;
         boolean staticOnly = false;
         while (env1.outer != null) {
             if (isStatic(env1)) staticOnly = true;
-            sym = findMethod(
+            Symbol sym = findMethod(
                 env1, env1.enclClass.sym.type, name, argtypes, typeargtypes,
                 allowBoxing, useVarargs, false);
             if (sym.exists()) {
@@ -1845,41 +1838,37 @@
             env1 = env1.outer;
         }
 
-        sym = findMethod(env, syms.predefClass.type, name, argtypes,
-                         typeargtypes, allowBoxing, useVarargs, false);
+        Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes,
+                                typeargtypes, allowBoxing, useVarargs, false);
         if (sym.exists())
             return sym;
 
-        Scope.Entry e = env.toplevel.namedImportScope.lookup(name);
-        for (; e.scope != null; e = e.next()) {
-            sym = e.sym;
-            Type origin = e.getOrigin().owner.type;
-            if (sym.kind == MTH) {
-                if (e.sym.owner.type != origin)
-                    sym = sym.clone(e.getOrigin().owner);
-                if (!isAccessible(env, origin, sym))
-                    sym = new AccessError(env, origin, sym);
-                bestSoFar = selectBest(env, origin,
+        for (Symbol currentSym : env.toplevel.namedImportScope.getSymbolsByName(name)) {
+            Symbol origin = env.toplevel.namedImportScope.getOrigin(currentSym).owner;
+            if (currentSym.kind == MTH) {
+                if (currentSym.owner.type != origin.type)
+                    currentSym = currentSym.clone(origin);
+                if (!isAccessible(env, origin.type, currentSym))
+                    currentSym = new AccessError(env, origin.type, currentSym);
+                bestSoFar = selectBest(env, origin.type,
                                        argtypes, typeargtypes,
-                                       sym, bestSoFar,
+                                       currentSym, bestSoFar,
                                        allowBoxing, useVarargs, false);
             }
         }
         if (bestSoFar.exists())
             return bestSoFar;
 
-        e = env.toplevel.starImportScope.lookup(name);
-        for (; e.scope != null; e = e.next()) {
-            sym = e.sym;
-            Type origin = e.getOrigin().owner.type;
-            if (sym.kind == MTH) {
-                if (e.sym.owner.type != origin)
-                    sym = sym.clone(e.getOrigin().owner);
-                if (!isAccessible(env, origin, sym))
-                    sym = new AccessError(env, origin, sym);
-                bestSoFar = selectBest(env, origin,
+        for (Symbol currentSym : env.toplevel.starImportScope.getSymbolsByName(name)) {
+            Symbol origin = env.toplevel.starImportScope.getOrigin(currentSym).owner;
+            if (currentSym.kind == MTH) {
+                if (currentSym.owner.type != origin.type)
+                    currentSym = currentSym.clone(origin);
+                if (!isAccessible(env, origin.type, currentSym))
+                    currentSym = new AccessError(env, origin.type, currentSym);
+                bestSoFar = selectBest(env, origin.type,
                                        argtypes, typeargtypes,
-                                       sym, bestSoFar,
+                                       currentSym, bestSoFar,
                                        allowBoxing, useVarargs, false);
             }
         }
@@ -1918,14 +1907,12 @@
                                    Type site,
                                    Name name,
                                    TypeSymbol c) {
-        Scope.Entry e = c.members().lookup(name);
-        while (e.scope != null) {
-            if (e.sym.kind == TYP) {
-                return isAccessible(env, site, e.sym)
-                    ? e.sym
-                    : new AccessError(env, site, e.sym);
+        for (Symbol sym : c.members().getSymbolsByName(name)) {
+            if (sym.kind == TYP) {
+                return isAccessible(env, site, sym)
+                    ? sym
+                    : new AccessError(env, site, sym);
             }
-            e = e.next();
         }
         return typeNotFound;
     }
@@ -1992,8 +1979,8 @@
      */
     Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name) {
         Symbol bestSoFar = typeNotFound;
-        for (Scope.Entry e = scope.lookup(name); e.scope != null; e = e.next()) {
-            Symbol sym = loadClass(env, e.sym.flatName());
+        for (Symbol s : scope.getSymbolsByName(name)) {
+            Symbol sym = loadClass(env, s.flatName());
             if (bestSoFar.kind == TYP && sym.kind == TYP &&
                 bestSoFar != sym)
                 return new AmbiguityError(bestSoFar, sym);
@@ -2004,15 +1991,13 @@
     }
 
     Symbol findTypeVar(Env<AttrContext> env, Name name, boolean staticOnly) {
-        for (Scope.Entry e = env.info.scope.lookup(name);
-             e.scope != null;
-             e = e.next()) {
-            if (e.sym.kind == TYP) {
+        for (Symbol sym : env.info.scope.getSymbolsByName(name)) {
+            if (sym.kind == TYP) {
                 if (staticOnly &&
-                    e.sym.type.hasTag(TYPEVAR) &&
-                    e.sym.owner.kind == TYP)
-                    return new StaticError(e.sym);
-                return e.sym;
+                    sym.type.hasTag(TYPEVAR) &&
+                    sym.owner.kind == TYP)
+                    return new StaticError(sym);
+                return sym;
             }
         }
         return typeNotFound;
@@ -2320,42 +2305,6 @@
     }
 
 /* ***************************************************************************
- *  Debugging
- ****************************************************************************/
-
-    /** print all scopes starting with scope s and proceeding outwards.
-     *  used for debugging.
-     */
-    public void printscopes(Scope s) {
-        while (s != null) {
-            if (s.owner != null)
-                System.err.print(s.owner + ": ");
-            for (Scope.Entry e = s.elems; e != null; e = e.sibling) {
-                if ((e.sym.flags() & ABSTRACT) != 0)
-                    System.err.print("abstract ");
-                System.err.print(e.sym + " ");
-            }
-            System.err.println();
-            s = s.next;
-        }
-    }
-
-    void printscopes(Env<AttrContext> env) {
-        while (env.outer != null) {
-            System.err.println("------------------------------");
-            printscopes(env.info.scope);
-            env = env.outer;
-        }
-    }
-
-    public void printscopes(Type t) {
-        while (t.hasTag(CLASS)) {
-            printscopes(t.tsym.members());
-            t = types.supertype(t);
-        }
-    }
-
-/* ***************************************************************************
  *  Name resolution
  *  Naming conventions are as for symbol lookup
  *  Unlike the find... methods these methods will report access errors
@@ -2453,7 +2402,7 @@
                                             List<Type> argtypes) {
         Type mtype = infer.instantiatePolymorphicSignatureInstance(env,
                 (MethodSymbol)spMethod, currentResolutionContext, argtypes);
-        for (Symbol sym : polymorphicSignatureScope.getElementsByName(spMethod.name)) {
+        for (Symbol sym : polymorphicSignatureScope.getSymbolsByName(spMethod.name)) {
             if (types.isSameType(mtype, sym.type)) {
                return sym;
             }
@@ -2626,14 +2575,11 @@
                               boolean allowBoxing,
                               boolean useVarargs) {
         Symbol bestSoFar = methodNotFound;
-        for (Scope.Entry e = site.tsym.members().lookup(names.init);
-             e.scope != null;
-             e = e.next()) {
-            final Symbol sym = e.sym;
+        for (final Symbol sym : site.tsym.members().getSymbolsByName(names.init)) {
             //- System.out.println(" e " + e.sym);
             if (sym.kind == MTH &&
                 (sym.flags_field & SYNTHETIC) == 0) {
-                    List<Type> oldParams = e.sym.type.hasTag(FORALL) ?
+                    List<Type> oldParams = sym.type.hasTag(FORALL) ?
                             ((ForAll)sym.type).tvars :
                             List.<Type>nil();
                     Type constrType = new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams),
@@ -3249,7 +3195,7 @@
 
         @Override
         protected Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) {
-            Scope sc = new Scope(syms.arrayClass);
+            WriteableScope sc = WriteableScope.create(syms.arrayClass);
             MethodSymbol arrayConstr = new MethodSymbol(PUBLIC, name, null, site.tsym);
             arrayConstr.type = new MethodType(List.<Type>of(syms.intType), site, List.<Type>nil(), syms.methodClass);
             sc.enter(arrayConstr);
@@ -3327,8 +3273,8 @@
             Symbol bestSoFar = methodNotFound;
             currentResolutionContext = resolveContext;
             for (MethodResolutionPhase phase : methodResolutionSteps) {
-                if (!phase.isApplicable(boxingEnabled, varargsEnabled) ||
-                        lookupHelper.shouldStop(bestSoFar, phase)) break;
+                if (lookupHelper.shouldStop(bestSoFar, phase))
+                    break;
                 MethodResolutionPhase prevPhase = currentResolutionContext.step;
                 Symbol prevBest = bestSoFar;
                 currentResolutionContext.step = phase;
@@ -3359,7 +3305,7 @@
         while (env1.outer != null) {
             if (isStatic(env1)) staticOnly = true;
             if (env1.enclClass.sym == c) {
-                Symbol sym = env1.info.scope.lookup(name).sym;
+                Symbol sym = env1.info.scope.findFirst(name);
                 if (sym != null) {
                     if (staticOnly) sym = new StaticError(sym);
                     return accessBase(sym, pos, env.enclClass.sym.type,
@@ -3446,7 +3392,7 @@
             while (env1 != null && env1.outer != null) {
                 if (isStatic(env1)) staticOnly = true;
                 if (env1.enclClass.sym.isSubClass(member.owner, types)) {
-                    Symbol sym = env1.info.scope.lookup(name).sym;
+                    Symbol sym = env1.info.scope.findFirst(name);
                     if (sym != null) {
                         if (staticOnly) sym = new StaticError(sym);
                         return sym;
@@ -4256,11 +4202,6 @@
             return isVarargsRequired;
         }
 
-        public boolean isApplicable(boolean boxingEnabled, boolean varargsEnabled) {
-            return (varargsEnabled || !isVarargsRequired) &&
-                   (boxingEnabled || !isBoxingRequired);
-        }
-
         public Symbol mergeResults(Symbol prev, Symbol sym) {
             return sym;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Wed Jul 05 19:50:06 2017 +0200
@@ -37,6 +37,7 @@
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
 import static com.sun.tools.javac.code.TypeTag.VOID;
@@ -66,18 +67,10 @@
     private Symtab syms;
     private TreeMaker make;
     private Enter enter;
-    private boolean allowEnums;
     private boolean allowInterfaceBridges;
     private Types types;
     private final Resolve resolve;
 
-    /**
-     * Flag to indicate whether or not to generate bridge methods.
-     * For pre-Tiger source there is no need for bridge methods, so it
-     * can be skipped to get better performance for -source 1.4 etc.
-     */
-    private final boolean addBridges;
-
     private final CompileStates compileStates;
 
     protected TransTypes(Context context) {
@@ -89,8 +82,6 @@
         enter = Enter.instance(context);
         overridden = new HashMap<>();
         Source source = Source.instance(context);
-        allowEnums = source.allowEnums();
-        addBridges = source.addBridges();
         allowInterfaceBridges = source.allowDefaultMethods();
         types = Types.instance(context);
         make = TreeMaker.instance(context);
@@ -449,8 +440,8 @@
                     TypeSymbol i,
                     ClassSymbol origin,
                     ListBuffer<JCTree> bridges) {
-        for (Scope.Entry e = i.members().elems; e != null; e = e.sibling)
-            addBridgeIfNeeded(pos, e.sym, origin, bridges);
+        for (Symbol sym : i.members().getSymbols(NON_RECURSIVE))
+            addBridgeIfNeeded(pos, sym, origin, bridges);
         for (List<Type> l = types.interfaces(i.type); l.nonEmpty(); l = l.tail)
             addBridges(pos, l.head.tsym, origin, bridges);
     }
@@ -529,14 +520,12 @@
         }
 
         // Check that we do not introduce a name clash by erasing types.
-        for (Scope.Entry e = tree.sym.owner.members().lookup(tree.name);
-             e.sym != null;
-             e = e.next()) {
-            if (e.sym != tree.sym &&
-                types.isSameType(erasure(e.sym.type), tree.type)) {
+        for (Symbol sym : tree.sym.owner.members().getSymbolsByName(tree.name)) {
+            if (sym != tree.sym &&
+                types.isSameType(erasure(sym.type), tree.type)) {
                 log.error(tree.pos(),
                           "name.clash.same.erasure", tree.sym,
-                          e.sym);
+                          sym);
                 return;
             }
         }
@@ -666,9 +655,7 @@
         Symbol meth = TreeInfo.symbol(tree.meth);
         Type mt = meth.erasure(types);
         List<Type> argtypes = mt.getParameterTypes();
-        if (allowEnums &&
-            meth.name==names.init &&
-            meth.owner == syms.enumSym)
+        if (meth.name == names.init && meth.owner == syms.enumSym)
             argtypes = argtypes.tail.tail;
         if (tree.varargsElement != null)
             tree.varargsElement = types.erasure(tree.varargsElement);
@@ -921,13 +908,11 @@
                 tree.typarams = List.nil();
                 super.visitClassDef(tree);
                 make.at(tree.pos);
-                if (addBridges) {
-                    ListBuffer<JCTree> bridges = new ListBuffer<>();
-                    if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) {
-                        addBridges(tree.pos(), c, bridges);
-                    }
-                    tree.defs = bridges.toList().prependList(tree.defs);
+                ListBuffer<JCTree> bridges = new ListBuffer<>();
+                if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) {
+                    addBridges(tree.pos(), c, bridges);
                 }
+                tree.defs = bridges.toList().prependList(tree.defs);
                 tree.type = erasure(tree.type);
             } finally {
                 make = savedMake;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -42,6 +42,7 @@
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.file.BaseFileObject;
@@ -90,18 +91,6 @@
      */
     public boolean readAllOfClassFile = false;
 
-    /** Switch: read GJ signature information.
-     */
-    boolean allowGenerics;
-
-    /** Switch: read varargs attribute.
-     */
-    boolean allowVarargs;
-
-    /** Switch: allow annotations.
-     */
-    boolean allowAnnotations;
-
     /** Switch: allow simplified varargs.
      */
     boolean allowSimplifiedVarargs;
@@ -141,7 +130,7 @@
 
     /** The current scope where type variables are entered.
      */
-    protected Scope typevars;
+    protected WriteableScope typevars;
 
     /** The path name of the class file currently being read.
      */
@@ -222,16 +211,13 @@
         checkClassFile = options.isSet("-checkclassfile");
 
         Source source = Source.instance(context);
-        allowGenerics    = source.allowGenerics();
-        allowVarargs     = source.allowVarargs();
-        allowAnnotations = source.allowAnnotations();
         allowSimplifiedVarargs = source.allowSimplifiedVarargs();
 
         saveParameterNames = options.isSet("save-parameter-names");
 
         profile = Profile.instance(context);
 
-        typevars = new Scope(syms.noSymbol);
+        typevars = WriteableScope.create(syms.noSymbol);
 
         lintClassfile = Lint.instance(context).isEnabled(LintCategory.CLASSFILE);
 
@@ -832,9 +818,9 @@
     /** Find type variable with given name in `typevars' scope.
      */
     Type findTypeVar(Name name) {
-        Scope.Entry e = typevars.lookup(name);
-        if (e.scope != null) {
-            return e.sym.type;
+        Symbol s = typevars.findFirst(name);
+        if (s != null) {
+            return s.type;
         } else {
             if (readingClassAttr) {
                 // While reading the class attribute, the supertypes
@@ -1025,9 +1011,7 @@
 
             new AttributeReader(names.Synthetic, V45_3, CLASS_OR_MEMBER_ATTRIBUTE) {
                 protected void read(Symbol sym, int attrLen) {
-                    // bridge methods are visible when generics not enabled
-                    if (allowGenerics || (sym.flags_field & BRIDGE) == 0)
-                        sym.flags_field |= SYNTHETIC;
+                    sym.flags_field |= SYNTHETIC;
                 }
             },
 
@@ -1042,11 +1026,6 @@
             },
 
             new AttributeReader(names.Signature, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
-                @Override
-                protected boolean accepts(AttributeKind kind) {
-                    return super.accepts(kind) && allowGenerics;
-                }
-
                 protected void read(Symbol sym, int attrLen) {
                     if (sym.kind == TYP) {
                         ClassSymbol c = (ClassSymbol) sym;
@@ -1109,16 +1088,13 @@
 
             new AttributeReader(names.Annotation, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
                 protected void read(Symbol sym, int attrLen) {
-                    if (allowAnnotations)
-                        sym.flags_field |= ANNOTATION;
+                    sym.flags_field |= ANNOTATION;
                 }
             },
 
             new AttributeReader(names.Bridge, V49, MEMBER_ATTRIBUTE) {
                 protected void read(Symbol sym, int attrLen) {
                     sym.flags_field |= BRIDGE;
-                    if (!allowGenerics)
-                        sym.flags_field &= ~SYNTHETIC;
                 }
             },
 
@@ -1130,8 +1106,7 @@
 
             new AttributeReader(names.Varargs, V49, CLASS_OR_MEMBER_ATTRIBUTE) {
                 protected void read(Symbol sym, int attrLen) {
-                    if (allowVarargs)
-                        sym.flags_field |= VARARGS;
+                    sym.flags_field |= VARARGS;
                 }
             },
 
@@ -1228,9 +1203,10 @@
 
         MethodType type = nt.uniqueType.type.asMethodType();
 
-        for (Scope.Entry e = scope.lookup(nt.name); e.scope != null; e = e.next())
-            if (e.sym.kind == MTH && isSameBinaryType(e.sym.type.asMethodType(), type))
-                return (MethodSymbol)e.sym;
+        for (Symbol sym : scope.getSymbolsByName(nt.name)) {
+            if (sym.kind == MTH && isSameBinaryType(sym.type.asMethodType(), type))
+                return (MethodSymbol)sym;
+        }
 
         if (nt.name != names.init)
             // not a constructor
@@ -1769,10 +1745,7 @@
         MethodSymbol findAccessMethod(Type container, Name name) {
             CompletionFailure failure = null;
             try {
-                for (Scope.Entry e = container.tsym.members().lookup(name);
-                     e.scope != null;
-                     e = e.next()) {
-                    Symbol sym = e.sym;
+                for (Symbol sym : container.tsym.members().getSymbolsByName(name)) {
                     if (sym.kind == MTH && sym.type.getParameterTypes().length() == 0)
                         return (MethodSymbol) sym;
                 }
@@ -1852,11 +1825,9 @@
             VarSymbol enumerator = null;
             CompletionFailure failure = null;
             try {
-                for (Scope.Entry e = enumTypeSym.members().lookup(proxy.enumerator);
-                     e.scope != null;
-                     e = e.next()) {
-                    if (e.sym.kind == VAR) {
-                        enumerator = (VarSymbol)e.sym;
+                for (Symbol sym : enumTypeSym.members().getSymbolsByName(proxy.enumerator)) {
+                    if (sym.kind == VAR) {
+                        enumerator = (VarSymbol)sym;
                         break;
                     }
                 }
@@ -2197,7 +2168,7 @@
         ClassType ct = (ClassType)c.type;
 
         // allocate scope for members
-        c.members_field = new Scope(c);
+        c.members_field = WriteableScope.create(c);
 
         // prepare type variable table
         typevars = typevars.dup(currentOwner);
@@ -2416,8 +2387,6 @@
         if ((flags & ACC_BRIDGE) != 0) {
             flags &= ~ACC_BRIDGE;
             flags |= BRIDGE;
-            if (!allowGenerics)
-                flags &= ~SYNTHETIC;
         }
         if ((flags & ACC_VARARGS) != 0) {
             flags &= ~ACC_VARARGS;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -49,8 +49,8 @@
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.*;
-import static com.sun.tools.javac.jvm.UninitializedType.*;
 import static com.sun.tools.javac.main.Option.*;
 import static javax.tools.StandardLocation.CLASS_OUTPUT;
 
@@ -542,8 +542,6 @@
      *  Returns the number of attributes written (0 or 1).
      */
     int writeEnclosingMethodAttribute(ClassSymbol c) {
-        if (!target.hasEnclosingMethodAttribute())
-            return 0;
         return writeEnclosingMethodAttribute(names.EnclosingMethod, c);
     }
 
@@ -577,31 +575,6 @@
             endAttr(alenIdx);
             acount++;
         }
-        if ((flags & ENUM) != 0 && !target.useEnumFlag()) {
-            int alenIdx = writeAttr(names.Enum);
-            endAttr(alenIdx);
-            acount++;
-        }
-        if ((flags & SYNTHETIC) != 0 && !target.useSyntheticFlag()) {
-            int alenIdx = writeAttr(names.Synthetic);
-            endAttr(alenIdx);
-            acount++;
-        }
-        if ((flags & BRIDGE) != 0 && !target.useBridgeFlag()) {
-            int alenIdx = writeAttr(names.Bridge);
-            endAttr(alenIdx);
-            acount++;
-        }
-        if ((flags & VARARGS) != 0 && !target.useVarargsFlag()) {
-            int alenIdx = writeAttr(names.Varargs);
-            endAttr(alenIdx);
-            acount++;
-        }
-        if ((flags & ANNOTATION) != 0 && !target.useAnnotationFlag()) {
-            int alenIdx = writeAttr(names.Annotation);
-            endAttr(alenIdx);
-            acount++;
-        }
         return acount;
     }
 
@@ -611,11 +584,10 @@
     int writeMemberAttrs(Symbol sym) {
         int acount = writeFlagAttrs(sym.flags());
         long flags = sym.flags();
-        if (source.allowGenerics() &&
-            (flags & (SYNTHETIC|BRIDGE)) != SYNTHETIC &&
+        if ((flags & (SYNTHETIC | BRIDGE)) != SYNTHETIC &&
             (flags & ANONCONSTR) == 0 &&
             (!types.isSameType(sym.type, sym.erasure(types)) ||
-            signatureGen.hasTypeVar(sym.type.getThrownTypes()))) {
+             signatureGen.hasTypeVar(sym.type.getThrownTypes()))) {
             // note that a local class with captured variables
             // will get a signature attribute
             int alenIdx = writeAttr(names.Signature);
@@ -1251,14 +1223,14 @@
                 // output locals
                 int localCount = 0;
                 for (int j=0; j<frame.locals.length;
-                     j += (target.generateEmptyAfterBig() ? 1 : Code.width(frame.locals[j]))) {
+                     j += Code.width(frame.locals[j])) {
                     localCount++;
                 }
                 if (debugstackmap) System.out.print(" nlocals=" +
                                                     localCount);
                 databuf.appendChar(localCount);
                 for (int j=0; j<frame.locals.length;
-                     j += (target.generateEmptyAfterBig() ? 1 : Code.width(frame.locals[j]))) {
+                     j += Code.width(frame.locals[j])) {
                     if (debugstackmap) System.out.print(" local[" + j + "]=");
                     writeStackMapType(frame.locals[j]);
                 }
@@ -1266,14 +1238,14 @@
                 // output stack
                 int stackCount = 0;
                 for (int j=0; j<frame.stack.length;
-                     j += (target.generateEmptyAfterBig() ? 1 : Code.width(frame.stack[j]))) {
+                     j += Code.width(frame.stack[j])) {
                     stackCount++;
                 }
                 if (debugstackmap) System.out.print(" nstack=" +
                                                     stackCount);
                 databuf.appendChar(stackCount);
                 for (int j=0; j<frame.stack.length;
-                     j += (target.generateEmptyAfterBig() ? 1 : Code.width(frame.stack[j]))) {
+                     j += Code.width(frame.stack[j])) {
                     if (debugstackmap) System.out.print(" stack[" + j + "]=");
                     writeStackMapType(frame.stack[j]);
                 }
@@ -1563,12 +1535,12 @@
         }
     }
 
-    void writeFields(Scope.Entry e) {
+    void writeFields(Scope s) {
         // process them in reverse sibling order;
         // i.e., process them in declaration order.
         List<VarSymbol> vars = List.nil();
-        for (Scope.Entry i = e; i != null; i = i.sibling) {
-            if (i.sym.kind == VAR) vars = vars.prepend((VarSymbol)i.sym);
+        for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
+            if (sym.kind == VAR) vars = vars.prepend((VarSymbol)sym);
         }
         while (vars.nonEmpty()) {
             writeField(vars.head);
@@ -1576,11 +1548,11 @@
         }
     }
 
-    void writeMethods(Scope.Entry e) {
+    void writeMethods(Scope s) {
         List<MethodSymbol> methods = List.nil();
-        for (Scope.Entry i = e; i != null; i = i.sibling) {
-            if (i.sym.kind == MTH && (i.sym.flags() & HYPOTHETICAL) == 0)
-                methods = methods.prepend((MethodSymbol)i.sym);
+        for (Symbol sym : s.getSymbols(NON_RECURSIVE)) {
+            if (sym.kind == MTH && (sym.flags() & HYPOTHETICAL) == 0)
+                methods = methods.prepend((MethodSymbol)sym);
         }
         while (methods.nonEmpty()) {
             writeMethod(methods.head);
@@ -1654,12 +1626,12 @@
             databuf.appendChar(pool.put(l.head.tsym));
         int fieldsCount = 0;
         int methodsCount = 0;
-        for (Scope.Entry e = c.members().elems; e != null; e = e.sibling) {
-            switch (e.sym.kind) {
+        for (Symbol sym : c.members().getSymbols(NON_RECURSIVE)) {
+            switch (sym.kind) {
             case VAR: fieldsCount++; break;
-            case MTH: if ((e.sym.flags() & HYPOTHETICAL) == 0) methodsCount++;
+            case MTH: if ((sym.flags() & HYPOTHETICAL) == 0) methodsCount++;
                       break;
-            case TYP: enterInner((ClassSymbol)e.sym); break;
+            case TYP: enterInner((ClassSymbol)sym); break;
             default : Assert.error();
             }
         }
@@ -1671,9 +1643,9 @@
         }
 
         databuf.appendChar(fieldsCount);
-        writeFields(c.members().elems);
+        writeFields(c.members());
         databuf.appendChar(methodsCount);
-        writeMethods(c.members().elems);
+        writeMethods(c.members());
 
         int acountIdx = beginAttrs();
         int acount = 0;
@@ -1683,7 +1655,6 @@
         for (List<Type> l = interfaces; !sigReq && l.nonEmpty(); l = l.tail)
             sigReq = l.head.allparams().length() != 0;
         if (sigReq) {
-            Assert.check(source.allowGenerics());
             int alenIdx = writeAttr(names.Signature);
             if (typarams.length() != 0) signatureGen.assembleParamsSig(typarams);
             signatureGen.assembleSig(supertype);
@@ -1760,16 +1731,10 @@
 
     int adjustFlags(final long flags) {
         int result = (int)flags;
-        if ((flags & SYNTHETIC) != 0  && !target.useSyntheticFlag())
-            result &= ~SYNTHETIC;
-        if ((flags & ENUM) != 0  && !target.useEnumFlag())
-            result &= ~ENUM;
-        if ((flags & ANNOTATION) != 0  && !target.useAnnotationFlag())
-            result &= ~ANNOTATION;
 
-        if ((flags & BRIDGE) != 0  && target.useBridgeFlag())
+        if ((flags & BRIDGE) != 0)
             result |= ACC_BRIDGE;
-        if ((flags & VARARGS) != 0  && target.useVarargsFlag())
+        if ((flags & VARARGS) != 0)
             result |= ACC_VARARGS;
         if ((flags & DEFAULT) != 0)
             result &= ~ABSTRACT;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Wed Jul 05 19:50:06 2017 +0200
@@ -45,6 +45,7 @@
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.jvm.ByteCodes.*;
 import static com.sun.tools.javac.jvm.CRTFlags.*;
@@ -74,13 +75,6 @@
     private final Types types;
     private final Lower lower;
 
-    /** Switch: GJ mode?
-     */
-    private final boolean allowGenerics;
-
-    /** Set when Miranda method stubs are to be generated. */
-    private final boolean generateIproxies;
-
     /** Format of stackmap tables to be generated. */
     private final Code.StackMapFormat stackMap;
 
@@ -115,10 +109,7 @@
         target = Target.instance(context);
         types = Types.instance(context);
         methodType = new MethodType(null, null, null, syms.methodClass);
-        allowGenerics = Source.instance(context).allowGenerics();
-        stringBufferType = target.useStringBuilder()
-            ? syms.stringBuilderType
-            : syms.stringBufferType;
+        stringBufferType = syms.stringBuilderType;
         stringBufferAppend = new HashMap<>();
         accessDollar = names.
             fromString("access" + target.syntheticNameChar());
@@ -140,20 +131,8 @@
         allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
         pool = new Pool(types);
 
-        generateIproxies =
-            target.requiresIproxy() ||
-            options.isSet("miranda");
-
-        if (target.generateStackMapTable()) {
-            // ignore cldc because we cannot have both stackmap formats
-            this.stackMap = StackMapFormat.JSR202;
-        } else {
-            if (target.generateCLDCStackmap()) {
-                this.stackMap = StackMapFormat.CLDC;
-            } else {
-                this.stackMap = StackMapFormat.NONE;
-            }
-        }
+        // ignore cldc because we cannot have both stackmap formats
+        this.stackMap = StackMapFormat.JSR202;
 
         // by default, avoid jsr's for simple finalizers
         int setjsrlimit = 50;
@@ -274,10 +253,8 @@
                 sym.owner != syms.arrayClass)
                 return sym;
             // array clone can be qualified by the array type in later targets
-            Symbol qualifier = target.arrayBinaryCompatibility()
-                ? new ClassSymbol(Flags.PUBLIC, site.tsym.name,
-                                  site, syms.noSymbol)
-                : syms.objectType.tsym;
+            Symbol qualifier = new ClassSymbol(Flags.PUBLIC, site.tsym.name,
+                                               site, syms.noSymbol);
             return sym.clone(qualifier);
         }
 
@@ -285,27 +262,12 @@
             (sym.flags() & (STATIC | SYNTHETIC)) == (STATIC | SYNTHETIC)) {
             return sym;
         }
-        if (!target.obeyBinaryCompatibility())
-            return rs.isAccessible(attrEnv, (TypeSymbol)sym.owner)
-                ? sym
-                : sym.clone(site.tsym);
-
-        if (!target.interfaceFieldsBinaryCompatibility()) {
-            if ((sym.owner.flags() & INTERFACE) != 0 && sym.kind == VAR)
-                return sym;
-        }
 
         // leave alone methods inherited from Object
         // JLS 13.1.
         if (sym.owner == syms.objectType.tsym)
             return sym;
 
-        if (!target.interfaceObjectOverridesBinaryCompatibility()) {
-            if ((sym.owner.flags() & INTERFACE) != 0 &&
-                syms.objectType.tsym.members().lookup(sym.name).scope != null)
-                return sym;
-        }
-
         return sym.clone(site.tsym);
     }
 
@@ -625,78 +587,6 @@
         }
     }
 
-/* ********************************************************************
- * Adding miranda methods
- *********************************************************************/
-
-    /** Add abstract methods for all methods defined in one of
-     *  the interfaces of a given class,
-     *  provided they are not already implemented in the class.
-     *
-     *  @param c      The class whose interfaces are searched for methods
-     *                for which Miranda methods should be added.
-     */
-    void implementInterfaceMethods(ClassSymbol c) {
-        implementInterfaceMethods(c, c);
-    }
-
-    /** Add abstract methods for all methods defined in one of
-     *  the interfaces of a given class,
-     *  provided they are not already implemented in the class.
-     *
-     *  @param c      The class whose interfaces are searched for methods
-     *                for which Miranda methods should be added.
-     *  @param site   The class in which a definition may be needed.
-     */
-    void implementInterfaceMethods(ClassSymbol c, ClassSymbol site) {
-        for (List<Type> l = types.interfaces(c.type); l.nonEmpty(); l = l.tail) {
-            ClassSymbol i = (ClassSymbol)l.head.tsym;
-            for (Scope.Entry e = i.members().elems;
-                 e != null;
-                 e = e.sibling)
-            {
-                if (e.sym.kind == MTH && (e.sym.flags() & STATIC) == 0)
-                {
-                    MethodSymbol absMeth = (MethodSymbol)e.sym;
-                    MethodSymbol implMeth = absMeth.binaryImplementation(site, types);
-                    if (implMeth == null)
-                        addAbstractMethod(site, absMeth);
-                    else if ((implMeth.flags() & IPROXY) != 0)
-                        adjustAbstractMethod(site, implMeth, absMeth);
-                }
-            }
-            implementInterfaceMethods(i, site);
-        }
-    }
-
-    /** Add an abstract methods to a class
-     *  which implicitly implements a method defined in some interface
-     *  implemented by the class. These methods are called "Miranda methods".
-     *  Enter the newly created method into its enclosing class scope.
-     *  Note that it is not entered into the class tree, as the emitter
-     *  doesn't need to see it there to emit an abstract method.
-     *
-     *  @param c      The class to which the Miranda method is added.
-     *  @param m      The interface method symbol for which a Miranda method
-     *                is added.
-     */
-    private void addAbstractMethod(ClassSymbol c,
-                                   MethodSymbol m) {
-        MethodSymbol absMeth = new MethodSymbol(
-            m.flags() | IPROXY | SYNTHETIC, m.name,
-            m.type, // was c.type.memberType(m), but now only !generics supported
-            c);
-        c.members().enter(absMeth); // add to symbol table
-    }
-
-    private void adjustAbstractMethod(ClassSymbol c,
-                                      MethodSymbol pm,
-                                      MethodSymbol im) {
-        MethodType pmt = (MethodType)pm.type;
-        Type imt = types.memberType(c.type, im);
-        pmt.thrown = chk.intersect(pmt.getThrownTypes(), imt.getThrownTypes());
-    }
-
 /* ************************************************************************
  * Traversal methods
  *************************************************************************/
@@ -1691,13 +1581,8 @@
                 code.addCatch(startpc1, endpc1, handler_pc1,
                               (char)catch_type);
             } else {
-                if (!useJsrLocally && !target.generateStackMapTable()) {
-                    useJsrLocally = true;
-                    throw new CodeSizeOverflow();
-                } else {
-                    log.error(pos, "limit.code.too.large.for.try.stmt");
-                    nerrs++;
-                }
+                log.error(pos, "limit.code.too.large.for.try.stmt");
+                nerrs++;
             }
         }
 
@@ -2363,7 +2248,6 @@
         Symbol sym = tree.sym;
 
         if (tree.name == names._class) {
-            Assert.check(target.hasClassLiterals());
             code.emitLdc(makeRef(tree.pos(), tree.selected.type));
             result = items.makeStackItem(pt);
             return;
@@ -2474,13 +2358,6 @@
             ClassSymbol c = cdef.sym;
             this.toplevel = env.toplevel;
             this.endPosTable = toplevel.endPositions;
-            // If this is a class definition requiring Miranda methods,
-            // add them.
-            if (generateIproxies &&
-                (c.flags() & (INTERFACE|ABSTRACT)) == ABSTRACT
-                && !allowGenerics // no Miranda methods available with generics
-                )
-                implementInterfaceMethods(c);
             cdef.defs = normalizeDefs(cdef.defs, c);
             c.pool = pool;
             pool.reset();
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -37,7 +37,6 @@
 
 import com.sun.tools.javac.code.Attribute;
 import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Scope;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.VarSymbol;
@@ -53,6 +52,7 @@
 
 import static com.sun.tools.javac.main.Option.*;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 
 /** This class provides operations to write native header files for classes.
  *
@@ -146,8 +146,7 @@
         if (c.isLocal() || isSynthetic(c))
             return false;
 
-        for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
-            Symbol sym = i.sym;
+        for (Symbol sym : c.members_field.getSymbols(NON_RECURSIVE)) {
             if (sym.kind == MTH && isNative(sym))
                 return true;
             for (Attribute.Compound a: sym.getDeclarationAttributes()) {
@@ -156,8 +155,7 @@
             }
         }
         if (checkNestedClasses) {
-            for (Scope.Entry i = c.members_field.elems; i != null; i = i.sibling) {
-                Symbol sym = i.sym;
+            for (Symbol sym : c.members_field.getSymbols(NON_RECURSIVE)) {
                 if ((sym.kind == TYP) && needsHeader(((ClassSymbol) sym), true))
                     return true;
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -77,11 +77,9 @@
         return instance;
     }
 
-    private static final Target MIN = values()[0];
-    public static Target MIN() { return MIN; }
+    public static final Target MIN = Target.JDK1_6;
 
     private static final Target MAX = values()[values().length - 1];
-    public static Target MAX() { return MAX; }
 
     private static final Map<String,Target> tab = new HashMap<>();
     static {
@@ -110,132 +108,6 @@
         return tab.get(name);
     }
 
-    /** In -target 1.1 and earlier, the compiler is required to emit
-     *  synthetic method definitions in abstract classes for interface
-     *  methods that are not overridden.  We call them "Miranda" methods.
-     */
-    public boolean requiresIproxy() {
-        return compareTo(JDK1_1) <= 0;
-    }
-
-    /** Beginning in 1.4, we take advantage of the possibility of emitting
-     *  code to initialize fields before calling the superclass constructor.
-     *  This is allowed by the VM spec, but the verifier refused to allow
-     *  it until 1.4.  This is necesary to translate some code involving
-     *  inner classes.  See, for example, 4030374.
-     */
-    public boolean initializeFieldsBeforeSuper() {
-        return compareTo(JDK1_4) >= 0;
-    }
-
-    /** Beginning with -target 1.2 we obey the JLS rules for binary
-     *  compatibility, emitting as the qualifying type of a reference
-     *  to a method or field the type of the qualifier.  In earlier
-     *  targets we use as the qualifying type the class in which the
-     *  member was found.  The following methods named
-     *  *binaryCompatibility() indicate places where we vary from this
-     *  general rule. */
-    public boolean obeyBinaryCompatibility() {
-        return compareTo(JDK1_2) >= 0;
-    }
-
-    /** Starting in 1.5, the compiler uses an array type as
-     *  the qualifier for method calls (such as clone) where required by
-     *  the language and VM spec.  Earlier versions of the compiler
-     *  qualified them by Object.
-     */
-    public boolean arrayBinaryCompatibility() {
-        return compareTo(JDK1_5) >= 0;
-    }
-
-    /** Beginning after 1.2, we follow the binary compatibility rules for
-     *  interface fields.  The 1.2 VMs had bugs handling interface fields
-     *  when compiled using binary compatibility (see 4400598), so this is
-     *  an accommodation to them.
-     */
-    public boolean interfaceFieldsBinaryCompatibility() {
-        return compareTo(JDK1_2) > 0;
-    }
-
-    /** Beginning in -target 1.5, we follow the binary compatibility
-     *  rules for interface methods that redefine Object methods.
-     *  Earlier VMs had bugs handling such methods compiled using binary
-     *  compatibility (see 4392595, 4398791, 4392595, 4400415).
-     *  The VMs were fixed during or soon after 1.4.  See 4392595.
-     */
-    public boolean interfaceObjectOverridesBinaryCompatibility() {
-        return compareTo(JDK1_5) >= 0;
-    }
-
-    /** Beginning in -target 1.5, we make synthetic variables
-     *  package-private instead of private.  This is to prevent the
-     *  necessity of access methods, which effectively relax the
-     *  protection of the field but bloat the class files and affect
-     *  execution.
-     */
-    public boolean usePrivateSyntheticFields() {
-        return compareTo(JDK1_5) < 0;
-    }
-
-    /** Sometimes we need to create a field to cache a value like a
-     *  class literal of the assertions flag.  In -target 1.5 and
-     *  later we create a new synthetic class for this instead of
-     *  using the outermost class.  See 4401576.
-     */
-    public boolean useInnerCacheClass() {
-        return compareTo(JDK1_5) >= 0;
-    }
-
-    /** Return true if cldc-style stack maps need to be generated. */
-    public boolean generateCLDCStackmap() {
-        return false;
-    }
-
-    /** Beginning in -target 6, we generate stackmap attribute in
-     *  compact format. */
-    public boolean generateStackMapTable() {
-        return compareTo(JDK1_6) >= 0;
-    }
-
-    /** Beginning in -target 6, package-info classes are marked synthetic.
-     */
-    public boolean isPackageInfoSynthetic() {
-        return compareTo(JDK1_6) >= 0;
-    }
-
-    /** Do we generate "empty" stackmap slots after double and long?
-     */
-    public boolean generateEmptyAfterBig() {
-        return false;
-    }
-
-    /** Beginning in 1.5, we have an unsynchronized version of
-     *  StringBuffer called StringBuilder that can be used by the
-     *  compiler for string concatenation.
-     */
-    public boolean useStringBuilder() {
-        return compareTo(JDK1_5) >= 0;
-    }
-
-    /** Beginning in 1.5, we have flag bits we can use instead of
-     *  marker attributes.
-     */
-    public boolean useSyntheticFlag() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean useEnumFlag() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean useAnnotationFlag() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean useVarargsFlag() {
-        return compareTo(JDK1_5) >= 0;
-    }
-    public boolean useBridgeFlag() {
-        return compareTo(JDK1_5) >= 0;
-    }
-
     /** Return the character to be used in constructing synthetic
      *  identifiers, where not specified by the JLS.
      */
@@ -243,12 +115,6 @@
         return '$';
     }
 
-    /** Does the VM have direct support for class literals?
-     */
-    public boolean hasClassLiterals() {
-        return compareTo(JDK1_5) >= 0;
-    }
-
     /** Does the VM support an invokedynamic instruction?
      */
     public boolean hasInvokedynamic() {
@@ -263,39 +129,4 @@
         return hasInvokedynamic();
     }
 
-    /** Although we may not have support for class literals, should we
-     *  avoid initializing the class that the literal refers to?
-     *  See 4468823
-     */
-    public boolean classLiteralsNoInit() {
-        return compareTo(JDK1_5) >= 0;
-    }
-
-    /** Although we may not have support for class literals, when we
-     *  throw a NoClassDefFoundError, should we initialize its cause?
-     */
-    public boolean hasInitCause() {
-        return compareTo(JDK1_4) >= 0;
-    }
-
-    /** For bootstrapping, we use J2SE1.4's wrapper class constructors
-     *  to implement boxing.
-     */
-    public boolean boxWithConstructors() {
-        return compareTo(JDK1_5) < 0;
-    }
-
-    /** For bootstrapping, we use J2SE1.4's java.util.Collection
-     *  instead of java.lang.Iterable.
-     */
-    public boolean hasIterable() {
-        return compareTo(JDK1_5) >= 0;
-    }
-
-    /** In J2SE1.5.0, we introduced the "EnclosingMethod" attribute
-     *  for improved reflection support.
-     */
-    public boolean hasEnclosingMethodAttribute() {
-        return compareTo(JDK1_5) >= 0;
-    }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Jul 05 19:50:06 2017 +0200
@@ -441,20 +441,26 @@
         // Unless lint checking on options is disabled, check for
         // obsolete source and target options.
         boolean obsoleteOptionFound = false;
-        if (options.isUnset(XLINT_CUSTOM, "-" + LintCategory.OPTIONS.option)) {
-            if (source.compareTo(Source.JDK1_5) <= 0) {
-                log.warning(LintCategory.OPTIONS, "option.obsolete.source", source.name);
-                obsoleteOptionFound = true;
-            }
+
+        boolean lintOptions =
+            options.isUnset(XLINT_CUSTOM, "-"+LintCategory.OPTIONS.option);
 
-            if (target.compareTo(Target.JDK1_5) <= 0) {
-                log.warning(LintCategory.OPTIONS, "option.obsolete.target", target.name);
-                obsoleteOptionFound = true;
-            }
+        if (source.compareTo(Source.MIN) < 0) {
+            log.error("option.removed.source", source.name, Source.MIN.name);
+        } else if (source == Source.MIN && lintOptions) {
+            log.warning(LintCategory.OPTIONS, "option.obsolete.source", source.name);
+            obsoleteOptionFound = true;
+        }
 
-            if (obsoleteOptionFound)
-                log.warning(LintCategory.OPTIONS, "option.obsolete.suppression");
+        if (target.compareTo(Target.MIN) < 0) {
+            log.error("option.removed.target", target.name, Target.MIN.name);
+        } else if (target == Target.MIN && lintOptions) {
+            log.warning(LintCategory.OPTIONS, "option.obsolete.target", target.name);
+            obsoleteOptionFound = true;
         }
+
+        if (obsoleteOptionFound)
+            log.warning(LintCategory.OPTIONS, "option.obsolete.suppression");
     }
 
     /* Switches:
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Wed Jul 05 19:50:06 2017 +0200
@@ -295,11 +295,7 @@
         Target target = (targetString != null)
             ? Target.lookup(targetString)
             : Target.DEFAULT;
-        // We don't check source/target consistency for CLDC, as J2ME
-        // profiles are not aligned with J2SE targets; moreover, a
-        // single CLDC target may have many profiles.  In addition,
-        // this is needed for the continued functioning of the JSR14
-        // prototype.
+
         if (Character.isDigit(target.name.charAt(0))) {
             if (target.compareTo(source.requiredTarget()) < 0) {
                 if (targetString != null) {
@@ -317,11 +313,6 @@
                     target = source.requiredTarget();
                     options.put("-target", target.name);
                 }
-            } else {
-                if (targetString == null && !source.allowGenerics()) {
-                    target = Target.JDK1_4;
-                    options.put("-target", target.name);
-                }
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -43,6 +43,7 @@
 import com.sun.tools.javac.code.Type.ArrayType;
 import com.sun.tools.javac.util.*;
 
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 
 /**
  * A generator of dynamic proxy implementations of
@@ -119,9 +120,9 @@
 
         // First find the default values.
         ClassSymbol sym = (ClassSymbol) anno.type.tsym;
-        for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
-            if (e.sym.kind == Kinds.MTH) {
-                MethodSymbol m = (MethodSymbol) e.sym;
+        for (Symbol s : sym.members().getSymbols(NON_RECURSIVE)) {
+            if (s.kind == Kinds.MTH) {
+                MethodSymbol m = (MethodSymbol) s;
                 Attribute def = m.getDefaultValue();
                 if (def != null)
                     res.put(m, def);
--- a/langtools/src/share/classes/com/sun/tools/javac/model/FilteredMemberList.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/FilteredMemberList.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -27,11 +27,12 @@
 
 import java.util.AbstractList;
 import java.util.Iterator;
-import java.util.NoSuchElementException;
 import com.sun.tools.javac.code.Scope;
 import com.sun.tools.javac.code.Symbol;
 
+import com.sun.tools.javac.util.Filter;
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 
 /**
  * Utility to construct a view of a symbol's members,
@@ -53,56 +54,28 @@
 
     public int size() {
         int cnt = 0;
-        for (Scope.Entry e = scope.elems; e != null; e = e.sibling) {
-            if (!unwanted(e.sym))
+        for (Symbol sym : scope.getSymbols(NON_RECURSIVE)) {
+            if (!unwanted(sym))
                 cnt++;
         }
         return cnt;
     }
 
     public Symbol get(int index) {
-        for (Scope.Entry e = scope.elems; e != null; e = e.sibling) {
-            if (!unwanted(e.sym) && (index-- == 0))
-                return e.sym;
+        for (Symbol sym : scope.getSymbols(NON_RECURSIVE)) {
+            if (!unwanted(sym) && (index-- == 0))
+                return sym;
         }
         throw new IndexOutOfBoundsException();
     }
 
     // A more efficient implementation than AbstractList's.
     public Iterator<Symbol> iterator() {
-        return new Iterator<Symbol>() {
-
-            /** The next entry to examine, or null if none. */
-            private Scope.Entry nextEntry = scope.elems;
-
-            private boolean hasNextForSure = false;
-
-            public boolean hasNext() {
-                if (hasNextForSure) {
-                    return true;
-                }
-                while (nextEntry != null && unwanted(nextEntry.sym)) {
-                    nextEntry = nextEntry.sibling;
-                }
-                hasNextForSure = (nextEntry != null);
-                return hasNextForSure;
+        return scope.getSymbols(new Filter<Symbol>() {
+            public boolean accepts(Symbol t) {
+                return !unwanted(t);
             }
-
-            public Symbol next() {
-                if (hasNext()) {
-                    Symbol result = nextEntry.sym;
-                    nextEntry = nextEntry.sibling;
-                    hasNextForSure = false;
-                    return result;
-                } else {
-                    throw new NoSuchElementException();
-                }
-            }
-
-            public void remove() {
-                throw new UnsupportedOperationException();
-            }
-        };
+        }, NON_RECURSIVE).iterator();
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacElements.java	Wed Jul 05 19:50:06 2017 +0200
@@ -35,6 +35,7 @@
 import static javax.lang.model.util.ElementFilter.methodsIn;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.comp.AttrContext;
 import com.sun.tools.javac.comp.Enter;
@@ -47,6 +48,7 @@
 import com.sun.tools.javac.tree.TreeScanner;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.Name;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
@@ -356,35 +358,31 @@
      */
     public FilteredMemberList getAllMembers(TypeElement element) {
         Symbol sym = cast(Symbol.class, element);
-        Scope scope = sym.members().dupUnshared();
+        WriteableScope scope = sym.members().dupUnshared();
         List<Type> closure = types.closure(sym.asType());
         for (Type t : closure)
             addMembers(scope, t);
         return new FilteredMemberList(scope);
     }
     // where
-        private void addMembers(Scope scope, Type type) {
+        private void addMembers(WriteableScope scope, Type type) {
             members:
-            for (Scope.Entry e = type.asElement().members().elems; e != null; e = e.sibling) {
-                Scope.Entry overrider = scope.lookup(e.sym.getSimpleName());
-                while (overrider.scope != null) {
-                    if (overrider.sym.kind == e.sym.kind
-                        && (overrider.sym.flags() & Flags.SYNTHETIC) == 0)
-                    {
-                        if (overrider.sym.getKind() == ElementKind.METHOD
-                        && overrides((ExecutableElement)overrider.sym, (ExecutableElement)e.sym, (TypeElement)type.asElement())) {
+            for (Symbol e : type.asElement().members().getSymbols(NON_RECURSIVE)) {
+                for (Symbol overrider : scope.getSymbolsByName(e.getSimpleName())) {
+                    if (overrider.kind == e.kind && (overrider.flags() & Flags.SYNTHETIC) == 0) {
+                        if (overrider.getKind() == ElementKind.METHOD &&
+                                overrides((ExecutableElement)overrider, (ExecutableElement)e, (TypeElement)type.asElement())) {
                             continue members;
                         }
                     }
-                    overrider = overrider.next();
                 }
-                boolean derived = e.sym.getEnclosingElement() != scope.owner;
-                ElementKind kind = e.sym.getKind();
+                boolean derived = e.getEnclosingElement() != scope.owner;
+                ElementKind kind = e.getKind();
                 boolean initializer = kind == ElementKind.CONSTRUCTOR
                     || kind == ElementKind.INSTANCE_INIT
                     || kind == ElementKind.STATIC_INIT;
-                if (!derived || (!initializer && e.sym.isInheritedIn(scope.owner, types)))
-                    scope.enter(e.sym);
+                if (!derived || (!initializer && e.isInheritedIn(scope.owner, types)))
+                    scope.enter(e);
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java	Wed Jul 05 19:50:06 2017 +0200
@@ -310,9 +310,9 @@
         for (Type t : types.closure(origin.type)) {
             if (t != origin.type) {
                 ClassSymbol c = (ClassSymbol) t.tsym;
-                for (Scope.Entry e = c.members().lookup(m.name); e.scope != null; e = e.next()) {
-                    if (e.sym.kind == Kinds.MTH && m.overrides(e.sym, origin, types, true)) {
-                        results.add((MethodSymbol) e.sym);
+                for (Symbol sym : c.members().getSymbolsByName(m.name)) {
+                    if (sym.kind == Kinds.MTH && m.overrides(sym, origin, types, true)) {
+                        results.add((MethodSymbol) sym);
                     }
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -46,10 +46,6 @@
 
     private static final boolean scannerDebug = false;
 
-    /** Allow hex floating-point literals.
-     */
-    private boolean allowHexFloats;
-
     /** Allow binary literals.
      */
     private boolean allowBinaryLiterals;
@@ -126,7 +122,6 @@
         this.source = fac.source;
         this.reader = reader;
         this.allowBinaryLiterals = source.allowBinaryLiterals();
-        this.allowHexFloats = source.allowHexFloats();
         this.allowUnderscoresInLiterals = source.allowUnderscoresInLiterals();
     }
 
@@ -220,11 +215,7 @@
             skipIllegalUnderscores();
             if ('0' <= reader.ch && reader.ch <= '9') {
                 scanDigits(pos, 10);
-                if (!allowHexFloats) {
-                    lexError(pos, "unsupported.fp.lit", source.name);
-                    allowHexFloats = true;
-                }
-                else if (!hexFloatsWork)
+                if (!hexFloatsWork)
                     lexError(pos, "unsupported.cross.fp.lit");
             } else
                 lexError(pos, "malformed.fp.lit");
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Jul 05 19:50:06 2017 +0200
@@ -144,13 +144,6 @@
         this.log = fac.log;
         this.names = fac.names;
         this.source = fac.source;
-        this.allowGenerics = source.allowGenerics();
-        this.allowVarargs = source.allowVarargs();
-        this.allowAsserts = source.allowAsserts();
-        this.allowEnums = source.allowEnums();
-        this.allowForeach = source.allowForeach();
-        this.allowStaticImport = source.allowStaticImport();
-        this.allowAnnotations = source.allowAnnotations();
         this.allowTWR = source.allowTryWithResources();
         this.allowDiamond = source.allowDiamond();
         this.allowMulticatch = source.allowMulticatch();
@@ -179,10 +172,6 @@
         return keepDocComments ? new LazyDocCommentTable(fac) : null;
     }
 
-    /** Switch: Should generics be recognized?
-     */
-    boolean allowGenerics;
-
     /** Switch: Should diamond operator be recognized?
      */
     boolean allowDiamond;
@@ -191,30 +180,6 @@
      */
     boolean allowMulticatch;
 
-    /** Switch: Should varargs be recognized?
-     */
-    boolean allowVarargs;
-
-    /** Switch: should we recognize assert statements, or just give a warning?
-     */
-    boolean allowAsserts;
-
-    /** Switch: should we recognize enums, or just give a warning?
-     */
-    boolean allowEnums;
-
-    /** Switch: should we recognize foreach?
-     */
-    boolean allowForeach;
-
-    /** Switch: should we recognize foreach?
-     */
-    boolean allowStaticImport;
-
-    /** Switch: should we recognize annotations?
-     */
-    boolean allowAnnotations;
-
     /** Switch: should we recognize try-with-resources?
      */
     boolean allowTWR;
@@ -419,8 +384,8 @@
                         return;
                     break;
                 case ASSERT:
-                    if (stopAtStatement && allowAsserts)
-                        return ;
+                    if (stopAtStatement)
+                        return;
                     break;
             }
             nextToken();
@@ -604,27 +569,13 @@
             nextToken();
             return name;
         } else if (token.kind == ASSERT) {
-            if (allowAsserts) {
-                error(token.pos, "assert.as.identifier");
-                nextToken();
-                return names.error;
-            } else {
-                warning(token.pos, "assert.as.identifier");
-                Name name = token.name();
-                nextToken();
-                return name;
-            }
+            error(token.pos, "assert.as.identifier");
+            nextToken();
+            return names.error;
         } else if (token.kind == ENUM) {
-            if (allowEnums) {
-                error(token.pos, "enum.as.identifier");
-                nextToken();
-                return names.error;
-            } else {
-                warning(token.pos, "enum.as.identifier");
-                Name name = token.name();
-                nextToken();
-                return name;
-            }
+            error(token.pos, "enum.as.identifier");
+            nextToken();
+            return names.error;
         } else if (token.kind == THIS) {
             if (allowThisIdent) {
                 // Make sure we're using a supported source version.
@@ -1340,7 +1291,6 @@
                             }
                             accept(GT);
                             t = toP(F.at(pos1).TypeApply(t, args.toList()));
-                            checkGenerics();
                             while (token.kind == DOT) {
                                 nextToken();
                                 mode = TYPE;
@@ -1815,7 +1765,6 @@
             (mode & TYPE) != 0 &&
             (mode & NOPARAMS) == 0) {
             mode = TYPE;
-            checkGenerics();
             return typeArguments(t, false);
         } else {
             return t;
@@ -1827,7 +1776,6 @@
 
     List<JCExpression> typeArgumentsOpt(int useMode) {
         if (token.kind == LT) {
-            checkGenerics();
             if ((mode & useMode) == 0 ||
                 (mode & NOPARAMS) != 0) {
                 illegal();
@@ -2060,7 +2008,6 @@
         boolean diamondFound = false;
         int lastTypeargsPos = -1;
         if (token.kind == LT) {
-            checkGenerics();
             lastTypeargsPos = token.pos;
             t = typeArguments(t, true);
             diamondFound = (mode & DIAMOND) != 0;
@@ -2081,7 +2028,6 @@
 
             if (token.kind == LT) {
                 lastTypeargsPos = token.pos;
-                checkGenerics();
                 t = typeArguments(t, true);
                 diamondFound = (mode & DIAMOND) != 0;
             }
@@ -2153,7 +2099,6 @@
 
         if (token.kind == LT) {
             int oldmode = mode;
-            checkGenerics();
             t = typeArguments(t, true);
             mode = oldmode;
         }
@@ -2357,7 +2302,6 @@
         }
     }
 
-    @SuppressWarnings("fallthrough")
     List<JCStatement> blockStatement() {
         //todo: skip to anchor on error(?)
         int pos = token.pos;
@@ -2374,7 +2318,7 @@
             JCModifiers mods = modifiersOpt();
             if (token.kind == INTERFACE ||
                 token.kind == CLASS ||
-                allowEnums && token.kind == ENUM) {
+                token.kind == ENUM) {
                 return List.of(classOrInterfaceOrEnumDeclaration(mods, dc));
             } else {
                 JCExpression t = parseType();
@@ -2396,15 +2340,11 @@
             Comment dc = token.comment(CommentStyle.JAVADOC);
             return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
         case ENUM:
+            error(token.pos, "local.enum");
+            dc = token.comment(CommentStyle.JAVADOC);
+            return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
         case ASSERT:
-            if (allowEnums && token.kind == ENUM) {
-                error(token.pos, "local.enum");
-                dc = token.comment(CommentStyle.JAVADOC);
-                return List.of(classOrInterfaceOrEnumDeclaration(modifiersOpt(), dc));
-            } else if (allowAsserts && token.kind == ASSERT) {
-                return List.of(parseStatement());
-            }
-            /* fall through to default */
+            return List.of(parseStatement());
         default:
             Token prevToken = token;
             JCExpression t = term(EXPR | TYPE);
@@ -2452,7 +2392,6 @@
      *     | ExpressionStatement
      *     | Ident ":" Statement
      */
-    @SuppressWarnings("fallthrough")
     public JCStatement parseStatement() {
         int pos = token.pos;
         switch (token.kind) {
@@ -2477,7 +2416,6 @@
                 inits.head.hasTag(VARDEF) &&
                 ((JCVariableDecl) inits.head).init == null &&
                 token.kind == COLON) {
-                checkForeach();
                 JCVariableDecl var = (JCVariableDecl)inits.head;
                 accept(COLON);
                 JCExpression expr = parseExpression();
@@ -2593,19 +2531,16 @@
         case CATCH:
             return doRecover(token.pos, BasicErrorRecoveryAction.CATCH_CLAUSE, "catch.without.try");
         case ASSERT: {
-            if (allowAsserts && token.kind == ASSERT) {
+            nextToken();
+            JCExpression assertion = parseExpression();
+            JCExpression message = null;
+            if (token.kind == COLON) {
                 nextToken();
-                JCExpression assertion = parseExpression();
-                JCExpression message = null;
-                if (token.kind == COLON) {
-                    nextToken();
-                    message = parseExpression();
-                }
-                accept(SEMI);
-                JCAssert t = toP(F.at(pos).Assert(assertion, message));
-                return t;
+                message = parseExpression();
             }
-            /* else fall through to default case */
+            accept(SEMI);
+            JCAssert t = toP(F.at(pos).Assert(assertion, message));
+            return t;
         }
         case ENUM:
         default:
@@ -2831,7 +2766,6 @@
             lastPos = token.pos;
             nextToken();
             if (flag == Flags.ANNOTATION) {
-                checkAnnotations();
                 if (token.kind != INTERFACE) {
                     JCAnnotation ann = annotation(lastPos, Tag.ANNOTATION);
                     // if first modifier is an annotation, set pos to annotation's.
@@ -2867,7 +2801,6 @@
      */
     JCAnnotation annotation(int pos, Tag kind) {
         // accept(AT); // AT consumed by caller
-        checkAnnotations();
         if (kind == Tag.TYPE_ANNOTATION) {
             checkTypeAnnotations();
         }
@@ -3166,7 +3099,6 @@
         nextToken();
         boolean importStatic = false;
         if (token.kind == STATIC) {
-            checkStaticImports();
             importStatic = true;
             nextToken();
         }
@@ -3209,27 +3141,9 @@
             return classDeclaration(mods, dc);
         } else if (token.kind == INTERFACE) {
             return interfaceDeclaration(mods, dc);
-        } else if (allowEnums) {
-            if (token.kind == ENUM) {
-                return enumDeclaration(mods, dc);
-            } else {
-                int pos = token.pos;
-                List<JCTree> errs;
-                if (LAX_IDENTIFIER.accepts(token.kind)) {
-                    errs = List.<JCTree>of(mods, toP(F.at(pos).Ident(ident())));
-                    setErrorEndPos(token.pos);
-                } else {
-                    errs = List.<JCTree>of(mods);
-                }
-                return toP(F.Exec(syntaxError(pos, errs, "expected3",
-                                              CLASS, INTERFACE, ENUM)));
-            }
+        } else if (token.kind == ENUM) {
+            return enumDeclaration(mods, dc);
         } else {
-            if (token.kind == ENUM) {
-                error(token.pos, "enums.not.supported.in.source", source.name);
-                allowEnums = true;
-                return enumDeclaration(mods, dc);
-            }
             int pos = token.pos;
             List<JCTree> errs;
             if (LAX_IDENTIFIER.accepts(token.kind)) {
@@ -3238,8 +3152,8 @@
             } else {
                 errs = List.<JCTree>of(mods);
             }
-            return toP(F.Exec(syntaxError(pos, errs, "expected2",
-                                          CLASS, INTERFACE)));
+            return toP(F.Exec(syntaxError(pos, errs, "expected3",
+                                          CLASS, INTERFACE, ENUM)));
         }
     }
 
@@ -3315,7 +3229,7 @@
         mods.flags |= Flags.ENUM;
         JCClassDecl result = toP(F.at(pos).
             ClassDef(mods, name, List.<JCTypeParameter>nil(),
-                null, implementing, defs));
+                     null, implementing, defs));
         attach(result, dc);
         return result;
     }
@@ -3465,7 +3379,7 @@
             JCModifiers mods = modifiersOpt();
             if (token.kind == CLASS ||
                 token.kind == INTERFACE ||
-                allowEnums && token.kind == ENUM) {
+                token.kind == ENUM) {
                 return List.<JCTree>of(classOrInterfaceOrEnumDeclaration(mods, dc));
             } else if (token.kind == LBRACE &&
                        (mods.flags & Flags.StandardFlags & ~Flags.STATIC) == 0 &&
@@ -3634,7 +3548,6 @@
      */
     List<JCTypeParameter> typeParametersOpt() {
         if (token.kind == LT) {
-            checkGenerics();
             ListBuffer<JCTypeParameter> typarams = new ListBuffer<>();
             nextToken();
             typarams.append(typeParameter());
@@ -3822,7 +3735,6 @@
         if (token.kind == ELLIPSIS) {
             List<JCAnnotation> varargsAnnos = typeAnnotationsPushedBack;
             typeAnnotationsPushedBack = List.nil();
-            checkVarargs();
             mods.flags |= Flags.VARARGS;
             // insert var arg type annotations
             type = insertAnnotationsToMostInner(type, varargsAnnos, true);
@@ -4009,36 +3921,6 @@
         }
     }
 
-    void checkGenerics() {
-        if (!allowGenerics) {
-            error(token.pos, "generics.not.supported.in.source", source.name);
-            allowGenerics = true;
-        }
-    }
-    void checkVarargs() {
-        if (!allowVarargs) {
-            error(token.pos, "varargs.not.supported.in.source", source.name);
-            allowVarargs = true;
-        }
-    }
-    void checkForeach() {
-        if (!allowForeach) {
-            error(token.pos, "foreach.not.supported.in.source", source.name);
-            allowForeach = true;
-        }
-    }
-    void checkStaticImports() {
-        if (!allowStaticImport) {
-            error(token.pos, "static.import.not.supported.in.source", source.name);
-            allowStaticImport = true;
-        }
-    }
-    void checkAnnotations() {
-        if (!allowAnnotations) {
-            error(token.pos, "annotations.not.supported.in.source", source.name);
-            allowAnnotations = true;
-        }
-    }
     void checkDiamond() {
         if (!allowDiamond) {
             error(token.pos, "diamond.not.supported.in.source", source.name);
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -720,6 +720,7 @@
     second operand: {0}\n\
     third operand : {1}
 
+
 # 0: message segment
 compiler.misc.incompatible.type.in.conditional=\
     bad type in conditional expression\n\
@@ -1467,6 +1468,14 @@
 compiler.warn.option.obsolete.target=\
     target value {0} is obsolete and will be removed in a future release
 
+# 0: string, 1: string
+compiler.err.option.removed.source=\
+    Source option {0} is no longer supported. Use {1} or later.
+
+# 0: string, 1: string
+compiler.err.option.removed.target=\
+    Target option {0} is no longer supported. Use {1} or later.
+
 compiler.warn.option.obsolete.suppression=\
     To suppress warnings about obsolete options, use -Xlint:-options.
 
@@ -2235,11 +2244,6 @@
 # Diagnostics for language feature changes
 ########################################
 # 0: string
-compiler.err.unsupported.fp.lit=\
-    hexadecimal floating point literals are not supported in -source {0}\n\
-    (use -source 5 or higher to enable hexadecimal floating point literals)
-
-# 0: string
 compiler.err.unsupported.binary.lit=\
     binary literals are not supported in -source {0}\n\
     (use -source 7 or higher to enable binary literals)
@@ -2254,14 +2258,6 @@
     try-with-resources is not supported in -source {0}\n\
     (use -source 7 or higher to enable try-with-resources)
 
-compiler.warn.enum.as.identifier=\
-    as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
-    (use -source 5 or higher to use ''enum'' as a keyword)
-
-compiler.warn.assert.as.identifier=\
-    as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
-    (use -source 1.4 or higher to use ''assert'' as a keyword)
-
 compiler.warn.underscore.as.identifier=\
     ''_'' used as an identifier\n\
     (use of ''_'' as an identifier might not be supported in releases after Java SE 8)
@@ -2271,12 +2267,10 @@
     (use of ''_'' as an identifier is forbidden for lambda parameters)
 
 compiler.err.enum.as.identifier=\
-    as of release 5, ''enum'' is a keyword, and may not be used as an identifier\n\
-    (use -source 1.4 or lower to use ''enum'' as an identifier)
+    as of release 5, ''enum'' is a keyword, and may not be used as an identifier
 
 compiler.err.assert.as.identifier=\
-    as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier\n\
-    (use -source 1.3 or lower to use ''assert'' as an identifier)
+    as of release 1.4, ''assert'' is a keyword, and may not be used as an identifier
 
 # TODO 308: make a better error message
 compiler.err.this.as.identifier=\
@@ -2324,21 +2318,6 @@
     no annotations are allowed in the type of a class literal
 
 # 0: string
-compiler.err.generics.not.supported.in.source=\
-    generics are not supported in -source {0}\n\
-    (use -source 5 or higher to enable generics)
-
-# 0: string
-compiler.err.varargs.not.supported.in.source=\
-    variable-arity methods are not supported in -source {0}\n\
-    (use -source 5 or higher to enable variable-arity methods)
-
-# 0: string
-compiler.err.annotations.not.supported.in.source=\
-    annotations are not supported in -source {0}\n\
-    (use -source 5 or higher to enable annotations)
-
-# 0: string
 compiler.err.type.annotations.not.supported.in.source=\
     type annotations are not supported in -source {0}\n\
 (use -source 8 or higher to enable type annotations)
@@ -2354,21 +2333,6 @@
 (use -source 8 or higher to enable repeated annotations)
 
 # 0: string
-compiler.err.foreach.not.supported.in.source=\
-    enhanced for loops are not supported in -source {0}\n\
-    (use -source 5 or higher to enable for-each loops)
-
-# 0: string
-compiler.err.static.import.not.supported.in.source=\
-    static import declarations are not supported in -source {0}\n\
-    (use -source 5 or higher to enable static import declarations)
-
-# 0: string
-compiler.err.enums.not.supported.in.source=\
-    enums are not supported in -source {0}\n\
-    (use -source 5 or higher to enable enums)
-
-# 0: string
 compiler.err.diamond.not.supported.in.source=\
     diamond operator is not supported in -source {0}\n\
     (use -source 7 or higher to enable diamond operator)
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -27,7 +27,7 @@
 
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Scope;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Attribute;
@@ -189,7 +189,7 @@
             new Attribute.Compound(syms.proprietaryType,
                                    List.<Pair<Symbol.MethodSymbol,Attribute>>nil());
         Attribute.Compound[] profileAnnos = new Attribute.Compound[profiles.getProfileCount() + 1];
-        Symbol.MethodSymbol profileValue = (MethodSymbol) syms.profileType.tsym.members().lookup(names.value).sym;
+        Symbol.MethodSymbol profileValue = (MethodSymbol) syms.profileType.tsym.members().findFirst(names.value);
         for (int i = 1; i < profileAnnos.length; i++) {
             profileAnnos[i] = new Attribute.Compound(syms.profileType,
                     List.<Pair<Symbol.MethodSymbol, Attribute>>of(
@@ -259,9 +259,9 @@
             pool.reset();
             cs.pool = pool;
             writer.writeClass(cs);
-            for (Scope.Entry e = cs.members().elems; e != null; e = e.sibling) {
-                if (e.sym.kind == Kinds.TYP) {
-                    ClassSymbol nestedClass = (ClassSymbol)e.sym;
+            for (Symbol sym : cs.members().getSymbols(NON_RECURSIVE)) {
+                if (sym.kind == Kinds.TYP) {
+                    ClassSymbol nestedClass = (ClassSymbol)sym;
                     nestedClass.complete();
                     writeClass(pool, nestedClass, writer);
                 }
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -488,8 +488,10 @@
         public JavaFileObject sourcefile;
         /** The package to which this compilation unit belongs. */
         public PackageSymbol packge;
+        /** A scope containing top level classes. */
+        public WriteableScope toplevelScope;
         /** A scope for all named imports. */
-        public ImportScope namedImportScope;
+        public NamedImportScope namedImportScope;
         /** A scope for all import-on-demands. */
         public StarImportScope starImportScope;
         /** Line starting positions, defined only if option -g is set. */
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -25,6 +25,8 @@
 
 package com.sun.tools.javac.tree;
 
+import java.util.Iterator;
+
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
@@ -692,13 +694,36 @@
             break;
         }
         case CLASS:
-            Type outer = t.getEnclosingType();
-            JCExpression clazz = outer.hasTag(CLASS) && t.tsym.owner.kind == TYP
-                ? Select(Type(outer), t.tsym)
-                : QualIdent(t.tsym);
-            tp = t.getTypeArguments().isEmpty()
-                ? clazz
-                : TypeApply(clazz, Types(t.getTypeArguments()));
+            switch (t.getKind()) {
+            case UNION: {
+                UnionClassType tu = (UnionClassType)t;
+                ListBuffer<JCExpression> la = new ListBuffer<>();
+                for (Type ta : tu.getAlternativeTypes()) {
+                    la.add(Type(ta));
+                }
+                tp = TypeUnion(la.toList());
+                break;
+            }
+            case INTERSECTION: {
+                IntersectionClassType it = (IntersectionClassType)t;
+                ListBuffer<JCExpression> la = new ListBuffer<>();
+                for (Type ta : it.getExplicitComponents()) {
+                    la.add(Type(ta));
+                }
+                tp = TypeIntersection(la.toList());
+                break;
+            }
+            default: {
+                Type outer = t.getEnclosingType();
+                JCExpression clazz = outer.hasTag(CLASS) && t.tsym.owner.kind == TYP
+                        ? Select(Type(outer), t.tsym)
+                        : QualIdent(t.tsym);
+                tp = t.getTypeArguments().isEmpty()
+                        ? clazz
+                        : TypeApply(clazz, Types(t.getTypeArguments()));
+                break;
+            }
+            }
             break;
         case ARRAY:
             tp = TypeArray(Type(types.elemtype(t)));
@@ -955,24 +980,26 @@
             sym.owner.kind == MTH || sym.owner.kind == VAR) {
             return true;
         } else if (sym.kind == TYP && toplevel != null) {
-            Scope.Entry e;
-            e = toplevel.namedImportScope.lookup(sym.name);
-            if (e.scope != null) {
+            Iterator<Symbol> it = toplevel.namedImportScope.getSymbolsByName(sym.name).iterator();
+            if (it.hasNext()) {
+                Symbol s = it.next();
                 return
-                  e.sym == sym &&
-                  e.next().scope == null;
+                  s == sym &&
+                  !it.hasNext();
             }
-            e = toplevel.packge.members().lookup(sym.name);
-            if (e.scope != null) {
+            it = toplevel.packge.members().getSymbolsByName(sym.name).iterator();
+            if (it.hasNext()) {
+                Symbol s = it.next();
                 return
-                  e.sym == sym &&
-                  e.next().scope == null;
+                  s == sym &&
+                  !it.hasNext();
             }
-            e = toplevel.starImportScope.lookup(sym.name);
-            if (e.scope != null) {
+            it = toplevel.starImportScope.getSymbolsByName(sym.name).iterator();
+            if (it.hasNext()) {
+                Symbol s = it.next();
                 return
-                  e.sym == sym &&
-                  e.next().scope == null;
+                  s == sym &&
+                  !it.hasNext();
             }
         }
         return false;
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Wed Jul 05 19:50:06 2017 +0200
@@ -270,16 +270,9 @@
             } else if (result.isMalformed() || result.isUnmappable()) {
                 // bad character in input
 
-                // report coding error (warn only pre 1.5)
-                if (!getSource().allowEncodingErrors()) {
-                    log.error(new SimpleDiagnosticPosition(dest.limit()),
-                              "illegal.char.for.encoding",
-                              charset == null ? encodingName : charset.name());
-                } else {
-                    log.warning(new SimpleDiagnosticPosition(dest.limit()),
-                                "illegal.char.for.encoding",
-                                charset == null ? encodingName : charset.name());
-                }
+                log.error(new SimpleDiagnosticPosition(dest.limit()),
+                          "illegal.char.for.encoding",
+                          charset == null ? encodingName : charset.name());
 
                 // skip past the coding error
                 inbuf.position(inbuf.position() + result.length());
--- a/langtools/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -29,10 +29,12 @@
 
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.util.List;
 
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+
 /**
  * Represents an annotation type.
  *
@@ -91,9 +93,9 @@
      */
     public AnnotationTypeElementDoc[] elements() {
         List<AnnotationTypeElementDoc> elements = List.nil();
-        for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
-            if (e.sym != null && e.sym.kind == Kinds.MTH) {
-                MethodSymbol s = (MethodSymbol)e.sym;
+        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null && sym.kind == Kinds.MTH) {
+                MethodSymbol s = (MethodSymbol)sym;
                 elements = elements.prepend(env.getAnnotationTypeElementDoc(s));
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -59,6 +59,7 @@
 import com.sun.tools.javac.util.Names;
 import com.sun.tools.javac.util.Position;
 import static com.sun.tools.javac.code.Kinds.*;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.TypeTag.CLASS;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
@@ -589,9 +590,9 @@
      */
     private FieldDoc[] fields(boolean filter, boolean enumConstants) {
         List<FieldDocImpl> fields = List.nil();
-        for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
-            if (e.sym != null && e.sym.kind == VAR) {
-                VarSymbol s = (VarSymbol)e.sym;
+        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null && sym.kind == VAR) {
+                VarSymbol s = (VarSymbol)sym;
                 boolean isEnum = ((s.flags() & Flags.ENUM) != 0) &&
                                  !env.legacyDoclet;
                 if (isEnum == enumConstants &&
@@ -614,12 +615,12 @@
     public MethodDoc[] methods(boolean filter) {
         Names names = tsym.name.table.names;
         List<MethodDocImpl> methods = List.nil();
-        for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
-            if (e.sym != null
-                && e.sym.kind == Kinds.MTH
-                && e.sym.name != names.init
-                && e.sym.name != names.clinit) {
-                MethodSymbol s = (MethodSymbol)e.sym;
+        for (Symbol sym :tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null
+                && sym.kind == Kinds.MTH
+                && sym.name != names.init
+                && sym.name != names.clinit) {
+                MethodSymbol s = (MethodSymbol)sym;
                 if (!filter || env.shouldDocument(s)) {
                     methods = methods.prepend(env.getMethodDoc(s));
                 }
@@ -649,10 +650,10 @@
     public ConstructorDoc[] constructors(boolean filter) {
         Names names = tsym.name.table.names;
         List<ConstructorDocImpl> constructors = List.nil();
-        for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
-            if (e.sym != null &&
-                e.sym.kind == Kinds.MTH && e.sym.name == names.init) {
-                MethodSymbol s = (MethodSymbol)e.sym;
+        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null &&
+                sym.kind == Kinds.MTH && sym.name == names.init) {
+                MethodSymbol s = (MethodSymbol)sym;
                 if (!filter || env.shouldDocument(s)) {
                     constructors = constructors.prepend(env.getConstructorDoc(s));
                 }
@@ -685,10 +686,9 @@
             if (l.contains(this)) return;
             l.append(this);
             List<ClassDocImpl> more = List.nil();
-            for (Scope.Entry e = tsym.members().elems; e != null;
-                 e = e.sibling) {
-                if (e.sym != null && e.sym.kind == Kinds.TYP) {
-                    ClassSymbol s = (ClassSymbol)e.sym;
+            for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+                if (sym != null && sym.kind == Kinds.TYP) {
+                    ClassSymbol s = (ClassSymbol)sym;
                     ClassDocImpl c = env.getClassDoc(s);
                     if (c.isSynthetic()) continue;
                     if (c != null) more = more.prepend(c);
@@ -713,9 +713,9 @@
      */
     public ClassDoc[] innerClasses(boolean filter) {
         ListBuffer<ClassDocImpl> innerClasses = new ListBuffer<>();
-        for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
-            if (e.sym != null && e.sym.kind == Kinds.TYP) {
-                ClassSymbol s = (ClassSymbol)e.sym;
+        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null && sym.kind == Kinds.TYP) {
+                ClassSymbol s = (ClassSymbol)sym;
                 if ((s.flags_field & Flags.SYNTHETIC) != 0) continue;
                 if (!filter || env.isVisible(s)) {
                     innerClasses.prepend(env.getClassDoc(s));
@@ -809,17 +809,17 @@
             if (compenv == null) return null;
 
             Scope s = compenv.toplevel.namedImportScope;
-            for (Scope.Entry e = s.lookup(names.fromString(className)); e.scope != null; e = e.next()) {
-                if (e.sym.kind == Kinds.TYP) {
-                    ClassDoc c = env.getClassDoc((ClassSymbol)e.sym);
+            for (Symbol sym : s.getSymbolsByName(names.fromString(className))) {
+                if (sym.kind == Kinds.TYP) {
+                    ClassDoc c = env.getClassDoc((ClassSymbol)sym);
                     return c;
                 }
             }
 
             s = compenv.toplevel.starImportScope;
-            for (Scope.Entry e = s.lookup(names.fromString(className)); e.scope != null; e = e.next()) {
-                if (e.sym.kind == Kinds.TYP) {
-                    ClassDoc c = env.getClassDoc((ClassSymbol)e.sym);
+            for (Symbol sym : s.getSymbolsByName(names.fromString(className))) {
+                if (sym.kind == Kinds.TYP) {
+                    ClassDoc c = env.getClassDoc((ClassSymbol)sym);
                     return c;
                 }
             }
@@ -918,7 +918,6 @@
          *---------------------------------*/
 
         // search current class
-        Scope.Entry e = tsym.members().lookup(names.fromString(methodName));
 
         //### Using modifier filter here isn't really correct,
         //### but emulates the old behavior.  Instead, we should
@@ -931,11 +930,11 @@
             // In order to provide textually identical results, we
             // attempt to emulate the old behavior.
             MethodSymbol lastFound = null;
-            for (; e.scope != null; e = e.next()) {
-                if (e.sym.kind == Kinds.MTH) {
+            for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) {
+                if (sym.kind == Kinds.MTH) {
                     //### Should intern methodName as Name.
-                    if (e.sym.name.toString().equals(methodName)) {
-                        lastFound = (MethodSymbol)e.sym;
+                    if (sym.name.toString().equals(methodName)) {
+                        lastFound = (MethodSymbol)sym;
                     }
                 }
             }
@@ -943,12 +942,12 @@
                 return env.getMethodDoc(lastFound);
             }
         } else {
-            for (; e.scope != null; e = e.next()) {
-                if (e.sym != null &&
-                    e.sym.kind == Kinds.MTH) {
+            for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(methodName))) {
+                if (sym != null &&
+                    sym.kind == Kinds.MTH) {
                     //### Should intern methodName as Name.
-                    if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) {
-                        return env.getMethodDoc((MethodSymbol)e.sym);
+                    if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
+                        return env.getMethodDoc((MethodSymbol)sym);
                     }
                 }
             }
@@ -1005,10 +1004,10 @@
     public ConstructorDoc findConstructor(String constrName,
                                           String[] paramTypes) {
         Names names = tsym.name.table.names;
-        for (Scope.Entry e = tsym.members().lookup(names.fromString("<init>")); e.scope != null; e = e.next()) {
-            if (e.sym.kind == Kinds.MTH) {
-                if (hasParameterTypes((MethodSymbol)e.sym, paramTypes)) {
-                    return env.getConstructorDoc((MethodSymbol)e.sym);
+        for (Symbol sym : tsym.members().getSymbolsByName(names.fromString("<init>"))) {
+            if (sym.kind == Kinds.MTH) {
+                if (hasParameterTypes((MethodSymbol)sym, paramTypes)) {
+                    return env.getConstructorDoc((MethodSymbol)sym);
                 }
             }
         }
@@ -1047,10 +1046,10 @@
         }
         searched.add(this);
 
-        for (Scope.Entry e = tsym.members().lookup(names.fromString(fieldName)); e.scope != null; e = e.next()) {
-            if (e.sym.kind == Kinds.VAR) {
+        for (Symbol sym : tsym.members().getSymbolsByName(names.fromString(fieldName))) {
+            if (sym.kind == Kinds.VAR) {
                 //### Should intern fieldName as Name.
-                return env.getFieldDoc((VarSymbol)e.sym);
+                return env.getFieldDoc((VarSymbol)sym);
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/MethodDocImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -128,8 +128,8 @@
              t.hasTag(CLASS);
              t = env.types.supertype(t)) {
             ClassSymbol c = (ClassSymbol)t.tsym;
-            for (Scope.Entry e = c.members().lookup(sym.name); e.scope != null; e = e.next()) {
-                if (sym.overrides(e.sym, origin, env.types, true)) {
+            for (Symbol sym2 : c.members().getSymbolsByName(sym.name)) {
+                if (sym.overrides(sym2, origin, env.types, true)) {
                     return TypeMaker.getType(env, t);
                 }
             }
@@ -160,9 +160,9 @@
              t.hasTag(CLASS);
              t = env.types.supertype(t)) {
             ClassSymbol c = (ClassSymbol)t.tsym;
-            for (Scope.Entry e = c.members().lookup(sym.name); e.scope != null; e = e.next()) {
-                if (sym.overrides(e.sym, origin, env.types, true)) {
-                    return env.getMethodDoc((MethodSymbol)e.sym);
+            for (Symbol sym2 : c.members().getSymbolsByName(sym.name)) {
+                if (sym.overrides(sym2, origin, env.types, true)) {
+                    return env.getMethodDoc((MethodSymbol)sym2);
                 }
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -33,7 +33,7 @@
 import com.sun.javadoc.*;
 import com.sun.source.util.TreePath;
 import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.tree.JCTree;
@@ -43,6 +43,8 @@
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Position;
 
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+
 /**
  * Represents a java package.  Provides access to information
  * about the package, the package's comment and tags, and the
@@ -146,9 +148,9 @@
             return allClassesFiltered;
         }
         ListBuffer<ClassDocImpl> classes = new ListBuffer<>();
-        for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
-            if (e.sym != null) {
-                ClassSymbol s = (ClassSymbol)e.sym;
+        for (Symbol enumerated : sym.members().getSymbols(NON_RECURSIVE)) {
+            if (enumerated != null) {
+                ClassSymbol s = (ClassSymbol)enumerated;
                 ClassDocImpl c = env.getClassDoc(s);
                 if (c != null && !c.isSynthetic())
                     c.addAllClasses(classes, filtered);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -26,15 +26,13 @@
 package com.sun.tools.javadoc;
 
 import com.sun.javadoc.*;
-import com.sun.tools.javac.code.Flags;
-import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
 import com.sun.tools.javac.code.Symbol.VarSymbol;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Name;
-import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.*;
+
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 
 /**
  * The serialized form is the specification of a class' serialization
@@ -159,9 +157,9 @@
         /* SERIALIZABLE_FIELDS can be private,
          * so must lookup by ClassSymbol, not by ClassDocImpl.
          */
-        for (Scope.Entry e = def.members().lookup(names.fromString(SERIALIZABLE_FIELDS)); e.scope != null; e = e.next()) {
-            if (e.sym.kind == Kinds.VAR) {
-                VarSymbol f = (VarSymbol)e.sym;
+        for (Symbol sym : def.members().getSymbolsByName(names.fromString(SERIALIZABLE_FIELDS))) {
+            if (sym.kind == Kinds.VAR) {
+                VarSymbol f = (VarSymbol)sym;
                 if ((f.flags() & Flags.STATIC) != 0 &&
                     (f.flags() & Flags.PRIVATE) != 0) {
                     return f;
@@ -180,9 +178,9 @@
     private void computeDefaultSerializableFields(DocEnv env,
                                                   ClassSymbol def,
                                                   ClassDocImpl cd) {
-        for (Scope.Entry e = def.members().elems; e != null; e = e.sibling) {
-            if (e.sym != null && e.sym.kind == Kinds.VAR) {
-                VarSymbol f = (VarSymbol)e.sym;
+        for (Symbol sym : def.members().getSymbols(NON_RECURSIVE)) {
+            if (sym != null && sym.kind == Kinds.VAR) {
+                VarSymbol f = (VarSymbol)sym;
                 if ((f.flags() & Flags.STATIC) == 0 &&
                     (f.flags() & Flags.TRANSIENT) == 0) {
                     //### No modifier filtering applied here.
@@ -209,9 +207,9 @@
     private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) {
         Names names = def.name.table.names;
 
-        for (Scope.Entry e = def.members().lookup(names.fromString(methodName)); e.scope != null; e = e.next()) {
-            if (e.sym.kind == Kinds.MTH) {
-                MethodSymbol md = (MethodSymbol)e.sym;
+        for (Symbol sym : def.members().getSymbolsByName(names.fromString(methodName))) {
+            if (sym.kind == Kinds.MTH) {
+                MethodSymbol md = (MethodSymbol)sym;
                 if ((md.flags() & Flags.STATIC) == 0) {
                     /*
                      * WARNING: not robust if unqualifiedMethodName is overloaded
@@ -241,10 +239,9 @@
             Name fieldName = names.fromString(tag.fieldName());
 
             // Look for a FieldDocImpl that is documented by serialFieldTagImpl.
-            for (Scope.Entry e = def.members().lookup(fieldName);
-                 e.scope != null; e = e.next()) {
-                if (e.sym.kind == Kinds.VAR) {
-                    VarSymbol f = (VarSymbol) e.sym;
+            for (Symbol sym : def.members().getSymbolsByName(fieldName)) {
+                if (sym.kind == Kinds.VAR) {
+                    VarSymbol f = (VarSymbol) sym;
                     FieldDocImpl fdi = env.getFieldDoc(f);
                     ((SerialFieldTagImpl) (tag)).mapToFieldDocImpl(fdi);
                     break;
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -26,16 +26,13 @@
 
 import com.sun.tools.classfile.Dependency.Location;
 import com.sun.tools.jdeps.PlatformClassPath.JDKArchive;
-import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
 
 /**
  * Dependency Analyzer.
@@ -52,7 +49,16 @@
         VERBOSE
     }
 
+    /**
+     * Filter to be applied when analyzing the dependencies from the given archives.
+     * Only the accepted dependencies are recorded.
+     */
+    interface Filter {
+        boolean accepts(Location origin, Archive originArchive, Location target, Archive targetArchive);
+    }
+
     private final Type type;
+    private final Filter filter;
     private final Map<Archive, ArchiveDeps> results = new HashMap<>();
     private final Map<Location, Archive> map = new HashMap<>();
     private final Archive NOT_FOUND
@@ -62,9 +68,11 @@
      * Constructs an Analyzer instance.
      *
      * @param type Type of the dependency analysis
+     * @param filter
      */
-    public Analyzer(Type type) {
+    public Analyzer(Type type, Filter filter) {
         this.type = type;
+        this.filter = filter;
     }
 
     /**
@@ -72,6 +80,18 @@
      */
     public void run(List<Archive> archives) {
         // build a map from Location to Archive
+        buildLocationArchiveMap(archives);
+
+        // traverse and analyze all dependencies
+        for (Archive archive : archives) {
+            ArchiveDeps deps = new ArchiveDeps(archive, type);
+            archive.visitDependences(deps);
+            results.put(archive, deps);
+        }
+    }
+
+    private void buildLocationArchiveMap(List<Archive> archives) {
+        // build a map from Location to Archive
         for (Archive archive: archives) {
             for (Location l: archive.getClasses()) {
                 if (!map.containsKey(l)) {
@@ -81,190 +101,202 @@
                 }
             }
         }
-        // traverse and analyze all dependencies
-        for (Archive archive : archives) {
-            ArchiveDeps deps;
-            if (type == Type.CLASS || type == Type.VERBOSE) {
-                deps = new ClassVisitor(archive);
-            } else {
-                deps = new PackageVisitor(archive);
-            }
-            archive.visitDependences(deps);
-            results.put(archive, deps);
-        }
     }
 
     public boolean hasDependences(Archive archive) {
         if (results.containsKey(archive)) {
-            return results.get(archive).deps.size() > 0;
+            return results.get(archive).dependencies().size() > 0;
         }
         return false;
     }
 
     public interface Visitor {
         /**
-         * Visits the source archive to its destination archive of
-         * a recorded dependency.
-         */
-        void visitArchiveDependence(Archive origin, Archive target, Profile profile);
-        /**
          * Visits a recorded dependency from origin to target which can be
-         * a fully-qualified classname, a package name, a profile or
+         * a fully-qualified classname, a package name, a module or
          * archive name depending on the Analyzer's type.
          */
-        void visitDependence(String origin, Archive source, String target, Archive archive, Profile profile);
+        public void visitDependence(String origin, Archive originArchive,
+                                    String target, Archive targetArchive);
     }
 
-    public void visitArchiveDependences(Archive source, Visitor v) {
-        ArchiveDeps r = results.get(source);
-        for (ArchiveDeps.Dep d: r.requireArchives()) {
-            v.visitArchiveDependence(r.archive, d.archive, d.profile);
+    /**
+     * Visit the dependencies of the given source.
+     * If the requested level is SUMMARY, it will visit the required archives list.
+     */
+    public void visitDependences(Archive source, Visitor v, Type level) {
+        if (level == Type.SUMMARY) {
+            final ArchiveDeps result = results.get(source);
+            result.requires().stream()
+                  .sorted(Comparator.comparing(Archive::getName))
+                  .forEach(archive -> {
+                      Profile profile = result.getTargetProfile(archive);
+                      v.visitDependence(source.getName(), source,
+                                        profile != null ? profile.profileName() : archive.getName(), archive);
+                  });
+        } else {
+            ArchiveDeps result = results.get(source);
+            if (level != type) {
+                // requesting different level of analysis
+                result = new ArchiveDeps(source, level);
+                source.visitDependences(result);
+            }
+            result.dependencies().stream()
+                  .sorted(Comparator.comparing(Dep::origin)
+                                    .thenComparing(Dep::target))
+                  .forEach(d -> v.visitDependence(d.origin(), d.originArchive(), d.target(), d.targetArchive()));
         }
     }
 
     public void visitDependences(Archive source, Visitor v) {
-        ArchiveDeps r = results.get(source);
-        for (Map.Entry<String, SortedSet<ArchiveDeps.Dep>> e: r.deps.entrySet()) {
-            String origin = e.getKey();
-            for (ArchiveDeps.Dep d: e.getValue()) {
-                // filter intra-dependency unless in verbose mode
-                if (type == Type.VERBOSE || d.archive != source) {
-                    v.visitDependence(origin, source, d.target, d.archive, d.profile);
-                }
-            }
-        }
+        visitDependences(source, v, type);
     }
 
     /**
-     * ArchiveDeps contains the dependencies for an Archive that
-     * can have one or more classes.
+     * ArchiveDeps contains the dependencies for an Archive that can have one or
+     * more classes.
      */
-    private abstract class ArchiveDeps implements Archive.Visitor {
-        final Archive archive;
-        final SortedMap<String, SortedSet<Dep>> deps;
-        ArchiveDeps(Archive archive) {
+    class ArchiveDeps implements Archive.Visitor {
+        protected final Archive archive;
+        protected final Set<Archive> requires;
+        protected final Set<Dep> deps;
+        protected final Type level;
+        private Profile profile;
+        ArchiveDeps(Archive archive, Type level) {
             this.archive = archive;
-            this.deps = new TreeMap<>();
-        }
-
-        void add(String origin, String target, Archive targetArchive, String pkgName) {
-            SortedSet<Dep> set = deps.get(origin);
-            if (set == null) {
-                deps.put(origin, set = new TreeSet<>());
-            }
-            Profile p = targetArchive instanceof JDKArchive
-                            ? Profile.getProfile(pkgName) : null;
-            set.add(new Dep(target, targetArchive, p));
+            this.deps = new HashSet<>();
+            this.requires = new HashSet<>();
+            this.level = level;
         }
 
-        /**
-         * Returns the list of Archive dependences.  The returned
-         * list contains one {@code Dep} instance per one archive
-         * and with the minimum profile this archive depends on.
-         */
-        List<Dep> requireArchives() {
-            Map<Archive,Profile> map = new HashMap<>();
-            for (Set<Dep> set: deps.values()) {
-                for (Dep d: set) {
-                    if (this.archive != d.archive) {
-                        Profile p = map.get(d.archive);
-                        if (p == null || (d.profile != null && p.profile < d.profile.profile)) {
-                            map.put(d.archive, d.profile);
-                        }
-                    }
-                }
+        Set<Dep> dependencies() {
+            return deps;
+        }
+
+        Set<Archive> requires() {
+            return requires;
+        }
+
+        Profile getTargetProfile(Archive target) {
+            return JDKArchive.isProfileArchive(target) ? profile : null;
+        }
+
+        Archive findArchive(Location t) {
+            Archive target = archive.getClasses().contains(t) ? archive : map.get(t);
+            if (target == null) {
+                map.put(t, target = NOT_FOUND);
             }
-            List<Dep> list = new ArrayList<>();
-            for (Map.Entry<Archive,Profile> e: map.entrySet()) {
-                list.add(new Dep("", e.getKey(), e.getValue()));
-            }
-            return list;
+            return target;
         }
 
-        /**
-         * Dep represents a dependence where the target can be
-         * a classname or packagename and the archive and profile
-         * the target belongs to.
-         */
-        class Dep implements Comparable<Dep> {
-            final String target;
-            final Archive archive;
-            final Profile profile;
-            Dep(String target, Archive archive, Profile p) {
-                this.target = target;
-                this.archive = archive;
-                this.profile = p;
+        // return classname or package name depedning on the level
+        private String getLocationName(Location o) {
+            if (level == Type.CLASS || level == Type.VERBOSE) {
+                return o.getClassName();
+            } else {
+                String pkg = o.getPackageName();
+                return pkg.isEmpty() ? "<unnamed>" : pkg;
+            }
+        }
+
+        @Override
+        public void visit(Location o, Location t) {
+            Archive targetArchive = findArchive(t);
+            if (filter.accepts(o, archive, t, targetArchive)) {
+                addDep(o, t);
+                if (!requires.contains(targetArchive)) {
+                    requires.add(targetArchive);
+                }
             }
+            if (targetArchive instanceof JDKArchive) {
+                Profile p = Profile.getProfile(t.getPackageName());
+                if (profile == null || (p != null && p.compareTo(profile) > 0)) {
+                    profile = p;
+                }
+            }
+        }
 
-            @Override
-            public boolean equals(Object o) {
-                if (o instanceof Dep) {
-                    Dep d = (Dep)o;
-                    return this.archive == d.archive && this.target.equals(d.target);
-                }
-                return false;
+        private Dep curDep;
+        protected Dep addDep(Location o, Location t) {
+            String origin = getLocationName(o);
+            String target = getLocationName(t);
+            Archive targetArchive = findArchive(t);
+            if (curDep != null &&
+                    curDep.origin().equals(origin) &&
+                    curDep.originArchive() == archive &&
+                    curDep.target().equals(target) &&
+                    curDep.targetArchive() == targetArchive) {
+                return curDep;
             }
 
-            @Override
-            public int hashCode() {
-                int hash = 3;
-                hash = 17 * hash + Objects.hashCode(this.archive);
-                hash = 17 * hash + Objects.hashCode(this.target);
-                return hash;
-            }
-
-            @Override
-            public int compareTo(Dep o) {
-                if (this.target.equals(o.target)) {
-                    if (this.archive == o.archive) {
-                        return 0;
-                    } else {
-                        return this.archive.getFileName().compareTo(o.archive.getFileName());
+            Dep e = new Dep(origin, archive, target, targetArchive);
+            if (deps.contains(e)) {
+                for (Dep e1 : deps) {
+                    if (e.equals(e1)) {
+                        curDep = e1;
                     }
                 }
-                return this.target.compareTo(o.target);
+            } else {
+                deps.add(e);
+                curDep = e;
             }
-        }
-        public abstract void visit(Location o, Location t);
-    }
-
-    private class ClassVisitor extends ArchiveDeps {
-        ClassVisitor(Archive archive) {
-            super(archive);
-        }
-        @Override
-        public void visit(Location o, Location t) {
-            Archive targetArchive =
-                this.archive.getClasses().contains(t) ? this.archive : map.get(t);
-            if (targetArchive == null) {
-                map.put(t, targetArchive = NOT_FOUND);
-            }
-
-            String origin = o.getClassName();
-            String target = t.getClassName();
-            add(origin, target, targetArchive, t.getPackageName());
+            return curDep;
         }
     }
 
-    private class PackageVisitor extends ArchiveDeps {
-        PackageVisitor(Archive archive) {
-            super(archive);
+    /*
+     * Class-level or package-level dependency
+     */
+    class Dep {
+        final String origin;
+        final Archive originArchive;
+        final String target;
+        final Archive targetArchive;
+
+        Dep(String origin, Archive originArchive, String target, Archive targetArchive) {
+            this.origin = origin;
+            this.originArchive = originArchive;
+            this.target = target;
+            this.targetArchive = targetArchive;
         }
+
+        String origin() {
+            return origin;
+        }
+
+        Archive originArchive() {
+            return originArchive;
+        }
+
+        String target() {
+            return target;
+        }
+
+        Archive targetArchive() {
+            return targetArchive;
+        }
+
         @Override
-        public void visit(Location o, Location t) {
-            Archive targetArchive =
-                this.archive.getClasses().contains(t) ? this.archive : map.get(t);
-            if (targetArchive == null) {
-                map.put(t, targetArchive = NOT_FOUND);
+        @SuppressWarnings("unchecked")
+        public boolean equals(Object o) {
+            if (o instanceof Dep) {
+                Dep d = (Dep) o;
+                return this.origin.equals(d.origin) &&
+                        this.originArchive == d.originArchive &&
+                        this.target.equals(d.target) &&
+                        this.targetArchive == d.targetArchive;
             }
+            return false;
+        }
 
-            String origin = packageOf(o);
-            String target = packageOf(t);
-            add(origin, target, targetArchive, t.getPackageName());
-        }
-        public String packageOf(Location o) {
-            String pkg = o.getPackageName();
-            return pkg.isEmpty() ? "<unnamed>" : pkg;
+        @Override
+        public int hashCode() {
+            int hash = 7;
+            hash = 67*hash + Objects.hashCode(this.origin)
+                           + Objects.hashCode(this.originArchive)
+                           + Objects.hashCode(this.target)
+                           + Objects.hashCode(this.targetArchive);
+            return hash;
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Archive.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Archive.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -25,28 +25,34 @@
 package com.sun.tools.jdeps;
 
 import com.sun.tools.classfile.Dependency.Location;
+
+import java.io.IOException;
 import java.nio.file.Path;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * Represents the source of the class files.
  */
 public class Archive {
+    public static Archive getInstance(Path p) throws IOException {
+        return new Archive(p, ClassFileReader.newInstance(p));
+    }
+
     private final Path path;
     private final String filename;
     private final ClassFileReader reader;
-    private final Map<Location, Set<Location>> deps = new HashMap<>();
+    protected Map<Location, Set<Location>> deps = new ConcurrentHashMap<>();
 
-    public Archive(String name) {
+    protected Archive(String name) {
         this.path = null;
         this.filename = name;
         this.reader = null;
     }
 
-    public Archive(Path p, ClassFileReader reader) {
+    protected Archive(Path p, ClassFileReader reader) {
         this.path = p;
         this.filename = path.getFileName().toString();
         this.reader = reader;
@@ -56,7 +62,7 @@
         return reader;
     }
 
-    public String getFileName() {
+    public String getName() {
         return filename;
     }
 
@@ -89,6 +95,10 @@
         }
     }
 
+    public boolean isEmpty() {
+        return getClasses().isEmpty();
+    }
+
     public String getPathName() {
         return path != null ? path.toString() : filename;
     }
--- a/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -68,7 +68,8 @@
 
     protected final Path path;
     protected final String baseFileName;
-    private ClassFileReader(Path path) {
+    protected final List<String> skippedEntries = new ArrayList<>();
+    protected ClassFileReader(Path path) {
         this.path = path;
         this.baseFileName = path.getFileName() != null
                                 ? path.getFileName().toString()
@@ -79,6 +80,10 @@
         return baseFileName;
     }
 
+    public List<String> skippedEntries() {
+        return skippedEntries;
+    }
+
     /**
      * Returns the ClassFile matching the given binary name
      * or a fully-qualified class name.
@@ -232,11 +237,12 @@
         }
     }
 
-    private static class JarFileReader extends ClassFileReader {
-        final JarFile jarfile;
+    static class JarFileReader extends ClassFileReader {
+        private final JarFile jarfile;
         JarFileReader(Path path) throws IOException {
-            this(path, new JarFile(path.toFile()));
+            this(path, new JarFile(path.toFile(), false));
         }
+
         JarFileReader(Path path, JarFile jf) throws IOException {
             super(path);
             this.jarfile = jf;
@@ -252,18 +258,18 @@
                             + entryName.substring(i + 1, entryName.length()));
                 }
                 if (e != null) {
-                    return readClassFile(e);
+                    return readClassFile(jarfile, e);
                 }
             } else {
                 JarEntry e = jarfile.getJarEntry(name + ".class");
                 if (e != null) {
-                    return readClassFile(e);
+                    return readClassFile(jarfile, e);
                 }
             }
             return null;
         }
 
-        private ClassFile readClassFile(JarEntry e) throws IOException {
+        protected ClassFile readClassFile(JarFile jarfile, JarEntry e) throws IOException {
             InputStream is = null;
             try {
                 is = jarfile.getInputStream(e);
@@ -277,60 +283,76 @@
         }
 
         public Iterable<ClassFile> getClassFiles() throws IOException {
-            final Iterator<ClassFile> iter = new JarFileIterator();
+            final Iterator<ClassFile> iter = new JarFileIterator(this, jarfile);
             return new Iterable<ClassFile>() {
                 public Iterator<ClassFile> iterator() {
                     return iter;
                 }
             };
         }
+    }
 
-        class JarFileIterator implements Iterator<ClassFile> {
-            private Enumeration<JarEntry> entries;
-            private JarEntry nextEntry;
-            JarFileIterator() {
-                this.entries = jarfile.entries();
-                while (entries.hasMoreElements()) {
-                    JarEntry e = entries.nextElement();
-                    String name = e.getName();
-                    if (name.endsWith(".class")) {
-                        this.nextEntry = e;
-                        break;
-                    }
+    class JarFileIterator implements Iterator<ClassFile> {
+        protected final JarFileReader reader;
+        protected Enumeration<JarEntry> entries;
+        protected JarFile jf;
+        protected JarEntry nextEntry;
+        protected ClassFile cf;
+        JarFileIterator(JarFileReader reader) {
+            this(reader, null);
+        }
+        JarFileIterator(JarFileReader reader, JarFile jarfile) {
+            this.reader = reader;
+            setJarFile(jarfile);
+        }
+
+        void setJarFile(JarFile jarfile) {
+            if (jarfile == null) return;
+
+            this.jf = jarfile;
+            this.entries = jf.entries();
+            this.nextEntry = nextEntry();
+        }
+
+        public boolean hasNext() {
+            if (nextEntry != null && cf != null) {
+                return true;
+            }
+            while (nextEntry != null) {
+                try {
+                    cf = reader.readClassFile(jf, nextEntry);
+                    return true;
+                } catch (ClassFileError | IOException ex) {
+                    skippedEntries.add(nextEntry.getName());
+                }
+                nextEntry = nextEntry();
+            }
+            return false;
+        }
+
+        public ClassFile next() {
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
+            ClassFile classFile = cf;
+            cf = null;
+            nextEntry = nextEntry();
+            return classFile;
+        }
+
+        protected JarEntry nextEntry() {
+            while (entries.hasMoreElements()) {
+                JarEntry e = entries.nextElement();
+                String name = e.getName();
+                if (name.endsWith(".class")) {
+                    return e;
                 }
             }
-
-            public boolean hasNext() {
-                return nextEntry != null;
-            }
-
-            public ClassFile next() {
-                if (!hasNext()) {
-                    throw new NoSuchElementException();
-                }
+            return null;
+        }
 
-                ClassFile cf;
-                try {
-                    cf = readClassFile(nextEntry);
-                } catch (IOException ex) {
-                    throw new ClassFileError(ex);
-                }
-                JarEntry entry = nextEntry;
-                nextEntry = null;
-                while (entries.hasMoreElements()) {
-                    JarEntry e = entries.nextElement();
-                    String name = e.getName();
-                    if (name.endsWith(".class")) {
-                        nextEntry = e;
-                        break;
-                    }
-                }
-                return cf;
-            }
-
-            public void remove() {
-                throw new UnsupportedOperationException("Not supported yet.");
-            }
+        public void remove() {
+            throw new UnsupportedOperationException("Not supported yet.");
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -30,7 +30,9 @@
 import com.sun.tools.classfile.Dependencies;
 import com.sun.tools.classfile.Dependencies.ClassFileError;
 import com.sun.tools.classfile.Dependency;
+import com.sun.tools.classfile.Dependency.Location;
 import com.sun.tools.jdeps.PlatformClassPath.JDKArchive;
+import static com.sun.tools.jdeps.Analyzer.Type.*;
 import java.io.*;
 import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
@@ -110,7 +112,7 @@
             void process(JdepsTask task, String opt, String arg) throws BadArgs {
                 Path p = Paths.get(arg);
                 if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) {
-                    throw new BadArgs("err.dot.output.path", arg);
+                    throw new BadArgs("err.invalid.path", arg);
                 }
                 task.options.dotOutputDir = arg;
             }
@@ -118,25 +120,26 @@
         new Option(false, "-s", "-summary") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.showSummary = true;
-                task.options.verbose = Analyzer.Type.SUMMARY;
+                task.options.verbose = SUMMARY;
             }
         },
         new Option(false, "-v", "-verbose",
                           "-verbose:package",
-                          "-verbose:class")
-        {
+                          "-verbose:class") {
             void process(JdepsTask task, String opt, String arg) throws BadArgs {
                 switch (opt) {
                     case "-v":
                     case "-verbose":
-                        task.options.verbose = Analyzer.Type.VERBOSE;
+                        task.options.verbose = VERBOSE;
+                        task.options.filterSameArchive = false;
+                        task.options.filterSamePackage = false;
                         break;
                     case "-verbose:package":
-                            task.options.verbose = Analyzer.Type.PACKAGE;
-                            break;
+                        task.options.verbose = PACKAGE;
+                        break;
                     case "-verbose:class":
-                            task.options.verbose = Analyzer.Type.CLASS;
-                            break;
+                        task.options.verbose = CLASS;
+                        break;
                     default:
                         throw new BadArgs("err.invalid.arg.for.option", opt);
                 }
@@ -157,6 +160,32 @@
                 task.options.regex = arg;
             }
         },
+
+        new Option(true, "-f", "-filter") {
+            void process(JdepsTask task, String opt, String arg) {
+                task.options.filterRegex = arg;
+            }
+        },
+        new Option(false, "-filter:package",
+                          "-filter:archive",
+                          "-filter:none") {
+            void process(JdepsTask task, String opt, String arg) {
+                switch (opt) {
+                    case "-filter:package":
+                        task.options.filterSamePackage = true;
+                        task.options.filterSameArchive = false;
+                        break;
+                    case "-filter:archive":
+                        task.options.filterSameArchive = true;
+                        task.options.filterSamePackage = false;
+                        break;
+                    case "-filter:none":
+                        task.options.filterSameArchive = false;
+                        task.options.filterSamePackage = false;
+                        break;
+                }
+            }
+        },
         new Option(true, "-include") {
             void process(JdepsTask task, String opt, String arg) throws BadArgs {
                 task.options.includePattern = Pattern.compile(arg);
@@ -178,12 +207,15 @@
         new Option(false, "-R", "-recursive") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.depth = 0;
+                // turn off filtering
+                task.options.filterSameArchive = false;
+                task.options.filterSamePackage = false;
             }
         },
         new Option(false, "-jdkinternals") {
             void process(JdepsTask task, String opt, String arg) {
                 task.options.findJDKInternals = true;
-                task.options.verbose = Analyzer.Type.CLASS;
+                task.options.verbose = CLASS;
                 if (task.options.includePattern == null) {
                     task.options.includePattern = Pattern.compile(".*");
                 }
@@ -262,7 +294,7 @@
                 showHelp();
                 return EXIT_CMDERR;
             }
-            if (options.showSummary && options.verbose != Analyzer.Type.SUMMARY) {
+            if (options.showSummary && options.verbose != SUMMARY) {
                 showHelp();
                 return EXIT_CMDERR;
             }
@@ -283,9 +315,28 @@
 
     private final List<Archive> sourceLocations = new ArrayList<>();
     private boolean run() throws IOException {
+        // parse classfiles and find all dependencies
         findDependencies();
-        Analyzer analyzer = new Analyzer(options.verbose);
+
+        Analyzer analyzer = new Analyzer(options.verbose, new Analyzer.Filter() {
+            @Override
+            public boolean accepts(Location origin, Archive originArchive, Location target, Archive targetArchive) {
+                if (options.findJDKInternals) {
+                    // accepts target that is JDK class but not exported
+                    return isJDKArchive(targetArchive) &&
+                              !((JDKArchive) targetArchive).isExported(target.getClassName());
+                } else if (options.filterSameArchive) {
+                    // accepts origin and target that from different archive
+                    return originArchive != targetArchive;
+                }
+                return true;
+            }
+        });
+
+        // analyze the dependencies
         analyzer.run(sourceLocations);
+
+        // output result
         if (options.dotOutputDir != null) {
             Path dir = Paths.get(options.dotOutputDir);
             Files.createDirectories(dir);
@@ -296,27 +347,34 @@
         return true;
     }
 
-    private void generateDotFiles(Path dir, Analyzer analyzer) throws IOException {
+    private void generateSummaryDotFile(Path dir, Analyzer analyzer) throws IOException {
+        // If verbose mode (-v or -verbose option),
+        // the summary.dot file shows package-level dependencies.
+        Analyzer.Type summaryType =
+            (options.verbose == PACKAGE || options.verbose == SUMMARY) ? SUMMARY : PACKAGE;
         Path summary = dir.resolve("summary.dot");
-        boolean verbose = options.verbose == Analyzer.Type.VERBOSE;
-        DotGraph<?> graph = verbose ? new DotSummaryForPackage()
-                                    : new DotSummaryForArchive();
-        for (Archive archive : sourceLocations) {
-            analyzer.visitArchiveDependences(archive, graph);
-            if (verbose || options.showLabel) {
-                // traverse detailed dependences to generate package-level
-                // summary or build labels for edges
-                analyzer.visitDependences(archive, graph);
+        try (PrintWriter sw = new PrintWriter(Files.newOutputStream(summary));
+             SummaryDotFile dotfile = new SummaryDotFile(sw, summaryType)) {
+            for (Archive archive : sourceLocations) {
+                if (!archive.isEmpty()) {
+                    if (options.verbose == PACKAGE || options.verbose == SUMMARY) {
+                        if (options.showLabel) {
+                            // build labels listing package-level dependencies
+                            analyzer.visitDependences(archive, dotfile.labelBuilder(), PACKAGE);
+                        }
+                    }
+                    analyzer.visitDependences(archive, dotfile, summaryType);
+                }
             }
         }
-        try (PrintWriter sw = new PrintWriter(Files.newOutputStream(summary))) {
-            graph.writeTo(sw);
-        }
+    }
+
+    private void generateDotFiles(Path dir, Analyzer analyzer) throws IOException {
         // output individual .dot file for each archive
-        if (options.verbose != Analyzer.Type.SUMMARY) {
+        if (options.verbose != SUMMARY) {
             for (Archive archive : sourceLocations) {
                 if (analyzer.hasDependences(archive)) {
-                    Path dotfile = dir.resolve(archive.getFileName() + ".dot");
+                    Path dotfile = dir.resolve(archive.getName() + ".dot");
                     try (PrintWriter pw = new PrintWriter(Files.newOutputStream(dotfile));
                          DotFileFormatter formatter = new DotFileFormatter(pw, archive)) {
                         analyzer.visitDependences(archive, formatter);
@@ -324,17 +382,23 @@
                 }
             }
         }
+        // generate summary dot file
+        generateSummaryDotFile(dir, analyzer);
     }
 
     private void printRawOutput(PrintWriter writer, Analyzer analyzer) {
+        RawOutputFormatter depFormatter = new RawOutputFormatter(writer);
+        RawSummaryFormatter summaryFormatter = new RawSummaryFormatter(writer);
         for (Archive archive : sourceLocations) {
-            RawOutputFormatter formatter = new RawOutputFormatter(writer);
-            analyzer.visitArchiveDependences(archive, formatter);
-            if (options.verbose != Analyzer.Type.SUMMARY) {
-                analyzer.visitDependences(archive, formatter);
+            if (!archive.isEmpty()) {
+                analyzer.visitDependences(archive, summaryFormatter, SUMMARY);
+                if (analyzer.hasDependences(archive) && options.verbose != SUMMARY) {
+                    analyzer.visitDependences(archive, depFormatter);
+                }
             }
         }
     }
+
     private boolean isValidClassName(String name) {
         if (!Character.isJavaIdentifierStart(name.charAt(0))) {
             return false;
@@ -348,21 +412,54 @@
         return true;
     }
 
-    private Dependency.Filter getDependencyFilter() {
-         if (options.regex != null) {
-            return Dependencies.getRegexFilter(Pattern.compile(options.regex));
-        } else if (options.packageNames.size() > 0) {
-            return Dependencies.getPackageFilter(options.packageNames, false);
-        } else {
-            return new Dependency.Filter() {
-                @Override
-                public boolean accepts(Dependency dependency) {
-                    return !dependency.getOrigin().equals(dependency.getTarget());
-                }
-            };
+    /*
+     * Dep Filter configured based on the input jdeps option
+     * 1. -p and -regex to match target dependencies
+     * 2. -filter:package to filter out same-package dependencies
+     *
+     * This filter is applied when jdeps parses the class files
+     * and filtered dependencies are not stored in the Analyzer.
+     *
+     * -filter:archive is applied later in the Analyzer as the
+     * containing archive of a target class may not be known until
+     * the entire archive
+     */
+    class DependencyFilter implements Dependency.Filter {
+        final Dependency.Filter filter;
+        final Pattern filterPattern;
+        DependencyFilter() {
+            if (options.regex != null) {
+                this.filter = Dependencies.getRegexFilter(Pattern.compile(options.regex));
+            } else if (options.packageNames.size() > 0) {
+                this.filter = Dependencies.getPackageFilter(options.packageNames, false);
+            } else {
+                this.filter = null;
+            }
+
+            this.filterPattern =
+                options.filterRegex != null ? Pattern.compile(options.filterRegex) : null;
+        }
+        @Override
+        public boolean accepts(Dependency d) {
+            if (d.getOrigin().equals(d.getTarget())) {
+                return false;
+            }
+            String pn = d.getTarget().getPackageName();
+            if (options.filterSamePackage && d.getOrigin().getPackageName().equals(pn)) {
+                return false;
+            }
+
+            if (filterPattern != null && filterPattern.matcher(pn).matches()) {
+                return false;
+            }
+            return filter != null ? filter.accepts(d) : true;
         }
     }
 
+    /**
+     * Tests if the given class matches the pattern given in the -include option
+     * or if it's a public class if -apionly option is specified
+     */
     private boolean matches(String classname, AccessFlags flags) {
         if (options.apiOnly && !flags.is(AccessFlags.ACC_PUBLIC)) {
             return false;
@@ -377,14 +474,14 @@
         Dependency.Finder finder =
             options.apiOnly ? Dependencies.getAPIFinder(AccessFlags.ACC_PROTECTED)
                             : Dependencies.getClassDependencyFinder();
-        Dependency.Filter filter = getDependencyFilter();
+        Dependency.Filter filter = new DependencyFilter();
 
         List<Archive> archives = new ArrayList<>();
         Deque<String> roots = new LinkedList<>();
         for (String s : classes) {
             Path p = Paths.get(s);
             if (Files.exists(p)) {
-                archives.add(new Archive(p, ClassFileReader.newInstance(p)));
+                archives.add(Archive.getInstance(p));
             } else {
                 if (isValidClassName(s)) {
                     roots.add(s);
@@ -421,19 +518,26 @@
                     throw new ClassFileError(e);
                 }
 
-                if (matches(classFileName, cf.access_flags)) {
-                    if (!doneClasses.contains(classFileName)) {
-                        doneClasses.add(classFileName);
+                // tests if this class matches the -include or -apiOnly option if specified
+                if (!matches(classFileName, cf.access_flags)) {
+                    continue;
+                }
+
+                if (!doneClasses.contains(classFileName)) {
+                    doneClasses.add(classFileName);
+                }
+
+                for (Dependency d : finder.findDependencies(cf)) {
+                    if (filter.accepts(d)) {
+                        String cn = d.getTarget().getName();
+                        if (!doneClasses.contains(cn) && !deque.contains(cn)) {
+                            deque.add(cn);
+                        }
+                        a.addClass(d.getOrigin(), d.getTarget());
                     }
-                    for (Dependency d : finder.findDependencies(cf)) {
-                        if (filter.accepts(d)) {
-                            String cn = d.getTarget().getName();
-                            if (!doneClasses.contains(cn) && !deque.contains(cn)) {
-                                deque.add(cn);
-                            }
-                            a.addClass(d.getOrigin(), d.getTarget());
-                        }
-                    }
+                }
+                for (String name : a.reader().skippedEntries()) {
+                    warning("warn.skipped.entry", name, a.getPathName());
                 }
             }
         }
@@ -462,6 +566,10 @@
                             // if name is a fully-qualified class name specified
                             // from command-line, this class might already be parsed
                             doneClasses.add(classFileName);
+                            // process @jdk.Exported for JDK classes
+                            if (isJDKArchive(a)) {
+                                ((JDKArchive)a).processJdkExported(cf);
+                            }
                             for (Dependency d : finder.findDependencies(cf)) {
                                 if (depth == 0) {
                                     // ignore the dependency
@@ -544,7 +652,7 @@
         for (Option o : recognizedOptions) {
             String name = o.aliases[0].substring(1); // there must always be at least one name
             name = name.charAt(0) == '-' ? name.substring(1) : name;
-            if (o.isHidden() || name.equals("h")) {
+            if (o.isHidden() || name.equals("h") || name.startsWith("filter:")) {
                 continue;
             }
             log.println(getMessage("main.opt." + name));
@@ -582,14 +690,18 @@
         boolean fullVersion;
         boolean showProfile;
         boolean showSummary;
-        boolean wildcard;
         boolean apiOnly;
         boolean showLabel;
         boolean findJDKInternals;
+        // default is to show package-level dependencies
+        // and filter references from same package
+        Analyzer.Type verbose = PACKAGE;
+        boolean filterSamePackage = true;
+        boolean filterSameArchive = false;
+        String filterRegex;
         String dotOutputDir;
         String classpath = "";
         int depth = 1;
-        Analyzer.Type verbose = Analyzer.Type.PACKAGE;
         Set<String> packageNames = new HashSet<>();
         String regex;             // apply to the dependences
         Pattern includePattern;   // apply to classes
@@ -613,19 +725,6 @@
         }
     }
 
-    private List<Archive> getArchives(List<String> filenames) throws IOException {
-        List<Archive> result = new ArrayList<>();
-        for (String s : filenames) {
-            Path p = Paths.get(s);
-            if (Files.exists(p)) {
-                result.add(new Archive(p, ClassFileReader.newInstance(p)));
-            } else {
-                warning("warn.file.not.exist", s);
-            }
-        }
-        return result;
-    }
-
     private List<Archive> getClassPathArchives(String paths) throws IOException {
         List<Archive> result = new ArrayList<>();
         if (paths.isEmpty()) {
@@ -648,7 +747,7 @@
                 }
                 for (Path f : files) {
                     if (Files.exists(f)) {
-                        result.add(new Archive(f, ClassFileReader.newInstance(f)));
+                        result.add(Archive.getInstance(f));
                     }
                 }
             }
@@ -656,81 +755,50 @@
         return result;
     }
 
-    /**
-     * If the given archive is JDK archive and non-null Profile,
-     * this method returns the profile name only if -profile option is specified;
-     * a null profile indicates it accesses a private JDK API and this method
-     * will return "JDK internal API".
-     *
-     * For non-JDK archives, this method returns the file name of the archive.
-     */
-    private String getProfileArchiveInfo(Archive source, Profile profile) {
-        if (options.showProfile && profile != null)
-            return profile.toString();
-
-        if (source instanceof JDKArchive) {
-            return profile == null ? "JDK internal API (" + source.getFileName() + ")" : "";
-        }
-        return source.getFileName();
-    }
-
-    /**
-     * Returns the profile name or "JDK internal API" for JDK archive;
-     * otherwise empty string.
-     */
-    private String profileName(Archive archive, Profile profile) {
-        if (archive instanceof JDKArchive) {
-            return Objects.toString(profile, "JDK internal API");
-        } else {
-            return "";
-        }
-    }
-
     class RawOutputFormatter implements Analyzer.Visitor {
         private final PrintWriter writer;
+        private String pkg = "";
         RawOutputFormatter(PrintWriter writer) {
             this.writer = writer;
         }
-
-        private String pkg = "";
         @Override
-        public void visitDependence(String origin, Archive source,
-                                    String target, Archive archive, Profile profile) {
-            if (options.findJDKInternals &&
-                    !(archive instanceof JDKArchive && profile == null)) {
-                // filter dependences other than JDK internal APIs
-                return;
-            }
-            if (options.verbose == Analyzer.Type.VERBOSE) {
-                writer.format("   %-50s -> %-50s %s%n",
-                              origin, target, getProfileArchiveInfo(archive, profile));
+        public void visitDependence(String origin, Archive originArchive,
+                                    String target, Archive targetArchive) {
+            String tag = toTag(target, targetArchive);
+            if (options.verbose == VERBOSE) {
+                writer.format("   %-50s -> %-50s %s%n", origin, target, tag);
             } else {
                 if (!origin.equals(pkg)) {
                     pkg = origin;
-                    writer.format("   %s (%s)%n", origin, source.getFileName());
+                    writer.format("   %s (%s)%n", origin, originArchive.getName());
                 }
-                writer.format("      -> %-50s %s%n",
-                              target, getProfileArchiveInfo(archive, profile));
-            }
-        }
-
-        @Override
-        public void visitArchiveDependence(Archive origin, Archive target, Profile profile) {
-            writer.format("%s -> %s", origin.getPathName(), target.getPathName());
-            if (options.showProfile && profile != null) {
-                writer.format(" (%s)%n", profile);
-            } else {
-                writer.format("%n");
+                writer.format("      -> %-50s %s%n", target, tag);
             }
         }
     }
 
-    class DotFileFormatter extends DotGraph<String> implements AutoCloseable {
+    class RawSummaryFormatter implements Analyzer.Visitor {
+        private final PrintWriter writer;
+        RawSummaryFormatter(PrintWriter writer) {
+            this.writer = writer;
+        }
+        @Override
+        public void visitDependence(String origin, Archive originArchive,
+                                    String target, Archive targetArchive) {
+            writer.format("%s -> %s", originArchive.getName(), targetArchive.getPathName());
+            if (options.showProfile && JDKArchive.isProfileArchive(targetArchive)) {
+                writer.format(" (%s)", target);
+            }
+            writer.format("%n");
+        }
+    }
+
+    class DotFileFormatter implements Analyzer.Visitor, AutoCloseable {
         private final PrintWriter writer;
         private final String name;
         DotFileFormatter(PrintWriter writer, Archive archive) {
             this.writer = writer;
-            this.name = archive.getFileName();
+            this.name = archive.getName();
             writer.format("digraph \"%s\" {%n", name);
             writer.format("    // Path: %s%n", archive.getPathName());
         }
@@ -741,173 +809,123 @@
         }
 
         @Override
-        public void visitDependence(String origin, Archive source,
-                                    String target, Archive archive, Profile profile) {
-            if (options.findJDKInternals &&
-                    !(archive instanceof JDKArchive && profile == null)) {
-                // filter dependences other than JDK internal APIs
-                return;
-            }
-            // if -P option is specified, package name -> profile will
-            // be shown and filter out multiple same edges.
-            String name = getProfileArchiveInfo(archive, profile);
-            writeEdge(writer, new Edge(origin, target, getProfileArchiveInfo(archive, profile)));
-        }
-        @Override
-        public void visitArchiveDependence(Archive origin, Archive target, Profile profile) {
-            throw new UnsupportedOperationException();
-        }
-    }
-
-    class DotSummaryForArchive extends DotGraph<Archive> {
-        @Override
-        public void visitDependence(String origin, Archive source,
-                                    String target, Archive archive, Profile profile) {
-            Edge e = findEdge(source, archive);
-            assert e != null;
-            // add the dependency to the label if enabled and not compact1
-            if (profile == Profile.COMPACT1) {
-                return;
-            }
-            e.addLabel(origin, target, profileName(archive, profile));
-        }
-        @Override
-        public void visitArchiveDependence(Archive origin, Archive target, Profile profile) {
-            // add an edge with the archive's name with no tag
-            // so that there is only one node for each JDK archive
-            // while there may be edges to different profiles
-            Edge e = addEdge(origin, target, "");
-            if (target instanceof JDKArchive) {
-                // add a label to print the profile
-                if (profile == null) {
-                    e.addLabel("JDK internal API");
-                } else if (options.showProfile && !options.showLabel) {
-                    e.addLabel(profile.toString());
-                }
-            }
+        public void visitDependence(String origin, Archive originArchive,
+                                    String target, Archive targetArchive) {
+            String tag = toTag(target, targetArchive);
+            writer.format("   %-50s -> \"%s\";%n",
+                          String.format("\"%s\"", origin),
+                          tag.isEmpty() ? target
+                                        : String.format("%s (%s)", target, tag));
         }
     }
 
-    // DotSummaryForPackage generates the summary.dot file for verbose mode
-    // (-v or -verbose option) that includes all class dependencies.
-    // The summary.dot file shows package-level dependencies.
-    class DotSummaryForPackage extends DotGraph<String> {
-        private String packageOf(String cn) {
-            int i = cn.lastIndexOf('.');
-            return i > 0 ? cn.substring(0, i) : "<unnamed>";
+    class SummaryDotFile implements Analyzer.Visitor, AutoCloseable {
+        private final PrintWriter writer;
+        private final Analyzer.Type type;
+        private final Map<Archive, Map<Archive,StringBuilder>> edges = new HashMap<>();
+        SummaryDotFile(PrintWriter writer, Analyzer.Type type) {
+            this.writer = writer;
+            this.type = type;
+            writer.format("digraph \"summary\" {%n");
         }
-        @Override
-        public void visitDependence(String origin, Archive source,
-                                    String target, Archive archive, Profile profile) {
-            // add a package dependency edge
-            String from = packageOf(origin);
-            String to = packageOf(target);
-            Edge e = addEdge(from, to, getProfileArchiveInfo(archive, profile));
 
-            // add the dependency to the label if enabled and not compact1
-            if (!options.showLabel || profile == Profile.COMPACT1) {
-                return;
-            }
-
-            // trim the package name of origin to shorten the label
-            int i = origin.lastIndexOf('.');
-            String n1 = i < 0 ? origin : origin.substring(i+1);
-            e.addLabel(n1, target, profileName(archive, profile));
-        }
         @Override
-        public void visitArchiveDependence(Archive origin, Archive target, Profile profile) {
-            // nop
-        }
-    }
-    abstract class DotGraph<T> implements Analyzer.Visitor  {
-        private final Set<Edge> edges = new LinkedHashSet<>();
-        private Edge curEdge;
-        public void writeTo(PrintWriter writer) {
-            writer.format("digraph \"summary\" {%n");
-            for (Edge e: edges) {
-                writeEdge(writer, e);
-            }
+        public void close() {
             writer.println("}");
         }
 
-        void writeEdge(PrintWriter writer, Edge e) {
-            writer.format("   %-50s -> \"%s\"%s;%n",
-                          String.format("\"%s\"", e.from.toString()),
-                          e.tag.isEmpty() ? e.to
-                                          : String.format("%s (%s)", e.to, e.tag),
-                          getLabel(e));
+        @Override
+        public void visitDependence(String origin, Archive originArchive,
+                                    String target, Archive targetArchive) {
+            String targetName = type == PACKAGE ? target : targetArchive.getName();
+            if (type == PACKAGE) {
+                String tag = toTag(target, targetArchive, type);
+                if (!tag.isEmpty())
+                    targetName += " (" + tag + ")";
+            } else if (options.showProfile && JDKArchive.isProfileArchive(targetArchive)) {
+                targetName += " (" + target + ")";
+            }
+            String label = getLabel(originArchive, targetArchive);
+            writer.format("  %-50s -> \"%s\"%s;%n",
+                          String.format("\"%s\"", origin), targetName, label);
         }
 
-        Edge addEdge(T origin, T target, String tag) {
-            Edge e = new Edge(origin, target, tag);
-            if (e.equals(curEdge)) {
-                return curEdge;
-            }
+        String getLabel(Archive origin, Archive target) {
+            if (edges.isEmpty())
+                return "";
 
-            if (edges.contains(e)) {
-                for (Edge e1 : edges) {
-                   if (e.equals(e1)) {
-                       curEdge = e1;
-                   }
-                }
-            } else {
-                edges.add(e);
-                curEdge = e;
-            }
-            return curEdge;
-        }
-
-        Edge findEdge(T origin, T target) {
-            for (Edge e : edges) {
-                if (e.from.equals(origin) && e.to.equals(target)) {
-                    return e;
-                }
-            }
-            return null;
-        }
-
-        String getLabel(Edge e) {
-            String label = e.label.toString();
-            return label.isEmpty() ? "" : String.format("[label=\"%s\",fontsize=9]", label);
+            StringBuilder label = edges.get(origin).get(target);
+            return label == null ? "" : String.format(" [label=\"%s\",fontsize=9]", label.toString());
         }
 
-        class Edge {
-            final T from;
-            final T to;
-            final String tag;  // optional tag
-            final StringBuilder label = new StringBuilder();
-            Edge(T from, T to, String tag) {
-                this.from = from;
-                this.to = to;
-                this.tag = tag;
-            }
-            void addLabel(String s) {
-                label.append(s).append("\\n");
-            }
-            void addLabel(String origin, String target, String profile) {
-                label.append(origin).append(" -> ").append(target);
-                if (!profile.isEmpty()) {
-                    label.append(" (" + profile + ")");
+        Analyzer.Visitor labelBuilder() {
+            // show the package-level dependencies as labels in the dot graph
+            return new Analyzer.Visitor() {
+                @Override
+                public void visitDependence(String origin, Archive originArchive, String target, Archive targetArchive) {
+                    edges.putIfAbsent(originArchive, new HashMap<>());
+                    edges.get(originArchive).putIfAbsent(targetArchive, new StringBuilder());
+                    StringBuilder sb = edges.get(originArchive).get(targetArchive);
+                    String tag = toTag(target, targetArchive, PACKAGE);
+                    addLabel(sb, origin, target, tag);
                 }
-                label.append("\\n");
-            }
-            @Override @SuppressWarnings("unchecked")
-            public boolean equals(Object o) {
-                if (o instanceof DotGraph<?>.Edge) {
-                    DotGraph<?>.Edge e = (DotGraph<?>.Edge)o;
-                    return this.from.equals(e.from) &&
-                           this.to.equals(e.to) &&
-                           this.tag.equals(e.tag);
+
+                void addLabel(StringBuilder label, String origin, String target, String tag) {
+                    label.append(origin).append(" -> ").append(target);
+                    if (!tag.isEmpty()) {
+                        label.append(" (" + tag + ")");
+                    }
+                    label.append("\\n");
                 }
-                return false;
-            }
-            @Override
-            public int hashCode() {
-                int hash = 7;
-                hash = 67 * hash + Objects.hashCode(this.from) +
-                       Objects.hashCode(this.to) + Objects.hashCode(this.tag);
-                return hash;
-            }
+            };
         }
     }
+
+    /**
+     * Test if the given archive is part of the JDK
+     */
+    private boolean isJDKArchive(Archive archive) {
+        return JDKArchive.class.isInstance(archive);
+    }
+
+    /**
+     * If the given archive is JDK archive, this method returns the profile name
+     * only if -profile option is specified; it accesses a private JDK API and
+     * the returned value will have "JDK internal API" prefix
+     *
+     * For non-JDK archives, this method returns the file name of the archive.
+     */
+    private String toTag(String name, Archive source, Analyzer.Type type) {
+        if (!isJDKArchive(source)) {
+            return source.getName();
+        }
+
+        JDKArchive jdk = (JDKArchive)source;
+        boolean isExported = false;
+        if (type == CLASS || type == VERBOSE) {
+            isExported = jdk.isExported(name);
+        } else {
+            isExported = jdk.isExportedPackage(name);
+        }
+        Profile p = getProfile(name, type);
+        if (isExported) {
+            // exported API
+            return options.showProfile && p != null ? p.profileName() : "";
+        } else {
+            return "JDK internal API (" + source.getName() + ")";
+        }
+    }
+
+    private String toTag(String name, Archive source) {
+        return toTag(name, source, options.verbose);
+    }
+
+    private Profile getProfile(String name, Analyzer.Type type) {
+        String pn = name;
+        if (type == CLASS || type == VERBOSE) {
+            int i = name.lastIndexOf('.');
+            pn = i > 0 ? name.substring(0, i) : "";
+        }
+        return Profile.getProfile(pn);
+    }
 }
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Main.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Main.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -63,4 +63,3 @@
         return t.run(args);
     }
 }
-
--- a/langtools/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -24,6 +24,12 @@
  */
 package com.sun.tools.jdeps;
 
+import com.sun.tools.classfile.Annotation;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.RuntimeAnnotations_attribute;
+import com.sun.tools.classfile.Dependencies.ClassFileError;
 import java.io.IOException;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
@@ -33,11 +39,15 @@
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.*;
 
+import static com.sun.tools.classfile.Attribute.*;
+
 /**
  * ClassPath for Java SE and JDK
  */
 class PlatformClassPath {
-    private final static List<Archive> javaHomeArchives = init();
+    private static final List<String> NON_PLATFORM_JARFILES =
+        Arrays.asList("alt-rt.jar", "jfxrt.jar", "ant-javafx.jar", "javafx-mx.jar");
+    private static final List<Archive> javaHomeArchives = init();
 
     static List<Archive> getArchives() {
         return javaHomeArchives;
@@ -50,12 +60,19 @@
             if (home.endsWith("jre")) {
                 // jar files in <javahome>/jre/lib
                 result.addAll(addJarFiles(home.resolve("lib")));
+                if (home.getParent() != null) {
+                    // add tools.jar and other JDK jar files
+                    Path lib = home.getParent().resolve("lib");
+                    if (Files.exists(lib)) {
+                        result.addAll(addJarFiles(lib));
+                    }
+                }
             } else if (Files.exists(home.resolve("lib"))) {
                 // either a JRE or a jdk build image
                 Path classes = home.resolve("classes");
                 if (Files.isDirectory(classes)) {
                     // jdk build outputdir
-                    result.add(new JDKArchive(classes, ClassFileReader.newInstance(classes)));
+                    result.add(new JDKArchive(classes));
                 }
                 // add other JAR files
                 result.addAll(addJarFiles(home.resolve("lib")));
@@ -91,9 +108,9 @@
                 if (fn.endsWith(".jar")) {
                     // JDK may cobundle with JavaFX that doesn't belong to any profile
                     // Treat jfxrt.jar as regular Archive
-                    result.add(fn.equals("jfxrt.jar")
-                        ? new Archive(p, ClassFileReader.newInstance(p))
-                        : new JDKArchive(p, ClassFileReader.newInstance(p)));
+                    result.add(NON_PLATFORM_JARFILES.contains(fn)
+                                   ? Archive.getInstance(p)
+                                   : new JDKArchive(p));
                 }
                 return FileVisitResult.CONTINUE;
             }
@@ -106,8 +123,91 @@
      * or implementation classes (i.e. JDK internal API)
      */
     static class JDKArchive extends Archive {
-        JDKArchive(Path p, ClassFileReader reader) {
-            super(p, reader);
+        private static List<String> PROFILE_JARS = Arrays.asList("rt.jar", "jce.jar");
+        public static boolean isProfileArchive(Archive archive) {
+            if (archive instanceof JDKArchive) {
+                return PROFILE_JARS.contains(archive.getName());
+            }
+            return false;
+        }
+
+        private final Map<String,Boolean> exportedPackages = new HashMap<>();
+        private final Map<String,Boolean> exportedTypes = new HashMap<>();
+        JDKArchive(Path p) throws IOException {
+            super(p, ClassFileReader.newInstance(p));
+        }
+
+        /**
+         * Tests if a given fully-qualified name is an exported type.
+         */
+        public boolean isExported(String cn) {
+            int i = cn.lastIndexOf('.');
+            String pn = i > 0 ? cn.substring(0, i) : "";
+
+            boolean isJdkExported = isExportedPackage(pn);
+            if (exportedTypes.containsKey(cn)) {
+                return exportedTypes.get(cn);
+            }
+            return isJdkExported;
+        }
+
+        /**
+         * Tests if a given package name is exported.
+         */
+        public boolean isExportedPackage(String pn) {
+            if (Profile.getProfile(pn) != null) {
+                return true;
+            }
+            return exportedPackages.containsKey(pn) ? exportedPackages.get(pn) : false;
+        }
+
+        private static final String JDK_EXPORTED_ANNOTATION = "Ljdk/Exported;";
+        private Boolean isJdkExported(ClassFile cf) throws ConstantPoolException {
+            RuntimeAnnotations_attribute attr = (RuntimeAnnotations_attribute)
+                    cf.attributes.get(RuntimeVisibleAnnotations);
+            if (attr != null) {
+                for (int i = 0; i < attr.annotations.length; i++) {
+                    Annotation ann = attr.annotations[i];
+                    String annType = cf.constant_pool.getUTF8Value(ann.type_index);
+                    if (JDK_EXPORTED_ANNOTATION.equals(annType)) {
+                        boolean isJdkExported = true;
+                        for (int j = 0; j < ann.num_element_value_pairs; j++) {
+                            Annotation.element_value_pair pair = ann.element_value_pairs[j];
+                            Annotation.Primitive_element_value ev = (Annotation.Primitive_element_value) pair.value;
+                            ConstantPool.CONSTANT_Integer_info info = (ConstantPool.CONSTANT_Integer_info)
+                                    cf.constant_pool.get(ev.const_value_index);
+                            isJdkExported = info.value != 0;
+                        }
+                        return Boolean.valueOf(isJdkExported);
+                    }
+                }
+            }
+            return null;
+        }
+
+        void processJdkExported(ClassFile cf) throws IOException {
+            try {
+                String cn = cf.getName();
+                String pn = cn.substring(0, cn.lastIndexOf('/')).replace('/', '.');
+
+                Boolean b = isJdkExported(cf);
+                if (b != null) {
+                    exportedTypes.put(cn.replace('/', '.'), b);
+                }
+                if (!exportedPackages.containsKey(pn)) {
+                    // check if package-info.class has @jdk.Exported
+                    Boolean isJdkExported = null;
+                    ClassFile pcf = reader().getClassFile(cn.substring(0, cn.lastIndexOf('/')+1) + "package-info");
+                    if (pcf != null) {
+                        isJdkExported = isJdkExported(pcf);
+                    }
+                    if (isJdkExported != null) {
+                        exportedPackages.put(pn, isJdkExported);
+                    }
+                }
+            } catch (ConstantPoolException e) {
+                throw new ClassFileError(e);
+            }
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Profile.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Profile.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -43,7 +43,6 @@
  * Build the profile information from ct.sym if exists.
  */
 enum Profile {
-
     COMPACT1("compact1", 1),
     COMPACT2("compact2", 2),
     COMPACT3("compact3", 3),
@@ -61,8 +60,7 @@
         this.proprietaryPkgs = new HashSet<>();
     }
 
-    @Override
-    public String toString() {
+    public String profileName() {
         return name;
     }
 
@@ -77,7 +75,7 @@
     public static Profile getProfile(String pn) {
         Profile profile = PackageToProfile.map.get(pn);
         return (profile != null && profile.packages.contains(pn))
-                ? profile : null;
+                    ? profile : null;
     }
 
     static class PackageToProfile {
--- a/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -1,6 +1,6 @@
 main.usage.summary=\
 Usage: {0} <options> <classes...>\n\
-use -h, -? or --help for a list of possible options
+use -h, -? or -help for a list of possible options
 
 main.usage=\
 Usage: {0} <options> <classes...>\n\
@@ -18,20 +18,29 @@
 
 main.opt.v=\
 \  -v           -verbose              Print all class level dependencies\n\
+\                                     Equivalent to -verbose:class -filter:none.\n\
 \  -verbose:package                   Print package-level dependencies excluding\n\
-\                                     dependencies within the same archive\n\
+\                                     dependencies within the same package by default\n\
 \  -verbose:class                     Print class-level dependencies excluding\n\
-\                                     dependencies within the same archive
+\                                     dependencies within the same package by default
+
+main.opt.f=\
+\  -f <regex>   -filter <regex>       Filter dependences matching the given pattern\n\
+\                                     If given multiple times, the last one will be used.\n\
+\  -filter:package                    Filter dependences within the same package (default)\n\
+\  -filter:archive                    Filter dependences within the same archive\n\
+\  -filter:none                       No -filter:package and -filter:archive filtering\n\
+\                                     Filtering specified via the -filter option still applies.
 
 main.opt.s=\
 \  -s           -summary              Print dependency summary only
 
 main.opt.p=\
-\  -p <pkgname> -package <pkgname>    Finds dependences in the given package\n\
+\  -p <pkgname> -package <pkgname>    Finds dependences matching the given package name\n\
 \                                     (may be given multiple times)
 
 main.opt.e=\
-\  -e <regex>   -regex <regex>        Finds dependences in packages matching pattern\n\
+\  -e <regex>   -regex <regex>        Finds dependences matching the given pattern\n\
 \                                     (-p and -e are exclusive)
 
 main.opt.include=\
@@ -47,7 +56,10 @@
 \  -cp <path>   -classpath <path>     Specify where to find class files
 
 main.opt.R=\
-\  -R           -recursive            Recursively traverse all dependencies
+\  -R           -recursive            Recursively traverse all dependencies.\n\
+\                                     The -R option implies -filter:none.  If -p, -e, -f\n\
+\                                     option is specified, only the matching dependences\n\
+\                                     are analyzed.
 
 main.opt.apionly=\
 \  -apionly                           Restrict analysis to APIs i.e. dependences\n\
@@ -74,12 +86,11 @@
 
 err.unknown.option=unknown option: {0}
 err.missing.arg=no value given for {0}
-err.internal.error=internal error: {0} {1} {2}
 err.invalid.arg.for.option=invalid argument for option: {0}
 err.option.after.class=option must be specified before classes: {0}
 err.option.unsupported={0} not supported: {1}
 err.profiles.msg=No profile information
-err.dot.output.path=invalid path: {0}
+err.invalid.path=invalid path: {0}
 warn.invalid.arg=Invalid classname or pathname not exist: {0}
 warn.split.package=package {0} defined in {1} {2}
 
--- a/langtools/src/share/classes/jdk/Exported.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/src/share/classes/jdk/Exported.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -71,7 +71,10 @@
 @Exported
 public @interface Exported {
     /**
-     * Whether or not the annotated type or package is an exported part of the JDK.
+     * Whether or not the annotated type or package is an exported
+     * part of the JDK.
+     * @return whether or not the annotated type or package is an exported
+     * part of the JDK
      */
     boolean value() default true;
 }
--- a/langtools/test/com/sun/javadoc/testOrdering/TestOrdering.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testOrdering/TestOrdering.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8039410 8042601 8042829
+ * @bug 8039410 8042601 8042829 8049393
  * @summary test to determine if members are ordered correctly
  * @author ksrini
  * @library ../lib/
@@ -66,6 +66,9 @@
                 "pkg1");
         checkExit(Exit.OK);
         checkClassUseOrdering("pkg1/class-use/UsedClass.html");
+        checkOrder("pkg1/class-use/UsedClass.html", expectedClassUseMethodOrdering);
+        checkOrder("pkg1/class-use/UsedClass.html", expectedClassUseWithTypeParams);
+        checkOrder("pkg1/class-use/UsedClass.html", expectedInnerClassContructors);
     }
 
     enum ListOrder { NONE, REVERSE, SHUFFLE };
@@ -273,10 +276,44 @@
         return in.replace("/", ".");
     }
 
+    final String expectedInnerClassContructors[] = {
+        "../../pkg1/A.html#A-pkg1.UsedClass-",
+        "../../pkg1/B.A.html#A-pkg1.UsedClass-",
+        "../../pkg1/B.html#B-pkg1.UsedClass-",
+        "../../pkg1/A.C.html#C-pkg1.UsedClass-java.lang.Object:A-",
+        "../../pkg1/A.C.html#C-pkg1.UsedClass-java.util.Collection-",
+        "../../pkg1/A.C.html#C-pkg1.UsedClass-java.util.List-"
+    };
+
+    final String expectedClassUseMethodOrdering[] = {
+        "../../pkg1/MethodOrder.html#m--",
+        "../../pkg1/MethodOrder.html#m-byte:A-",
+        "../../pkg1/MethodOrder.html#m-double-",
+        "../../pkg1/MethodOrder.html#m-double-double-",
+        "../../pkg1/MethodOrder.html#m-double-java.lang.Double-",
+        "../../pkg1/MethodOrder.html#m-int-",
+        "../../pkg1/MethodOrder.html#m-int-int-",
+        "../../pkg1/MethodOrder.html#m-int-java.lang.Integer-",
+        "../../pkg1/MethodOrder.html#m-java.lang.Double-",
+        "../../pkg1/MethodOrder.html#m-java.lang.Double-double-",
+        "../../pkg1/MethodOrder.html#m-java.lang.Double-java.lang.Double-",
+        "../../pkg1/MethodOrder.html#m-java.lang.Integer-",
+        "../../pkg1/MethodOrder.html#m-java.lang.Integer-int-",
+        "../../pkg1/MethodOrder.html#m-java.lang.Integer-java.lang.Integer-",
+        "../../pkg1/MethodOrder.html#m-java.lang.Object:A-",
+        "../../pkg1/MethodOrder.html#m-java.util.ArrayList-",
+        "../../pkg1/MethodOrder.html#m-java.util.Collection-",
+        "../../pkg1/MethodOrder.html#m-java.util.List-"
+    };
+    final String expectedClassUseWithTypeParams[] = {
+        "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-",
+        "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass-",
+        "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass:A-",
+        "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-java.lang.String-"
+    };
     final String expectedMethodOrdering[] = {
         "Add.html#add--",
         "Add.html#add-double-",
-        "Add.html#add-java.lang.Double-",
         "Add.html#add-double-byte-",
         "Add.html#add-double-double-",
         "Add.html#add-double-java.lang.Double-",
@@ -284,6 +321,7 @@
         "Add.html#add-float-int-",
         "Add.html#add-int-",
         "Add.html#add-int-float-",
+        "Add.html#add-java.lang.Double-",
         "Add.html#add-java.lang.Integer-"
     };
     final String expectedEnumOrdering[] = {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/A.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package pkg1;
+import java.util.Collection;
+import java.util.List;
+public class A {
+
+    /**
+     * Constructor
+     * @param a class
+     */
+    public A(UsedClass a) {}
+
+    /**
+     * test inner classes
+     */
+    public static class C {
+
+        /**
+         * inner classes constructor
+         * @param u a param
+         * @param array a param
+         */
+        public C(UsedClass u, Object[] array){}
+
+        /**
+         * inner classes constructor
+         * @param u a param
+         * @param collection a param
+         */
+        public C(UsedClass u, Collection collection){}
+
+        /**
+         * inner classes constructor
+         * @param u a param
+         * @param list a param
+         */
+        public C(UsedClass u, List list){}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/B.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package pkg1;
+public class B {
+
+    /**
+     * constructor
+     * @param a param
+     */
+    public B(UsedClass a) {}
+
+    /**
+     * Inner class
+     */
+    static public class A {
+
+        /**
+         * constructor
+         * @param b param
+         */
+        public A(UsedClass b){}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/MethodOrder.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+public class MethodOrder {
+    /**
+     * method test for ordering parameters
+     * @return UsedClass something
+     */
+    public UsedClass m(){return null;}
+    /**
+     * method test for ordering parameters
+     * @param i a param
+     * @return UsedClass something
+     */
+    public UsedClass m(int i) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param i1 a param
+     * @param i2 a param
+     * @return something
+     */
+    public UsedClass m(int i1, int i2) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param array a param
+     * @return something
+     */
+    public UsedClass m(byte[] array) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param in a param
+     * @return something
+     */
+    public UsedClass m(Integer in) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param i1 a param
+     * @param i2 a param
+     * @return something
+     */
+    public UsedClass m(Integer i1, Integer i2) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param i1 a param
+     * @param i2 a param
+     * @return something
+     */
+    public UsedClass m(int i1, Integer i2) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param i1 a param
+     * @param i2 a param
+     * @return something
+     */
+    public UsedClass m(Integer i1, int i2) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param d a param
+     * @return something
+     */
+    public UsedClass m(double d) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param i1 a param
+     * @param i2 a param
+     * @return something
+     */
+    public UsedClass m(double i1, double i2) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param in a param
+     * @return something
+     */
+    public UsedClass m(Double in) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param i1 a param
+     * @param i2 a param
+     * @return something
+     */
+    public UsedClass m(Double i1, Double i2) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param i1 a param
+     * @param i2 a param
+     * @return something
+     */
+    public UsedClass m(double i1, Double i2) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param l1 param
+     * @return something
+     */
+    public UsedClass m(long l1) {return null;}
+
+    /**
+     *  method test for ordering parameters
+     * @param l1 param
+     * @param l2 param
+     * @return something
+     */
+    public UsedClass m(long l1, Long l2) {return null;}
+
+    /**
+     *  method test for ordering parameters
+     * @param l1 param
+     * @param l2 param
+     * @return something
+     */
+    public UsedClass m(long l1, long l2) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param array a param
+     * @return something
+     */
+    public UsedClass m(Object[] array);
+
+    /**
+     * method test for ordering parameters
+     * @param arrayarray two dimensional array
+     * @return something
+     */
+    public UsedClass m(Object[][] arrayarray);
+
+    /**
+     * method test for ordering parameters
+     * @param i1 a param
+     * @param i2 a param
+     * @return something
+     */
+    public UsedClass m(Double i1, double i2) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param collection a param
+     * @return something
+     */
+    public UsedClass m(Collection collection) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param list a param
+     * @return something
+     */
+    public UsedClass m(List list) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param collection a param
+     * @return something
+     */
+    public UsedClass m(ArrayList<UsedClass> collection) {return null;}
+
+    /**
+     * method test for ordering parameters
+     * @param u use a type param
+     */
+    public void tpm(UsedClass<?> u) {}
+
+    /**
+     * method test for ordering parameters
+     * @param u1 use a type param
+     * @param u2 use a type param
+     */
+    public void tpm(UsedClass<?> u1, UsedClass<?> u2) {}
+
+    /**
+     * method test for ordering parameters
+     * @param u use a type param
+     * @param array use a type param and an array
+     */
+    public void tpm(UsedClass<?> u, UsedClass<?>[] array) {}
+
+    /**
+     * method test for ordering parameters
+     * @param u use type param with extends
+     * @param a some string
+     */
+    public void tpm(UsedClass<? extends UsedClass> u, String a) {}
+}
--- a/langtools/test/com/sun/javadoc/testOrdering/pkg1/UsedClass.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/UsedClass.java	Wed Jul 05 19:50:06 2017 +0200
@@ -25,4 +25,4 @@
 /**
  * For class-use testing
  */
-public class UsedClass {}
+public class UsedClass<T> {}
--- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Wed Jul 05 19:50:06 2017 +0200
@@ -91,6 +91,19 @@
                 "PrivateParent",
                 "PrivateInterface");
 
+        checkOutput("pkg/PublicChild.html", false,
+                // Should not document comments from private inherited interfaces
+                "<td class=\"colLast\"><code><span class=\"memberNameLink\">" +
+                "<a href=\"../pkg/PublicChild.html#methodInterface-int-\">" +
+                "methodInterface</a></span>(int&nbsp;p1)</code>\n" +
+                "<div class=\"block\">Comment from interface.</div>\n</td>",
+                // and similarly one more
+                "<td class=\"colLast\"><code><span class=\"memberNameLink\">" +
+                "<a href=\"../pkg/PublicChild.html#methodInterface2-int-\">" +
+                "methodInterface2</a></span>(int&nbsp;p1)</code>\n" +
+                "<div class=\"block\">Comment from interface.</div>\n</td>"
+        );
+
         checkOutput("pkg/PublicInterface.html", true,
                 // Field inheritance from non-public superinterface.
                 "<a href=\"../pkg/PublicInterface.html#fieldInheritedFromInterface\">"
@@ -111,7 +124,7 @@
                 "PrivateInterface",
                 "All Superinterfaces");
 
-        checkOutput("pkg2/C.html", true,
+        checkOutput("pkg2/C.html", false,
                 //Generic interface method test.
                 "This comment should get copied to the implementing class");
 
--- a/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testUseOption/TestUseOption.java	Wed Jul 05 19:50:06 2017 +0200
@@ -96,6 +96,30 @@
         checkOutput("pkg1/class-use/UsedClass.html", false,
            "methodInC1Protected"
         );
+        checkOutput("pkg1/class-use/UsedInterface.html", true,
+           "<a href=\"../../pkg1/AnAbstract.html\" title=\"class in pkg1\">AnAbstract</a>"
+        );
+        checkOutput("pkg1/class-use/UsedInterface.html", true,
+            "../../pkg1/C10.html#withReturningTypeParameters--"
+        );
+        checkOutput("pkg1/class-use/UsedInterface.html", true,
+            "../../pkg1/C10.html#withTypeParametersOfType-java.lang.Class-"
+        );
+        checkOutput("pkg1/class-use/UsedInterface.html", true,
+            "\"../../pkg1/package-summary.html\">pkg1</a> that return " +
+            "<a href=\"../../pkg1/UsedInterface.html\" title=\"interface in pkg1\""
+        );
+        checkOutput("pkg1/class-use/UsedInterface.html", true,
+            "<a href=\"../../pkg1/C10.html#addAll-pkg1.UsedInterface...-\">addAll</a>"
+        );
+        checkOutput("pkg1/class-use/UsedInterface.html", true,
+            "<a href=\"../../pkg1/C10.html#create-pkg1.UsedInterfaceA-pkg1." +
+            "UsedInterface-java.lang.String-\">"
+        );
+        checkOutput("pkg1/class-use/UsedInterface.html", true,
+            "<a href=\"../../pkg1/C10.html#withTypeParametersOfType-java.lang.Class-\">" +
+            "withTypeParametersOfType</a>"
+        );
     }
 
     @Test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testUseOption/pkg1/AnAbstract.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package pkg1;
+public abstract class AnAbstract implements UsedInterface {}
--- a/langtools/test/com/sun/javadoc/testUseOption/pkg1/C10.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testUseOption/pkg1/C10.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,6 +23,8 @@
 
 package pkg1;
 
+import java.util.List;
+
 /**
  * An implementor
  *
@@ -38,4 +40,49 @@
      * Me too
      */
     public void doNothingA() {}
+
+    /**
+     * returns a collection with type param
+     * @return something
+     */
+    public List<? extends UsedClass> foo(){return null;}
+
+    /**
+     * returns and takes type param variants
+     * @param <T> yeah
+     * @return returns a type param
+     */
+    public <T extends UsedInterface<? super T>> UsedInterfaceA<T> withTypeParametersOfType(Class<? extends UsedInterface> c){return null;}
+
+    /**
+     * returns a type param
+     * @param <T> a param
+     * @return something
+     */
+    public <T extends UsedInterface>T[] withReturningTypeParameters(){return null;}
+
+    /**
+     * a return a type parameter, as a static method
+     * @param <T> a type param
+     * @param enumType something
+     * @param name something
+     * @return a trype param
+     */
+    public static <T extends UsedInterface<T>> T withReturnVariant(Class<T> enumType, String name){return null;}
+
+    /**
+     * another variant of a method returning type parameters
+     * @param <T> something
+     * @param listenerInterface something
+     * @param target something
+     * @param action something
+     * @return a type param
+     */
+    public <T> T create(UsedInterfaceA<T> listenerInterface, UsedInterface target, String action){return null;}
+
+    /**
+     * input is an array
+     * @param elements a vararg
+     */
+    public void addAll(UsedInterface... elements) {}
 }
--- a/langtools/test/com/sun/javadoc/testUseOption/pkg1/UsedInterface.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testUseOption/pkg1/UsedInterface.java	Wed Jul 05 19:50:06 2017 +0200
@@ -28,7 +28,7 @@
 
 package pkg1;
 
-public interface UsedInterface {
+public interface UsedInterface<T> {
 
     /**
      * Does nothing
--- a/langtools/test/com/sun/javadoc/testUseOption/pkg1/UsedInterfaceA.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/com/sun/javadoc/testUseOption/pkg1/UsedInterfaceA.java	Wed Jul 05 19:50:06 2017 +0200
@@ -28,7 +28,7 @@
 
 package pkg1;
 
-public interface UsedInterfaceA {
+public interface UsedInterfaceA<T> {
 
     /**
      * Does nothing
--- a/langtools/test/tools/doclint/ValidTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/doclint/ValidTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8004832
+ * @bug 8004832 8048806
  * @summary Add new doclint package
  * @build DocLintTester
  * @run main DocLintTester ValidTest.java
@@ -36,6 +36,38 @@
     void entities() { }
 
     /**
+     * <abbr>abbreviation<abbr>
+     * <acronym>ABC</acronym>
+     * <cite>citation</cite>
+     * <code>code</code>
+     * <dfn>defining instance</dfn>
+     * <em>emphasis</em>
+     * <kbd>keyboard<kbd>
+     * <samp>sample</samp>
+     * <var>variable</var>
+     * <strong>strong</strong>
+     */
+    void phraseElements() { }
+
+    /**
+     * <address>1 Main St., USA</address>
+     */
+    void address() { }
+
+    /**
+     * <del>deleted</del>
+     * <ins>inserted</del>
+     */
+    void docChanges() {}
+
+    /**
+     * <blockquote>
+     * A fine thing.
+     * </blockquote>
+     * <q>A fine thing.</q>
+     */
+
+    /**
      * <h1> ... </h1>
      * <h2> ... </h2>
      * <h3> ... </h3>
--- a/langtools/test/tools/javac/6402516/CheckLocalElements.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/6402516/CheckLocalElements.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -23,19 +23,24 @@
 
 /*
  * @test
- * @bug 6402516
+ * @bug 6402516 8031569
  * @summary need Trees.getScope(TreePath)
  * @build Checker CheckLocalElements
  * @run main CheckLocalElements
  */
 
+import java.io.IOException;
 import java.util.*;
-import com.sun.source.tree.*;
+import java.util.regex.*;
+
 import javax.lang.model.element.*;
 import javax.lang.model.util.*;
 
+import com.sun.source.tree.*;
+import com.sun.source.util.*;
+
 /*
- * Check the local elements of a scope against the contents of string literals.
+ * Check the local elements of a scope against the contents of string literals and top-level comment.
  */
 public class CheckLocalElements extends Checker {
     public static void main(String... args) throws Exception {
@@ -90,6 +95,16 @@
         return true;
     }
 
+    @Override
+    void additionalChecks(Trees trees, CompilationUnitTree topLevel) throws IOException {
+        Matcher m = TOPLEVEL_SCOPE_DEF.matcher(topLevel.getSourceFile().getCharContent(false));
+        if (!m.find())
+            throw new AssertionError("Should have top-level scope def!");
+        check(trees.getScope(new TreePath(topLevel)), m.group(1));
+    }
+    //where:
+        Pattern TOPLEVEL_SCOPE_DEF = Pattern.compile("TOPLEVEL_SCOPE:(.*)");
+
     private String getEnclosingName(Element e) {
         Element encl = e.getEnclosingElement();
         return encl == null ? "" : encl.accept(qualNameVisitor, null);
--- a/langtools/test/tools/javac/6402516/Checker.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/6402516/Checker.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -67,6 +67,7 @@
         for (CompilationUnitTree unit: units) {
             TreePath p = new TreePath(unit);
             s.scan(p, getTrees());
+            additionalChecks(getTrees(), unit);
         }
         task = null;
 
@@ -111,6 +112,9 @@
         throw new IllegalStateException();
     }
 
+    void additionalChecks(Trees trees, CompilationUnitTree topLevel) throws IOException {
+    }
+
     void error(Scope s, String ref, String msg) {
         System.err.println("Error: " + msg);
         System.err.println("Scope: " + (s == null ? null : asList(s.getLocalElements())));
--- a/langtools/test/tools/javac/6402516/TestLocalElements.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/6402516/TestLocalElements.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -23,7 +23,7 @@
 
 import java.util.List;
 import java.io.*;
-
+//TOPLEVEL_SCOPE:List, Test2, Test; java.io.*, java.lang.*
 class Test {
     void m1(int m1_arg) {
         String x = "x, m1_arg, super, this; List, Test2, Test; java.io.*, java.lang.*";
--- a/langtools/test/tools/javac/6889255/T6889255.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/6889255/T6889255.java	Wed Jul 05 19:50:06 2017 +0200
@@ -32,7 +32,7 @@
 import javax.tools.StandardLocation;
 import com.sun.tools.javac.code.Flags;
 import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Scope;
+import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
@@ -43,6 +43,8 @@
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Names;
 
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+
 public class T6889255 {
     boolean testInterfaces = true;
     boolean testSyntheticMethods = true;
@@ -380,11 +382,11 @@
             if ((sym.flags() & Flags.INTERFACE) != 0 && !testInterfaces)
                 continue;
 
-            for (Scope.Entry e = sym.members_field.elems; e != null; e = e.sibling) {
-                System.err.println("Checking member " + e.sym);
-                switch (e.sym.kind) {
+            for (Symbol s : sym.members_field.getSymbols(NON_RECURSIVE)) {
+                System.err.println("Checking member " + s);
+                switch (s.kind) {
                     case Kinds.TYP: {
-                        String name = e.sym.flatName().toString();
+                        String name = s.flatName().toString();
                         if (!classes.contains(name)) {
                             classes.add(name);
                             work.add(name);
@@ -392,7 +394,7 @@
                         break;
                     }
                     case Kinds.MTH:
-                        verify((MethodSymbol) e.sym, expectNames);
+                        verify((MethodSymbol) s, expectNames);
                         break;
                 }
 
--- a/langtools/test/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java	Wed Jul 05 19:50:06 2017 +0200
@@ -45,7 +45,7 @@
      */
     protected void compileAndTest(String sourceCode, String... classesToTest) throws Exception {
 
-        Map<String, ? extends JavaFileObject> classes = compile(sourceCode);
+        Map<String, ? extends JavaFileObject> classes = compile(sourceCode).getClasses();
         String fileName = ToolBox.getJavaFileNameFromSource(sourceCode);
         for (String className : classesToTest) {
             assertAttributePresent(ClassFile.read(classes.get(className).openInputStream()), fileName);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedPackageTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8042261
+ * @summary Checking that deprecated attribute does not apply to classes of deprecated package.
+ * @library /tools/javac/lib ../lib
+ * @build DeprecatedPackageTest TestBase TestResult InMemoryFileManager ToolBox
+ * @run main DeprecatedPackageTest
+ */
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Deprecated_attribute;
+
+public class DeprecatedPackageTest extends TestResult {
+
+    private static final String[] sourceTest = new String[]{
+        "package deprecated;\n"
+        + "public class notDeprecated{}",
+        "package deprecated;\n"
+        + "public interface notDeprecated{}",
+        "package deprecated;\n"
+        + "public @interface notDeprecated{}",
+        "package deprecated;\n"
+        + "public enum notDeprecated{}"
+    };
+
+    private static final String CLASS_NAME = "deprecated.notDeprecated";
+
+    private static final String PACKAGE_INFO =
+            "@Deprecated\n" +
+            "package deprecated;";
+
+    public static void main(String[] args) throws TestFailedException {
+        new DeprecatedPackageTest().test();
+    }
+
+    private void test() throws TestFailedException {
+        try {
+            for (String src : sourceTest) {
+                test(PACKAGE_INFO, src);
+                test(PACKAGE_INFO.replaceAll("@Deprecated", "/** @deprecated */"), src);
+            }
+        } catch (Exception e) {
+            addFailure(e);
+        } finally {
+            checkStatus();
+        }
+    }
+
+    private void test(String package_info, String src) {
+        addTestCase(src);
+        printf("Testing test case: \n%s\n", src);
+        try {
+            ClassFile cf = ClassFile.read(compile(
+                        new String[]{"package-info.java", package_info},
+                        new String[]{"notDeprecated.java", src})
+                    .getClasses().get(CLASS_NAME).openInputStream());
+            Deprecated_attribute attr =
+                    (Deprecated_attribute) cf.getAttribute(Attribute.Deprecated);
+            assertNull(attr, "Class can not have deprecated attribute : " + CLASS_NAME);
+        } catch (Exception e) {
+            addFailure(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/deprecated/DeprecatedTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8042261
+ * @summary Checking what attribute is generated by annotation Deprecated
+ *          or javadoc deprecated for field, method, class(inner/local), interface.
+ * @library /tools/javac/lib ../lib
+ * @build DeprecatedTest TestBase TestResult InMemoryFileManager ToolBox
+ * @run main DeprecatedTest
+ */
+
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.Deprecated_attribute;
+import com.sun.tools.classfile.Field;
+import com.sun.tools.classfile.InnerClasses_attribute;
+import com.sun.tools.classfile.InnerClasses_attribute.Info;
+import com.sun.tools.classfile.Method;
+
+import javax.tools.JavaFileObject;
+import java.io.IOException;
+import java.util.Map;
+
+public class DeprecatedTest extends TestResult {
+
+    private static final String[] sources = new String[]{
+            "@Deprecated public class deprecated {\n"
+            + "@Deprecated class deprecatedInner01 {}\n"
+            + "@Deprecated interface deprecatedInner02 {}\n"
+            + "@Deprecated enum deprecatedInner03 {}\n"
+            + "@Deprecated @interface deprecatedInner04 {}\n"
+            + "class notDeprecatedInner01 {}\n"
+            + "interface notDeprecatedInner02 {}\n"
+            + "enum notDeprecatedInner03 {}\n"
+            + "@interface notDeprecatedInner04 {}\n"
+            + "@Deprecated public void deprecated() {}\n"
+            + "@Deprecated public int deprecated;\n"
+            + "public void notDeprecated() {}\n"
+            + "public int notDeprecated;\n"
+            + "public void f() {\n"
+            + "    @Deprecated class deprecatedLocal {\n"
+            + "        @Deprecated int deprecated;\n"
+            + "        @Deprecated void deprecated() {}\n"
+            + "        int notDeprecated;\n"
+            + "        void notDeprecated(){}\n"
+            + "    }\n"
+            + "    class notDeprecatedLocal {\n"
+            + "        @Deprecated int deprecated;\n"
+            + "        @Deprecated void deprecated() {}\n"
+            + "        int notDeprecated;\n"
+            + "        void notDeprecated(){}\n"
+            + "    }}\n"
+            + "}",
+            "@Deprecated public interface deprecated {\n"
+            + "@Deprecated class deprecatedInner01 {}\n"
+            + "@Deprecated interface deprecatedInner02 {}\n"
+            + "@Deprecated enum deprecatedInner03 {}\n"
+            + "@Deprecated @interface deprecatedInner04 {}\n"
+            + "class notDeprecatedInner01 {}\n"
+            + "interface notDeprecatedInner02 {}\n"
+            + "enum notDeprecatedInner03 {}\n"
+            + "@interface notDeprecatedInner04 {}\n"
+            + "@Deprecated void deprecated01();\n"
+            + "void notDeprecated01();\n"
+            + "@Deprecated default void deprecated02() {}\n"
+            + "default void notDeprecated02() {}\n"
+            + "@Deprecated int deprecated = 0;\n"
+            + "int notDeprecated = 0;\n"
+            + "}",
+            "@Deprecated public enum deprecated {\n"
+            + "@Deprecated deprecated, notDeprecated;\n"
+            + "@Deprecated class deprecatedInner01 {}\n"
+            + "@Deprecated interface deprecatedInner02 {}\n"
+            + "@Deprecated enum deprecatedInner03 {}\n"
+            + "@Deprecated @interface deprecatedInner04 {}\n"
+            + "class notDeprecatedInner01 {}\n"
+            + "interface notDeprecatedInner02 {}\n"
+            + "enum notDeprecatedInner03 {}\n"
+            + "@interface notDeprecatedInner04 {}\n"
+            + "@Deprecated public void deprecated() {}\n"
+            + "public void notDeprecated() {}\n"
+            + "public void f() {\n"
+            + "    @Deprecated class deprecatedLocal {\n"
+            + "        @Deprecated int deprecated;\n"
+            + "        @Deprecated void deprecated() {}\n"
+            + "        int notDeprecated;\n"
+            + "        void notDeprecated(){}\n"
+            + "    }\n"
+            + "    class notDeprecatedLocal {\n"
+            + "        @Deprecated int deprecated;\n"
+            + "        @Deprecated void deprecated() {}\n"
+            + "        int notDeprecated;\n"
+            + "        void notDeprecated(){}\n"
+            + "    }}\n"
+            + "}",
+            "@Deprecated public @interface deprecated {\n"
+            + "@Deprecated class deprecatedInner01 {}\n"
+            + "@Deprecated interface deprecatedInner02 {}\n"
+            + "@Deprecated enum deprecatedInner03 {}\n"
+            + "@Deprecated @interface deprecatedInner04 {}\n"
+            + "class notDeprecatedInner01 {}\n"
+            + "interface notDeprecatedInner02 {}\n"
+            + "enum notDeprecatedInner03 {}\n"
+            + "@interface notDeprecatedInner04 {}\n"
+            + "@Deprecated int deprecated() default 0;\n"
+            + "int notDeprecated() default 0;\n"
+            + "@Deprecated int deprecated = 0;\n"
+            + "int notDeprecated = 0;\n"
+            + "}",
+            "public class notDeprecated {\n"
+            + "@Deprecated class deprecatedInner01 {}\n"
+            + "@Deprecated interface deprecatedInner02 {}\n"
+            + "@Deprecated enum deprecatedInner03 {}\n"
+            + "@Deprecated @interface deprecatedInner04 {}\n"
+            + "class notDeprecatedInner01 {}\n"
+            + "interface notDeprecatedInner02 {}\n"
+            + "enum notDeprecatedInner03 {}\n"
+            + "@interface notDeprecatedInner04 {}\n"
+            + "@Deprecated public void deprecated() {}\n"
+            + "@Deprecated public int deprecated;\n"
+            + "public void notDeprecated() {}\n"
+            + "public int notDeprecated;\n"
+            + "public void f() {\n"
+            + "    @Deprecated class deprecatedLocal {\n"
+            + "        @Deprecated int deprecated;\n"
+            + "        @Deprecated void deprecated() {}\n"
+            + "        int notDeprecated;\n"
+            + "        void notDeprecated(){}\n"
+            + "    }\n"
+            + "    class notDeprecatedLocal {\n"
+            + "        @Deprecated int deprecated;\n"
+            + "        @Deprecated void deprecated() {}\n"
+            + "        int notDeprecated;\n"
+            + "        void notDeprecated(){}\n"
+            + "    }}\n"
+            + "}",
+            "public interface notDeprecated {\n"
+            + "@Deprecated class deprecatedInner01 {}\n"
+            + "@Deprecated interface deprecatedInner02 {}\n"
+            + "@Deprecated enum deprecatedInner03 {}\n"
+            + "@Deprecated @interface deprecatedInner04 {}\n"
+            + "class notDeprecatedInner01 {}\n"
+            + "interface notDeprecatedInner02 {}\n"
+            + "enum notDeprecatedInner03 {}\n"
+            + "@interface notDeprecatedInner04 {}\n"
+            + "@Deprecated void deprecated01();\n"
+            + "void notDeprecated01();\n"
+            + "@Deprecated default void deprecated02() {}\n"
+            + "default void notDeprecated02() {}\n"
+            + "@Deprecated int deprecated = 0;\n"
+            + "int notDeprecated = 0;\n"
+            + "}",
+            "public enum notDeprecated {\n"
+            + "@Deprecated deprecated, notDeprecated;\n"
+            + "@Deprecated class deprecatedInner01 {}\n"
+            + "@Deprecated interface deprecatedInner02 {}\n"
+            + "@Deprecated enum deprecatedInner03 {}\n"
+            + "@Deprecated @interface deprecatedInner04 {}\n"
+            + "class notDeprecatedInner01 {}\n"
+            + "interface notDeprecatedInner02 {}\n"
+            + "enum notDeprecatedInner03 {}\n"
+            + "@interface notDeprecatedInner04 {}\n"
+            + "@Deprecated public void deprecated() {}\n"
+            + "public void notDeprecated() {}\n"
+            + "public void f() {\n"
+            + "    @Deprecated class deprecatedLocal {\n"
+            + "        @Deprecated int deprecated;\n"
+            + "        @Deprecated void deprecated() {}\n"
+            + "        int notDeprecated;\n"
+            + "        void notDeprecated(){}\n"
+            + "    }\n"
+            + "    class notDeprecatedLocal {\n"
+            + "        @Deprecated int deprecated;\n"
+            + "        @Deprecated void deprecated() {}\n"
+            + "        int notDeprecated;\n"
+            + "        void notDeprecated(){}\n"
+            + "    }}\n"
+            + "}",
+            "public @interface notDeprecated {\n"
+            + "@Deprecated class deprecatedInner01 {}\n"
+            + "@Deprecated interface deprecatedInner02 {}\n"
+            + "@Deprecated enum deprecatedInner03 {}\n"
+            + "@Deprecated @interface deprecatedInner04 {}\n"
+            + "class notDeprecatedInner01 {}\n"
+            + "interface notDeprecatedInner02 {}\n"
+            + "enum notDeprecatedInner03 {}\n"
+            + "@interface notDeprecatedInner04 {}\n"
+            + "@Deprecated int deprecated() default 0;\n"
+            + "int notDeprecated() default 0;\n"
+            + "@Deprecated int deprecated = 0;\n"
+            + "int notDeprecated = 0;\n"
+            + "}"};
+
+    public static void main(String[] args) throws TestFailedException {
+        new DeprecatedTest().test();
+    }
+
+    public void test() throws TestFailedException {
+        try {
+            for (String src : sources) {
+                test(src);
+                test(src.replaceAll("@Deprecated", "/** @deprecated */"));
+            }
+        } catch (Exception e) {
+            addFailure(e);
+        } finally {
+            checkStatus();
+        }
+    }
+
+    private void test(String src) {
+        addTestCase(src);
+        printf("Testing test case :\n%s\n", src);
+        try {
+            Map<String, ? extends JavaFileObject> classes = compile(src).getClasses();
+            String outerClassName = classes.containsKey("deprecated")
+                    ? "deprecated"
+                    : "notDeprecated";
+            echo("Testing outer class : " + outerClassName);
+            ClassFile cf = ClassFile.read(classes.get(outerClassName).openInputStream());
+            Deprecated_attribute attr = (Deprecated_attribute)
+                    cf.getAttribute(Attribute.Deprecated);
+            testAttribute(outerClassName, attr, cf);
+            testInnerClasses(cf, classes);
+            testMethods(cf);
+            testFields(cf);
+        } catch (Exception e) {
+            addFailure(e);
+        }
+    }
+
+    private void testInnerClasses(ClassFile cf, Map<String, ? extends JavaFileObject> classes)
+            throws ConstantPoolException, IOException {
+        InnerClasses_attribute innerAttr = (InnerClasses_attribute)
+                cf.getAttribute(Attribute.InnerClasses);
+        for (Info innerClass : innerAttr.classes) {
+            String innerClassName = cf.constant_pool.
+                    getClassInfo(innerClass.inner_class_info_index).getName();
+            echo("Testing inner class : " + innerClassName);
+            ClassFile innerCf = ClassFile.read(classes.get(innerClassName).openInputStream());
+            Deprecated_attribute attr = (Deprecated_attribute)
+                    innerCf.getAttribute(Attribute.Deprecated);
+            String innerClassSimpleName = innerClass.getInnerName(cf.constant_pool);
+            testAttribute(innerClassSimpleName, attr, innerCf);
+            if (innerClassName.contains("Local")) {
+                testMethods(innerCf);
+                testFields(innerCf);
+            }
+        }
+    }
+
+    private void testMethods(ClassFile cf)
+            throws ConstantPoolException {
+        for (Method m : cf.methods) {
+            String methodName = cf.constant_pool.getUTF8Value(m.name_index);
+            echo("Testing method : " + methodName);
+            Deprecated_attribute attr = (Deprecated_attribute)
+                    m.attributes.get(Attribute.Deprecated);
+            testAttribute(methodName, attr, cf);
+        }
+    }
+
+    private void testFields(ClassFile cf) throws ConstantPoolException {
+        for (Field f : cf.fields) {
+            String fieldName = cf.constant_pool.getUTF8Value(f.name_index);
+            echo("Testing field : " + fieldName);
+            Deprecated_attribute attr = (Deprecated_attribute)
+                    f.attributes.get(Attribute.Deprecated);
+            testAttribute(fieldName, attr, cf);
+        }
+    }
+
+    private void testAttribute(String name, Deprecated_attribute attr, ClassFile cf)
+            throws ConstantPoolException {
+        if (name.contains("deprecated")) {
+            testDeprecatedAttribute(name, attr, cf);
+        } else {
+            assertNull(attr, name + " should not have deprecated attribute");
+        }
+    }
+
+    private void testDeprecatedAttribute(String name, Deprecated_attribute attr, ClassFile cf)
+            throws ConstantPoolException {
+        assertNotNull(attr, name + " must have deprecated attribute");
+        assertEquals(0, attr.attribute_length,
+                "attribute_length should equal to 0");
+        assertEquals("Deprecated",
+                cf.constant_pool.getUTF8Value(attr.attribute_name_index),
+                name + " attribute_name_index");
+    }
+}
--- a/langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,47 +23,85 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
+import java.io.PrintStream;
+import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Stream;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.ToolProvider;
+import javax.tools.*;
 
 import static java.lang.String.format;
+import static java.lang.System.lineSeparator;
+import static java.util.Arrays.asList;
 import static java.util.Collections.emptyList;
+import static java.util.stream.Collectors.joining;
 import static java.util.stream.Collectors.toList;
 
 public class TestBase {
 
-    public Map<String, ? extends JavaFileObject> compile(String... sources) throws IOException,
+    public static final String LINE_SEPARATOR = lineSeparator();
+
+    private <S> InMemoryFileManager compile(
+            List<String> options,
+            Function<S, ? extends JavaFileObject> src2JavaFileObject,
+            List<S> sources)
+            throws IOException, CompilationException {
+
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        List<? extends JavaFileObject> src = sources.stream()
+                .map(src2JavaFileObject)
+                .collect(toList());
+
+        DiagnosticCollector<? super JavaFileObject> dc = new DiagnosticCollector<>();
+        try (InMemoryFileManager fileManager
+                     = new InMemoryFileManager(compiler.getStandardFileManager(null, null, null))) {
+            JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, dc, options, null, src);
+            boolean success = task.call();
+            if (!success) {
+                String errorMessage = dc.getDiagnostics().stream()
+                        .map(Object::toString)
+                        .collect(joining("\n"));
+                throw new CompilationException("Compilation Error\n\n" + errorMessage);
+            }
+            return fileManager;
+        }
+    }
+
+    public InMemoryFileManager compile(String... sources)
+            throws IOException, CompilationException {
+        return compile(emptyList(), sources);
+    }
+
+    /**
+     * @param options - compiler options
+     * @param sources
+     * @return map where key is className, value is corresponding ClassFile.
+     * @throws IOException
+     */
+    public InMemoryFileManager compile(List<String> options, String...sources)
+            throws IOException, CompilationException {
+        return compile(options, ToolBox.JavaSource::new, asList(sources));
+    }
+
+    public InMemoryFileManager compile(String[]... sources) throws IOException,
             CompilationException {
         return compile(emptyList(), sources);
     }
 
     /**
      * @param options -  compiler options
-     * @param sources
+     * @param sources - sources[i][0] - name of file, sources[i][1] - sources
      * @return map where key is className, value is corresponding ClassFile.
      * @throws IOException
+     * @throws CompilationException
      */
-    public Map<String, ? extends JavaFileObject> compile(List<String> options, String... sources) throws IOException,
-            CompilationException {
-
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
-        List<? extends JavaFileObject> src = Stream.of(sources).map(ToolBox.JavaSource::new).collect(toList());
-
-        try (InMemoryFileManager fileManager = new InMemoryFileManager(compiler.getStandardFileManager(null, null, null))) {
-            boolean success = compiler.getTask(null, fileManager, null, options, null, src).call();
-            if (!success) throw new CompilationException("Compilation Error");
-            return fileManager.getClasses();
-        }
+    public InMemoryFileManager compile(List<String> options, String[]...sources)
+            throws IOException, CompilationException {
+        return compile(options, src -> new ToolBox.JavaSource(src[0], src[1]), asList(sources));
     }
 
     public void assertEquals(Object actual, Object expected, String message) {
         if (!Objects.equals(actual, expected))
-            throw new AssertionFailedException(format("%s%nGot: %s, Expected: ", message, actual, expected));
+            throw new AssertionFailedException(format("%s%nGot: %s, Expected: %s", message, actual, expected));
     }
 
     public void assertNull(Object actual, String message) {
@@ -80,18 +118,43 @@
         assertEquals(actual, true, message);
     }
 
+    public void assertFalse(boolean actual, String message) {
+        assertEquals(actual, false, message);
+    }
+
+    public File getSourceDir() {
+        return new File(System.getProperty("test.src", "."));
+    }
+
+    public File getClassDir() {
+        return new File(System.getProperty("test.classes", TestBase.class.getResource(".").getPath()));
+    }
+
     public File getSourceFile(String fileName) {
-        return new File(System.getProperty("test.src", "."), fileName);
+        return new File(getSourceDir(), fileName);
     }
 
     public File getClassFile(String fileName) {
-        return new File(System.getProperty("test.classes", TestBase.class.getResource(".").getPath()), fileName);
+        return new File(getClassDir(), fileName);
     }
 
     public File getClassFile(Class clazz) {
         return getClassFile(clazz.getName().replace(".", "/") + ".class");
     }
 
+    public void echo(String message) {
+        System.err.println(message.replace("\n", LINE_SEPARATOR));
+    }
+
+    public void printf(String template, Object...args) {
+        System.err.printf(template, Stream.of(args)
+                .map(Objects::toString)
+                .map(m -> m.replace("\n", LINE_SEPARATOR))
+                .collect(toList())
+                .toArray());
+
+    }
+
     public static class CompilationException extends Exception {
 
         public CompilationException(String message) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/lib/TestResult.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import static java.lang.String.format;
+import static java.util.stream.Collectors.joining;
+
+public class TestResult extends TestBase {
+
+    private final List<Info> testCases;
+
+    public TestResult() {
+        testCases = new ArrayList<>();
+        testCases.add(new Info("Global test info"));
+    }
+
+    public void addTestCase(String src) {
+        testCases.add(new Info(src));
+    }
+
+    public String errorMessage() {
+        return testCases.stream().filter(Info::isFailed)
+                .map(tc -> format("Failure in test case:\n%s\n%s", tc.info(),
+                        (tc.asserts.size() > 0 ? tc.getAssertMessage() + "\n" : "")
+                                + tc.getErrorMessage()))
+                .collect(joining("\n"));
+    }
+
+    @Override
+    public void assertEquals(Object actual, Object expected, String message) {
+        getLastTestCase().assertEquals(actual, expected, message);
+    }
+
+    @Override
+    public void assertNull(Object actual, String message) {
+        getLastTestCase().assertEquals(actual, null, message);
+    }
+
+    @Override
+    public void assertNotNull(Object actual, String message) {
+        getLastTestCase().assertNotNull(actual, message);
+    }
+
+    @Override
+    public void assertFalse(boolean actual, String message) {
+        getLastTestCase().assertEquals(actual, false, message);
+    }
+
+    @Override
+    public void assertTrue(boolean actual, String message) {
+        getLastTestCase().assertEquals(actual, true, message);
+    }
+
+    public void addFailure(Throwable th) {
+        getLastTestCase().addFailure(th);
+    }
+
+    private Info getLastTestCase() {
+        if (testCases.size() == 1) {
+            throw new IllegalStateException("Test case should be created");
+        }
+        return testCases.get(testCases.size() - 1);
+    }
+
+    public void checkStatus() throws TestFailedException {
+        if (testCases.stream().anyMatch(Info::isFailed)) {
+            echo(errorMessage());
+            throw new TestFailedException("Test failed");
+        }
+    }
+
+    private class Info {
+
+        private final String info;
+        private final List<String> asserts;
+        private final List<Throwable> errors;
+
+        private Info(String info) {
+            this.info = info;
+            asserts = new ArrayList<>();
+            errors = new ArrayList<>();
+        }
+
+        public String info() {
+            return info;
+        }
+
+        public boolean isFailed() {
+            return !asserts.isEmpty() || !errors.isEmpty();
+        }
+
+        public void addFailure(Throwable th) {
+            errors.add(th);
+            printf("[ERROR] : %s\n", getStackTrace(th));
+        }
+
+        public void addFailure(String message) {
+            asserts.add(message);
+            printf("[ASSERT] : %s\n", message);
+        }
+
+        public void assertEquals(Object actual, Object expected, String message) {
+            echo("Testing : " + message);
+            if (!Objects.equals(actual, expected)) {
+                addFailure(message + ": Got: " + actual + ", " + "Expected: " + expected);
+            }
+        }
+
+        public void assertNotNull(Object actual, String message) {
+            echo("Testing : " + message);
+            if (actual == null) {
+                addFailure(message + " : Expected not null value");
+            }
+        }
+
+        public String getAssertMessage() {
+            return asserts.stream()
+                    .map(failure -> "[ASSERT] : " + failure)
+                    .collect(joining("\n"));
+        }
+
+        public String getErrorMessage() {
+            return errors.stream()
+                    .map(throwable ->
+                            format("[ERROR] : %s", getStackTrace(throwable)))
+                    .collect(joining("\n"));
+        }
+
+        public String getStackTrace(Throwable throwable) {
+            StringWriter stringWriter = new StringWriter();
+            try (PrintWriter printWriter = new PrintWriter(stringWriter)) {
+                throwable.printStackTrace(printWriter);
+            }
+            return stringWriter.toString();
+        }
+    }
+
+    public static class TestFailedException extends Exception {
+        public TestFailedException(String message) {
+            super(message);
+        }
+    }
+}
--- a/langtools/test/tools/javac/defaultMethods/crossCompile/CrossCompile.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/defaultMethods/crossCompile/CrossCompile.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 7192246
  * @summary check that clinit in interface doesn't cause spurious default method diagnostics
- * @compile -source 1.4 -target 1.4 Clinit.java
+ * @compile Clinit.java
  * @compile CrossCompile.java
  */
 class CrossCompile {
--- a/langtools/test/tools/javac/defaultMethodsVisibility/DefaultMethodsNotVisibleForSourceLessThan8Test.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/defaultMethodsVisibility/DefaultMethodsNotVisibleForSourceLessThan8Test.java	Wed Jul 05 19:50:06 2017 +0200
@@ -101,10 +101,6 @@
 
     public static void main(String[] args) throws Exception {
         String[] sources = new String[] {
-            "1.2",
-            "1.3",
-            "1.4",
-            "1.5",
             "1.6",
             "1.7",
         };
--- a/langtools/test/tools/javac/diags/examples/AnnotationsNotSupported.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.annotations.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-@Deprecated
-class AnnotationsNotSupported { }
--- a/langtools/test/tools/javac/diags/examples/AssertAsIdentifier.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.warn.assert.as.identifier
-// options: -source 1.3 -Xlint:-options
-
-class AssertAsIdentifier {
-    int assert;
-}
--- a/langtools/test/tools/javac/diags/examples/EnumAsIdentifier.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.warn.enum.as.identifier
-// options: -source 1.3 -Xlint:-options
-
-class EnumAsIdentifier {
-    int enum;
-}
--- a/langtools/test/tools/javac/diags/examples/EnumsNotSupported.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.enums.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-enum EnumsNotSupported { A, B, C }
--- a/langtools/test/tools/javac/diags/examples/Expected2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples/Expected2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,12 @@
  */
 
 // key: compiler.err.expected2
-// options: -source 1.4 -Xlint:-options
+// options: -Xlint:-options
+
+class Expected2 {
 
-int Expected2;
+    void m(){
+        new x1;
+
+    }
+}
--- a/langtools/test/tools/javac/diags/examples/ForeachNotSupported.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.foreach.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-class ForeachNotSupported {
-    void m(String[] args) {
-        for (String a: args) {
-            System.out.println(a);
-        }
-    }
-}
--- a/langtools/test/tools/javac/diags/examples/GenericsNotSupported.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.generics.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-class GenericsNotSupported<T> { }
--- a/langtools/test/tools/javac/diags/examples/NeitherConditionalSubtype.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples/NeitherConditionalSubtype.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,10 +22,13 @@
  */
 
 // key: compiler.err.neither.conditional.subtype
-// options: -source 1.4 -Xlint:-options
 
-class X {
-    Object m(boolean b) {
-        return (b ? 3 : b);
+class NeitherConditionalSubtype {
+    public int test(Object o) {
+        // Should fail to compile since Object.wait() has a void return type.
+        System.out.println(o instanceof String ? o.hashCode() : o.wait());
+        return 0;
     }
 }
+
+
--- a/langtools/test/tools/javac/diags/examples/ObsoleteSourceAndTarget.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples/ObsoleteSourceAndTarget.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -25,7 +25,7 @@
 // key: compiler.warn.option.obsolete.target
 // key: compiler.warn.option.obsolete.suppression
 // key: compiler.warn.source.no.bootclasspath
-// options: -source 1.5 -target 1.5
+// options: -source 1.6 -target 1.6
 
 class ObsoleteSourceAndTarget {
     public static void foo() {;}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OptionRemovedSource.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.option.removed.source
+// key: compiler.warn.source.no.bootclasspath
+// options: -source 1.5
+
+class RemovedSourceAndTarget {
+    public static void foo() {;}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/OptionRemovedTarget.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.option.removed.source
+// key: compiler.err.option.removed.target
+// key: compiler.warn.source.no.bootclasspath
+// options: -source 1.5 -target 1.5
+
+class RemovedSourceAndTarget {
+    public static void foo() {;}
+}
--- a/langtools/test/tools/javac/diags/examples/SourceNoBootclasspath.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples/SourceNoBootclasspath.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -22,6 +22,6 @@
  */
 
 // key: compiler.warn.source.no.bootclasspath
-// options: -source 6
+// options: -source 7
 
 class SourceNoBootclasspath { }
--- a/langtools/test/tools/javac/diags/examples/StaticImportNotSupported.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.static.import.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-import static java.util.regex.Pattern.*;
-
-class StaticImportNotSupported { }
--- a/langtools/test/tools/javac/diags/examples/TypeAnnotationsNotSupported.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/diags/examples/TypeAnnotationsNotSupported.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -23,7 +23,7 @@
 
 // key: compiler.err.type.annotations.not.supported.in.source
 // key: compiler.warn.source.no.bootclasspath
-// options: -source 6
+// options: -source 7
 
 @interface Anno { }
 
--- a/langtools/test/tools/javac/diags/examples/UnsupportedFpLit.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.unsupported.fp.lit
-// options: -source 1.4 -Xlint:-options
-
-class UnsupportedFpLit {
-    float f = 0xCafe.BabeP1;
-}
--- a/langtools/test/tools/javac/diags/examples/VarargsNotSupported.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.varargs.not.supported.in.source
-// options: -source 1.4 -Xlint:-options
-
-class VarargsNotSupported {
-    void m(String... args) { }
-}
--- a/langtools/test/tools/javac/enum/AbstractEmptyEnum.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/AbstractEmptyEnum.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5009601
  * @summary empty enum cannot be abstract
  * @author Joseph D. Darcy
  *
- * @compile/fail AbstractEmptyEnum.java
+ * @compile/fail/ref=AbstractEmptyEnum.out -XDrawDiagnostics  AbstractEmptyEnum.java
  */
 
 public enum AbstractEmptyEnum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/AbstractEmptyEnum.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+AbstractEmptyEnum.java:10:8: compiler.err.does.not.override.abstract: AbstractEmptyEnum, m(), AbstractEmptyEnum
+1 error
--- a/langtools/test/tools/javac/enum/Enum2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/Enum2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,8 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @summary enums: an enumeration type may not be extended
  * @author gafter
- *
- * @compile/fail Enum2.java
+ * @compile/fail/ref=Enum2.out -XDrawDiagnostics  Enum2.java
  */
 
 public class Enum2 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/Enum2.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,3 @@
+Enum2.java:10:29: compiler.err.cant.inherit.from.final: Enum2.e1
+Enum2.java:10:12: compiler.err.enum.types.not.extensible
+2 errors
--- a/langtools/test/tools/javac/enum/FauxEnum1.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/FauxEnum1.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5009574
  * @summary verify java.lang.Enum can't be directly subclassed
  * @author Joseph D. Darcy
  *
- * @compile/fail FauxEnum1.java
+ * @compile/fail/ref=FauxEnum1.out -XDrawDiagnostics  FauxEnum1.java
  */
 
 public class FauxEnum1 extends java.lang.Enum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/FauxEnum1.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+FauxEnum1.java:10:8: compiler.err.enum.no.subclassing
+1 error
--- a/langtools/test/tools/javac/enum/FauxEnum3.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/FauxEnum3.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5009574
  * @summary verify an enum type can't be directly subclassed
  * @author Joseph D. Darcy
  *
- * @compile/fail FauxEnum3.java
+ * @compile/fail/ref=FauxEnum3.out -XDrawDiagnostics  FauxEnum3.java
  */
 
 public class FauxEnum3 extends SpecializedEnum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/FauxEnum3.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+FauxEnum3.java:10:8: compiler.err.enum.types.not.extensible
+1 error
--- a/langtools/test/tools/javac/enum/FauxSpecialEnum1.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/FauxSpecialEnum1.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5009601
  * @summary verify specialized enum classes can't be abstract
  * @author Joseph D. Darcy
  *
- * @compile/fail FauxSpecialEnum1.java
+ * @compile/fail/ref=FauxSpecialEnum1.out -XDrawDiagnostics  FauxSpecialEnum1.java
  */
 
 public enum FauxSpecialEnum1 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/FauxSpecialEnum1.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+FauxSpecialEnum1.java:14:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum1$2, test(), compiler.misc.anonymous.class: FauxSpecialEnum1$2
+1 error
--- a/langtools/test/tools/javac/enum/FauxSpecialEnum2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/FauxSpecialEnum2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5009601
  * @summary verify specialized enum classes can't be abstract
  * @author Joseph D. Darcy
  *
- * @compile/fail FauxSpecialEnum2.java
+ * @compile/fail/ref=FauxSpecialEnum2.out -XDrawDiagnostics  FauxSpecialEnum2.java
  */
 
 public enum FauxSpecialEnum2 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/FauxSpecialEnum2.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+FauxSpecialEnum2.java:12:5: compiler.err.does.not.override.abstract: compiler.misc.anonymous.class: FauxSpecialEnum2$1, test(), compiler.misc.anonymous.class: FauxSpecialEnum2$1
+1 error
--- a/langtools/test/tools/javac/enum/LocalEnum.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/LocalEnum.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,9 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5019609
  * @summary javac fails to reject local enums
  * @author gafter
- *
- * @compile/fail LocalEnum.java
+ * @compile/fail/ref=LocalEnum.out -XDrawDiagnostics  LocalEnum.java
  */
 
 public class LocalEnum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/LocalEnum.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+LocalEnum.java:11:9: compiler.err.local.enum
+1 error
--- a/langtools/test/tools/javac/enum/NestedEnum.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/NestedEnum.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5071831
  * @summary javac allows enum in an inner class
  * @author gafter
  *
- * @compile/fail NestedEnum.java
+ * @compile/fail/ref=NestedEnum.out -XDrawDiagnostics  NestedEnum.java
  */
 
 class NestedEnum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/NestedEnum.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NestedEnum.java:12:9: compiler.err.enums.must.be.static
+1 error
--- a/langtools/test/tools/javac/enum/NoFinal.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/NoFinal.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail NoFinal.java
+ * @compile/fail/ref=NoFinal.out -XDrawDiagnostics  NoFinal.java
  */
 
 enum NoFinal {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/NoFinal.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NoFinal.java:11:24: compiler.err.enum.no.finalize
+1 error
--- a/langtools/test/tools/javac/enum/NoFinal2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/NoFinal2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail NoFinal2.java
+ * @compile/fail/ref=NoFinal2.out -XDrawDiagnostics  NoFinal2.java
  */
 
 enum NoFinal2 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/NoFinal2.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NoFinal2.java:11:20: compiler.err.enum.no.finalize
+1 error
--- a/langtools/test/tools/javac/enum/NoFinal3.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/NoFinal3.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail NoFinal3.java
+ * @compile/fail/ref=NoFinal3.out -XDrawDiagnostics  NoFinal3.java
  */
 
 enum NoFinal3 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/NoFinal3.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NoFinal3.java:11:17: compiler.err.enum.no.finalize
+1 error
--- a/langtools/test/tools/javac/enum/NoFinal4.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/NoFinal4.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail NoFinal4.java
+ * @compile/fail/ref=NoFinal4.out -XDrawDiagnostics  NoFinal4.java
  */
 
 enum NoFinal4 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/NoFinal4.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NoFinal4.java:11:18: compiler.err.enum.no.finalize
+1 error
--- a/langtools/test/tools/javac/enum/NoFinal5.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/NoFinal5.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 5097250 5087624
  * @summary Finalize methods on enums must be compile time error
  * @author Peter von der Ah\u00e9
- * @compile/fail NoFinal5.java
+ * @compile/fail/ref=NoFinal5.out -XDrawDiagnostics  NoFinal5.java
  */
 
 enum NoFinal5 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/NoFinal5.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NoFinal5.java:11:10: compiler.err.enum.no.finalize
+1 error
--- a/langtools/test/tools/javac/enum/T5081785.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/T5081785.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,43 +1,31 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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 /nodynamiccopyright/
+ * @bug 5081785
+ * @summary Empty Enums allowed in non-static contexts
+ * @author Peter von der Ah\u00e9
+ * @compile/fail/ref=T5081785.out -XDrawDiagnostics  T5081785.java
  */
 
-/*
- * @test
- * @bug 5081785
- *
- * @summary Empty Enums allowed in non-static contexts
- * @author Peter von der Ah\u00e9
- *
- * @compile/fail T5081785.java
- * @compile/fail T5081785a.java
- * @compile/fail T5081785b.java
- * @compile/fail T5081785c.java
- */
-
-class A {
+class A1 {
     public void check() {
         class Foo {
             enum STRENGTH{};
         };
     }
 }
+
+class A2 {
+    public A2 check() {
+        return new A2() { enum STRENGTH{}; };
+    }
+}
+
+class A3 {
+    Object o = new Object() { enum STRENGTH{}; };
+}
+
+class A4 {
+    class B {
+        enum C { X, Y, Z }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/T5081785.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,5 @@
+T5081785.java:29:9: compiler.err.enums.must.be.static
+T5081785.java:12:13: compiler.err.enums.must.be.static
+T5081785.java:19:27: compiler.err.enums.must.be.static
+T5081785.java:24:31: compiler.err.enums.must.be.static
+4 errors
--- a/langtools/test/tools/javac/enum/T5081785a.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-class A {
-    public A check() {
-        return new A() { enum STRENGTH{}; };
-    }
-}
--- a/langtools/test/tools/javac/enum/T5081785b.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-class A {
-    Object o = new Object() { enum STRENGTH{}; };
-}
--- a/langtools/test/tools/javac/enum/T5081785c.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-class A {
-    class B {
-        enum C { X, Y, Z }
-    }
-}
--- a/langtools/test/tools/javac/enum/forwardRef/TestEnum1.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum1.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test    /nodynamiccopyright/
  * @bug     6209839
  * @summary Illegal forward reference to enum constants allowed by javac
  * @author  Peter von der Ah\u00e9
- * @compile/fail TestEnum1.java
+ * @compile/fail/ref=TestEnum1.out -XDrawDiagnostics  TestEnum1.java
  */
 
 enum TestEnum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum1.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,3 @@
+TestEnum1.java:11:39: compiler.err.illegal.enum.static.ref
+TestEnum1.java:12:40: compiler.err.illegal.enum.static.ref
+2 errors
--- a/langtools/test/tools/javac/enum/forwardRef/TestEnum2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test    /nodynamiccopyright/
  * @bug     6209839
  * @summary Illegal forward reference to enum constants allowed by javac
  * @author  Peter von der Ah\u00e9
- * @compile/fail TestEnum2.java
+ * @compile/fail/ref=TestEnum2.out -XDrawDiagnostics  TestEnum2.java
  */
 
 enum TestEnum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum2.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,3 @@
+TestEnum2.java:13:36: compiler.err.illegal.enum.static.ref
+TestEnum2.java:14:36: compiler.err.illegal.enum.static.ref
+2 errors
--- a/langtools/test/tools/javac/enum/forwardRef/TestEnum3.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum3.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test    /nodynamiccopyright/
  * @bug     6209839
  * @summary Illegal forward reference to enum constants allowed by javac
  * @author  Peter von der Ah\u00e9
- * @compile/fail TestEnum3.java
+ * @compile/fail/ref=TestEnum3.out -XDrawDiagnostics  TestEnum3.java
  */
 
 enum TestEnum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum3.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+TestEnum3.java:13:34: compiler.err.illegal.enum.static.ref
+1 error
--- a/langtools/test/tools/javac/enum/forwardRef/TestEnum4.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum4.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test    /nodynamiccopyright/
  * @bug     6209839
  * @summary Illegal forward reference to enum constants allowed by javac
  * @author  Peter von der Ah\u00e9
- * @compile/fail TestEnum4.java
+ * @compile/fail/ref=TestEnum4.out -XDrawDiagnostics  TestEnum4.java
  */
 
 enum TestEnum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum4.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+TestEnum4.java:14:24: compiler.err.illegal.enum.static.ref
+1 error
--- a/langtools/test/tools/javac/enum/forwardRef/TestEnum5.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum5.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test    /nodynamiccopyright/
  * @bug     6209839
  * @summary Illegal forward reference to enum constants allowed by javac
  * @author  Peter von der Ah\u00e9
- * @compile/fail TestEnum5.java
+ * @compile/fail/ref=TestEnum5.out -XDrawDiagnostics  TestEnum5.java
  */
 
 enum TestEnum {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum5.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+TestEnum5.java:15:20: compiler.err.illegal.enum.static.ref
+1 error
--- a/langtools/test/tools/javac/enum/forwardRef/TestEnum6.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum6.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test    /nodynamiccopyright/
  * @bug     6424491
  * @summary Cannot initialise nested enums
  * @author  Peter von der Ah\u00e9
- * @compile/fail TestEnum6.java
+ * @compile/fail/ref=TestEnum6.out -XDrawDiagnostics  TestEnum6.java
  */
 
 public enum TestEnum6 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/enum/forwardRef/TestEnum6.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+TestEnum6.java:10:18: compiler.err.illegal.self.ref
+1 error
--- a/langtools/test/tools/javac/expression/_super/NonDirectSuper/Base.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 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.
- */
-
-package base;
-
-public class Base extends PackagePrivate { }
-
-class PackagePrivate {
-    protected int refTobaseBase() {
-        return 0;
-    }
-    protected int refTotestOtherPackageTest() {
-        return 0;
-    }
-    protected int refTotestTarget11() {
-        return 0;
-    }
-    protected int refTotestCurPackagePrivateExt11() {
-        return 0;
-    }
-    protected int refTobaseBase;
-    protected int refTotestOtherPackageTest;
-    protected int refTotestTarget11;
-    protected int refTotestCurPackagePrivateExt11;
-}
--- a/langtools/test/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 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.
- */
-
-/*
- * @test
- * @bug 8027789
- * @summary check that the direct superclass is used as the site when calling
- *          a superclass' method
- * @compile Base.java NonDirectSuper.java
- * @compile -source 1.2 -target 1.1 Target11.java
- * @run main test.NonDirectSuper
- */
-
-package test;
-
-import java.io.File;
-
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.Code_attribute;
-import com.sun.tools.classfile.ConstantPool.CPRefInfo;
-import com.sun.tools.classfile.Instruction;
-import com.sun.tools.classfile.Method;
-import com.sun.tools.classfile.Opcode;
-
-public class NonDirectSuper {
-    public static void main(String... args) {
-        new NonDirectSuper().run();
-    }
-
-    void run() {
-        String workDir = System.getProperty("test.classes");
-        File testPackage = new File(workDir, "test");
-
-        for (File clazz : testPackage.listFiles()) {
-            if ("NonDirectSuper.class".equals(clazz.getName())) continue;
-            verifyInvokeSpecialRefToObject(clazz);
-        }
-    }
-
-    void verifyInvokeSpecialRefToObject(File clazz) {
-        try {
-            final ClassFile cf = ClassFile.read(clazz);
-            for (Method m : cf.methods) {
-                Code_attribute codeAttr = (Code_attribute)m.attributes.get(Attribute.Code);
-                for (Instruction instr : codeAttr.getInstructions()) {
-                    if (instr.getOpcode() == Opcode.INVOKESPECIAL ||
-                        instr.getOpcode() == Opcode.INVOKEVIRTUAL) {
-                        int pc_index = instr.getShort(1);
-                        CPRefInfo ref = (CPRefInfo)cf.constant_pool.get(pc_index);
-                        String className = ref.getClassName();
-                        String methodName = ref.getNameAndTypeInfo().getName();
-                        if (methodName.equals("toString")) {
-                            if (!className.equals("java/lang/Object"))
-                                throw new IllegalStateException("Must directly refer to j.l.Object");
-                        } else if (methodName.startsWith("refTo")) {
-                            String expectedClass = methodName.substring("refTo".length());
-                            if (!className.replace("/", "").equals(expectedClass)) {
-                                throw new IllegalStateException("Unexpected reference to: " +
-                                        className + ", should be " + expectedClass);
-                            }
-                        }
-                    }
-                    if (instr.getOpcode() == Opcode.GETFIELD ||
-                        instr.getOpcode() == Opcode.PUTFIELD) {
-                        int pc_index = instr.getShort(1);
-                        CPRefInfo ref = (CPRefInfo)cf.constant_pool.get(pc_index);
-                        String className = ref.getClassName();
-                        String fieldName = ref.getNameAndTypeInfo().getName();
-                        if (fieldName.startsWith("refTo")) {
-                            String expectedClass = fieldName.substring("refTo".length());
-                            if (!className.replace("/", "").equals(expectedClass)) {
-                                throw new IllegalStateException("Unexpected reference to: " +
-                                        className + ", should be " + expectedClass);
-                            }
-                        }
-                    }
-                }
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            throw new Error("error reading " + clazz +": " + e);
-        }
-    }
-}
-
-class OtherPackageTest extends base.Base {
-    void run() {
-        new Runnable() {
-            public void run() {
-                OtherPackageTest.super.refTobaseBase();
-                OtherPackageTest.super.refTobaseBase = OtherPackageTest.super.refTobaseBase + 1;
-                OtherPackageTest.super.toString();
-                refTotestOtherPackageTest();
-                refTotestOtherPackageTest = refTotestOtherPackageTest + 1;
-                OtherPackageTest.this.refTotestOtherPackageTest();
-                OtherPackageTest.this.refTotestOtherPackageTest =
-                        OtherPackageTest.this.refTotestOtherPackageTest + 1;
-            }
-        }.run();
-        super.refTobaseBase();
-        super.refTobaseBase = super.refTobaseBase + 1;
-        super.toString();
-        OtherPackageTest.super.refTobaseBase();
-        OtherPackageTest.super.refTobaseBase = OtherPackageTest.super.refTobaseBase + 1;
-        OtherPackageTest.super.toString();
-        refTotestOtherPackageTest();
-        refTotestOtherPackageTest = refTotestOtherPackageTest + 1;
-    }
-
-    static class InnerBase {
-        private void refTotestOtherPackageTest$InnerBase() { }
-    }
-    static class InnerTest extends InnerBase {
-        void run() {
-            new Runnable() {
-                public void run() {
-                    InnerTest.super.refTotestOtherPackageTest$InnerBase();
-                }
-            }.run();
-            super.refTotestOtherPackageTest$InnerBase();
-            InnerTest.super.refTotestOtherPackageTest$InnerBase();
-        }
-    }
-}
-
-class CurPackagePrivateBase {
-    void refTotestCurPackagePrivateExt() { }
-    void refTotestCurPackagePrivateTest() { }
-    int refTotestCurPackagePrivateExt;
-    int refTotestCurPackagePrivateTest;
-}
-
-class CurPackagePrivateExt extends CurPackagePrivateBase {
-}
-
-class CurPackagePrivateTest extends CurPackagePrivateExt {
-    void run() {
-        new Runnable() {
-            public void run() {
-                CurPackagePrivateTest.super.refTotestCurPackagePrivateExt();
-                CurPackagePrivateTest.super.refTotestCurPackagePrivateExt =
-                        CurPackagePrivateTest.super.refTotestCurPackagePrivateExt + 1;
-                CurPackagePrivateTest.this.refTotestCurPackagePrivateTest();
-                CurPackagePrivateTest.this.refTotestCurPackagePrivateTest =
-                        CurPackagePrivateTest.this.refTotestCurPackagePrivateTest + 1;
-                refTotestCurPackagePrivateTest();
-                refTotestCurPackagePrivateTest = refTotestCurPackagePrivateTest + 1;
-            }
-        }.run();
-        super.refTotestCurPackagePrivateExt();
-        super.refTotestCurPackagePrivateExt = super.refTotestCurPackagePrivateExt + 1;
-        CurPackagePrivateTest.super.refTotestCurPackagePrivateExt();
-        CurPackagePrivateTest.super.refTotestCurPackagePrivateExt =
-                CurPackagePrivateTest.super.refTotestCurPackagePrivateExt + 1;
-        refTotestCurPackagePrivateTest();
-        refTotestCurPackagePrivateTest = refTotestCurPackagePrivateTest + 1;
-    }
-}
--- a/langtools/test/tools/javac/expression/_super/NonDirectSuper/Target11.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 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.
- */
-
-package test;
-
-class Target11 extends CurPackagePrivateExt11 {
-    void run() {
-        new Runnable() {
-            public void run() {
-                Target11.super.refTotestCurPackagePrivateBase11();
-                Target11.super.refTotestCurPackagePrivateBase11 =
-                        Target11.super.refTotestCurPackagePrivateBase11 + 1;
-                Target11.super.refTotestCurPackagePrivateExt11();
-                Target11.super.refTotestCurPackagePrivateExt11 =
-                        Target11.super.refTotestCurPackagePrivateExt11 + 1;
-                Target11.super.toString();
-                refTotestCurPackagePrivateBase11();
-                refTotestCurPackagePrivateBase11 =
-                        refTotestCurPackagePrivateBase11 + 1;
-                refTotestTarget11();
-                refTotestTarget11 = refTotestTarget11 + 1;
-                Target11.this.refTotestCurPackagePrivateBase11();
-                Target11.this.refTotestCurPackagePrivateBase11 =
-                        Target11.this.refTotestCurPackagePrivateBase11 + 1;
-                Target11.this.refTotestTarget11();
-                Target11.this.refTotestTarget11 =
-                        Target11.this.refTotestTarget11 + 1;
-            }
-        }.run();
-        super.refTotestCurPackagePrivateBase11();
-        super.refTotestCurPackagePrivateBase11 =
-                super.refTotestCurPackagePrivateBase11 + 1;
-        super.refTotestCurPackagePrivateExt11();
-        super.refTotestCurPackagePrivateExt11 =
-                super.refTotestCurPackagePrivateExt11 + 1;
-        super.toString();
-
-        Target11.super.refTotestCurPackagePrivateBase11();
-        Target11.super.refTotestCurPackagePrivateBase11 =
-                Target11.super.refTotestCurPackagePrivateBase11 + 1;
-        Target11.super.refTotestCurPackagePrivateExt11();
-        Target11.super.refTotestCurPackagePrivateExt11 =
-                Target11.super.refTotestCurPackagePrivateExt11 + 1;
-
-        refTotestCurPackagePrivateBase11();
-        refTotestCurPackagePrivateBase11 = refTotestCurPackagePrivateBase11 + 1;
-        refTotestTarget11 = refTotestTarget11 + 1;
-    }
-}
-
-class CurPackagePrivateBase11 extends base.Base {
-    protected void refTotestCurPackagePrivateBase11() {}
-    protected int refTotestCurPackagePrivateBase11;
-}
-
-class CurPackagePrivateExt11 extends CurPackagePrivateBase11 { }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/generics/inference/8043926/T8043926.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8043926
+ * @summary javac, code valid in 7 is not compiling for 8
+ * @compile T8043926.java
+ */
+class T8043926 {
+    interface Iface<T1> {}
+
+    static class Impl implements Iface<Impl> {}
+
+    static class Acceptor<T2 extends Iface<T2>> {
+        public Acceptor(T2 obj) {}
+    }
+
+    void test(Impl impl) {
+        Acceptor<?> acceptor1 = new Acceptor<>(impl);
+        Acceptor<? extends Object> acceptor2 = new Acceptor<>(impl);
+    }
+}
--- a/langtools/test/tools/javac/implicitThis/NewBeforeOuterConstructed.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/implicitThis/NewBeforeOuterConstructed.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 4249111
  * @summary 'new' of inner class should not be allowed unless outer is constructed
  *
- * @compile/fail NewBeforeOuterConstructed.java
+ * @compile/fail/ref=NewBeforeOuterConstructed.out -XDrawDiagnostics  NewBeforeOuterConstructed.java
  */
 
 import java.io.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/implicitThis/NewBeforeOuterConstructed.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NewBeforeOuterConstructed.java:27:21: compiler.err.cant.ref.before.ctor.called: this
+1 error
--- a/langtools/test/tools/javac/implicitThis/NewBeforeOuterConstructed2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/implicitThis/NewBeforeOuterConstructed2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,32 +1,9 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 4689058
  * @summary unverifiable code for implicit outer in super constructor call
  *
- * @compile/fail NewBeforeOuterConstructed2.java
+ * @compile/fail/ref=NewBeforeOuterConstructed2.out -XDrawDiagnostics  NewBeforeOuterConstructed2.java
  */
 
 public class NewBeforeOuterConstructed2 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/implicitThis/NewBeforeOuterConstructed2.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NewBeforeOuterConstructed2.java:20:35: compiler.err.cant.ref.before.ctor.called: this
+1 error
--- a/langtools/test/tools/javac/importChecks/ImportCanonical1.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/importChecks/ImportCanonical1.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 4462745
  * @summary compiler permits to import class given by its non-canonical name
  * @author gafter
  *
- * @compile/fail ImportCanonical1.java ImportCanonical2.java
+ * @compile/fail/ref=ImportCanonical1.out -XDrawDiagnostics  ImportCanonical1.java ImportCanonical2.java
  */
 
 package p1;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/importChecks/ImportCanonical1.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+ImportCanonical2.java:25:13: compiler.err.import.requires.canonical: p1.A1.I
+1 error
--- a/langtools/test/tools/javac/importChecks/ImportIsFullyQualified.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/importChecks/ImportIsFullyQualified.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 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.
- *
- * 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
+ * @test /nodynamiccopyright/
  * @bug 4335264
  * @summary Verify that import-on-demand must be fully qualified.
  * @author maddox
  *
- * @compile/fail ImportIsFullyQualified.java
+ * @compile/fail/ref=ImportIsFullyQualified.out -XDrawDiagnostics  ImportIsFullyQualified.java
  */
 
 import java.awt.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/importChecks/ImportIsFullyQualified.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+ImportIsFullyQualified.java:11:1: compiler.err.doesnt.exist: JobAttributes
+1 error
--- a/langtools/test/tools/javac/importChecks/InvalidImportsNoClasses.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/importChecks/InvalidImportsNoClasses.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 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.
- *
- * 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
+ * @test /nodynamiccopyright/
  * @bug 4312063
  * @summary Verify that nonexistent imports detected when no classes declared in compilation unit.
  * @author maddox
  *
- * @compile/fail InvalidImportsNoClasses.java
+ * @compile/fail/ref=InvalidImportsNoClasses.out -XDrawDiagnostics  InvalidImportsNoClasses.java
  */
 
 import nonexistent.pack.cls;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/importChecks/InvalidImportsNoClasses.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+InvalidImportsNoClasses.java:10:24: compiler.err.doesnt.exist: nonexistent.pack
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/importOnDemand/ImportOnDemandConflicts.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,3 @@
+/* @test /nodynamiccopyright/
+ * @compile/fail/ref=ImportOnDemandConflicts.out -XDrawDiagnostics p1/Object.java p1/String.java p2/Boolean.java
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/importOnDemand/ImportOnDemandConflicts.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+String.java:13:9: compiler.err.ref.ambiguous: Boolean, kindname.class, p2.Boolean, p2, kindname.class, java.lang.Boolean, java.lang
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/importOnDemand/p1/Object.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,5 @@
+package p1;
+
+public class Object {
+    public static void test() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/importOnDemand/p1/String.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,15 @@
+package p1;
+
+import p2.*;
+
+public class String {
+    public static void test() { }
+}
+
+class Test1 {
+    private void test() {
+        String.test();
+        Object.test();
+        Boolean.valueOf(true);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/importOnDemand/p2/Boolean.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,7 @@
+package p2;
+
+public class Boolean {
+    public static Boolean valueOf(boolean b) {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/T8033483/IgnoreLambdaBodyDuringResolutionTest1.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,31 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8033483
+ * @summary Should ignore nested lambda bodies during overload resolution
+ * @compile/fail/ref=IgnoreLambdaBodyDuringResolutionTest1.out -XDrawDiagnostics IgnoreLambdaBodyDuringResolutionTest1.java
+ */
+
+class IgnoreLambdaBodyDuringResolutionTest1 {
+    interface SAM<T> {
+        T action(T t);
+    }
+
+    <T> T m(SAM<T> op) {
+        return null;
+    }
+
+    class B {
+        B x() {
+            return this;
+        }
+    }
+
+    class C {}
+
+    void foo(B arg) {}
+    void foo(C arg) {}
+
+    void bar() {
+        foo(m(arg -> new B()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/T8033483/IgnoreLambdaBodyDuringResolutionTest1.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+IgnoreLambdaBodyDuringResolutionTest1.java:29:9: compiler.err.ref.ambiguous: foo, kindname.method, foo(IgnoreLambdaBodyDuringResolutionTest1.B), IgnoreLambdaBodyDuringResolutionTest1, kindname.method, foo(IgnoreLambdaBodyDuringResolutionTest1.C), IgnoreLambdaBodyDuringResolutionTest1
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/T8033483/IgnoreLambdaBodyDuringResolutionTest2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,34 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8033483
+ * @summary Should ignore nested lambda bodies during overload resolution
+ * @compile/fail/ref=IgnoreLambdaBodyDuringResolutionTest2.out -XDrawDiagnostics IgnoreLambdaBodyDuringResolutionTest2.java
+ */
+
+class IgnoreLambdaBodyDuringResolutionTest2 {
+    interface SAM<S> {
+        boolean test(S t);
+    }
+
+    <I, T extends I> I bar(final T l) {
+        return null;
+    }
+
+    class D<D1, D2> {
+        void foo() {
+            m(bar(e -> false));
+        }
+
+        void m(Class<D1> arg) {}
+        void m(SAM<D2> arg) {}
+    }
+
+    class F {
+        void foo() {
+            m(bar((String e) -> false));
+        }
+
+        <F1> void m(Class<F1> arg) {}
+        <F2> void m(SAM<F2> arg) {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/T8033483/IgnoreLambdaBodyDuringResolutionTest2.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,6 @@
+IgnoreLambdaBodyDuringResolutionTest2.java:19:13: compiler.err.ref.ambiguous: m, kindname.method, m(java.lang.Class<D1>), IgnoreLambdaBodyDuringResolutionTest2.D, kindname.method, m(IgnoreLambdaBodyDuringResolutionTest2.SAM<D2>), IgnoreLambdaBodyDuringResolutionTest2.D
+IgnoreLambdaBodyDuringResolutionTest2.java:19:18: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: I,T, (compiler.misc.not.a.functional.intf: java.lang.Object))
+IgnoreLambdaBodyDuringResolutionTest2.java:19:14: compiler.err.cant.apply.symbol: kindname.method, m, java.lang.Class<D1>, <any>, kindname.class, IgnoreLambdaBodyDuringResolutionTest2.D<D1,D2>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.assignment.exists: I,T, (compiler.misc.not.a.functional.intf: java.lang.Class)))
+IgnoreLambdaBodyDuringResolutionTest2.java:28:13: compiler.err.ref.ambiguous: m, kindname.method, <F1>m(java.lang.Class<F1>), IgnoreLambdaBodyDuringResolutionTest2.F, kindname.method, <F2>m(IgnoreLambdaBodyDuringResolutionTest2.SAM<F2>), IgnoreLambdaBodyDuringResolutionTest2.F
+IgnoreLambdaBodyDuringResolutionTest2.java:28:14: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: I,T, (compiler.misc.not.a.functional.intf: java.lang.Class))
+5 errors
--- a/langtools/test/tools/javac/lib/DPrinter.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/lib/DPrinter.java	Wed Jul 05 19:50:06 2017 +0200
@@ -31,6 +31,7 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -337,6 +338,8 @@
             printList(label, (List) item);
         } else if (item instanceof Name) {
             printName(label, (Name) item);
+        } else if (item instanceof Scope) {
+            printScope(label, (Scope) item);
         } else {
             printString(label, String.valueOf(item));
         }
@@ -356,7 +359,7 @@
                     out.print(label);
                     out.print(": [");
                     String sep = "";
-                    for (Symbol sym: scope.getElements()) {
+                    for (Symbol sym: scope.getSymbols()) {
                         out.print(sep);
                         out.print(sym.name);
                         sep = ",";
@@ -370,19 +373,7 @@
                     out.println(label);
 
                     indent(+1);
-                    printImplClass(scope, Scope.class);
-                    printSymbol("owner", scope.owner, Details.SUMMARY);
-                    printScope("next", scope.next, Details.SUMMARY);
-                    printObject("shared", getField(scope, Scope.class, "shared"), Details.SUMMARY);
-                    if (scope instanceof CompoundScope) {
-                        printObject("subScopes",
-                                getField(scope, CompoundScope.class, "subScopes"),
-                                Details.FULL);
-                    } else {
-                        for (Symbol sym : scope.getElements()) {
-                            printSymbol(sym.name.toString(), sym, Details.SUMMARY);
-                        }
-                    }
+                    printFullScopeImpl(scope);
                     indent(-1);
                     break;
                 }
@@ -390,6 +381,72 @@
         }
     }
 
+    void printFullScopeImpl(Scope scope) {
+        indent();
+        out.println(scope.getClass().getName());
+        printSymbol("owner", scope.owner, Details.SUMMARY);
+        if (SCOPE_IMPL_CLASS.equals(scope.getClass().getName())) {
+            printScope("next", (Scope) getField(scope, scope.getClass(), "next"), Details.SUMMARY);
+            printObject("shared", getField(scope, scope.getClass(), "shared"), Details.SUMMARY);
+            Object[] table = (Object[]) getField(scope, scope.getClass(), "table");
+            for (int i = 0; i < table.length; i++) {
+                if (i > 0)
+                    out.print(", ");
+                else
+                    indent();
+                out.print(i + ":" + entryToString(table[i], table, false));
+            }
+            out.println();
+        } else if (FILTER_SCOPE_CLASS.equals(scope.getClass().getName())) {
+            printScope("delegate",
+                    (Scope) getField(scope, scope.getClass(), "delegate"), Details.FULL);
+        } else if (scope instanceof CompoundScope) {
+            printList("delegates", (List<?>) getField(scope, CompoundScope.class, "subScopes"));
+        } else {
+            for (Symbol sym : scope.getSymbols()) {
+                printSymbol(sym.name.toString(), sym, Details.SUMMARY);
+            }
+        }
+    }
+        //where:
+        static final String SCOPE_IMPL_CLASS = "com.sun.tools.javac.code.Scope$ScopeImpl";
+        static final String FILTER_SCOPE_CLASS = "com.sun.tools.javac.code.Scope$FilterImportScope";
+
+    /**
+     * Create a string showing the contents of an entry, using the table
+     * to help identify cross-references to other entries in the table.
+     * @param e the entry to be shown
+     * @param table the table containing the other entries
+     */
+    String entryToString(Object e, Object[] table, boolean ref) {
+        if (e == null)
+            return "null";
+        Symbol sym = (Symbol) getField(e, e.getClass(), "sym");
+        if (sym == null)
+            return "sent"; // sentinel
+        if (ref) {
+            int index = indexOf(table, e);
+            if (index != -1)
+                return String.valueOf(index);
+        }
+        Scope scope = (Scope) getField(e, e.getClass(), "scope");
+        return "(" + sym.name + ":" + sym
+                + ",shdw:" + entryToString(callMethod(e, e.getClass(), "next"), table, true)
+                + ",sibl:" + entryToString(getField(e, e.getClass(), "sibling"), table, true)
+                + ((sym.owner != scope.owner)
+                    ? (",BOGUS[" + sym.owner + "," + scope.owner + "]")
+                    : "")
+                + ")";
+    }
+
+    <T> int indexOf(T[] array, T item) {
+        for (int i = 0; i < array.length; i++) {
+            if (array[i] == item)
+                return i;
+        }
+        return -1;
+    }
+
     public void printSource(String label, JCTree tree) {
         printString(label, Pretty.toSimpleString(tree, maxSrcLength));
     }
@@ -552,6 +609,23 @@
         }
     }
 
+    protected Object callMethod(Object o, Class<?> clazz, String name) {
+        try {
+            Method m = clazz.getDeclaredMethod(name);
+            boolean prev = m.isAccessible();
+            m.setAccessible(true);
+            try {
+                return m.invoke(o);
+            } finally {
+                m.setAccessible(prev);
+            }
+        } catch (ReflectiveOperationException e) {
+            return e;
+        } catch (SecurityException e) {
+            return e;
+        }
+    }
+
     // </editor-fold>
 
     // <editor-fold defaultstate="collapsed" desc="JCTree visitor methods">
--- a/langtools/test/tools/javac/miranda/6964669/T6964669.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6964669
- * @summary javac reports error on miranda methods
- * @compile -source 1.2 -target 1.1 pkg/A.java pkg/B.java pkg/C.java
- */
--- a/langtools/test/tools/javac/miranda/6964669/pkg/A.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 pkg;
-
-public abstract class A implements C {}
--- a/langtools/test/tools/javac/miranda/6964669/pkg/B.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 pkg;
-
-public class B extends A {
-    public void a() {}
-}
--- a/langtools/test/tools/javac/miranda/6964669/pkg/C.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 pkg;
-
-public interface C {
-    public void a();
-}
--- a/langtools/test/tools/javac/mixedTarget/CompatibleAbstracts1.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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 5009712
- * @summary 1.4 javac should not accept the Covariant Return Type
- * @author gafter
- *
- * @compile                  CompatibleAbstracts1.java
- * @compile                  CompatibleAbstracts2.java
- * @compile      -source 1.4 CompatibleAbstracts2.java
- * @compile                  CompatibleAbstracts3.java
- * @compile/fail -source 1.4 CompatibleAbstracts3.java
- * @compile                  CompatibleAbstracts4.java
- * @compile/fail -source 1.4 CompatibleAbstracts4.java
- * @compile                  CompatibleAbstracts5.java
- * @compile/fail -source 1.4 CompatibleAbstracts5.java
- */
-
-interface A {
-    A f();
-}
-
-interface B extends A {
-    B f();
-}
-
-interface C {
-    B f();
-}
-
-interface D {
-    D f();
-}
--- a/langtools/test/tools/javac/mixedTarget/CompatibleAbstracts2.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * 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.
- */
-
-abstract class CompatibleAbstracts2
-    implements A, B // OK, as interfaces A and B are already related
-{
-    void f(A a, B b) {
-        if (a == b) ;
-        B b2 = (B) a;
-        A a2 = (A) b;
-    }
-}
--- a/langtools/test/tools/javac/mixedTarget/ExtendCovariant1.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/mixedTarget/ExtendCovariant1.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -24,10 +24,10 @@
 /*
  * @test
  * @bug 5009712
- * @summary 1.4 javac should not accept the Covariant Return Type
+ * @summary Ensure covariant return type allowed
  * @author gafter
  *
- * @compile -source 1.4 ExtendCovariant1.java
+ * @compile ExtendCovariant1.java
  */
 
 /**
@@ -37,8 +37,7 @@
  *
  * java.lang.Appendable java.lang.Appendable.append(char)
  *
- * Yet javac should allow extending PrintStream, as long as the user
- * doesn't directly override a covariant method in -source 1.4.
+ * With JDK 1.5, a covariant return is allowed so check that is the case.
  **/
 public class ExtendCovariant1 extends java.io.PrintStream {
     ExtendCovariant1() throws java.io.IOException {
--- a/langtools/test/tools/javac/mixedTarget/ExtendCovariant2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/mixedTarget/ExtendCovariant2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -24,10 +24,10 @@
 /*
  * @test
  * @bug 5009712
- * @summary 1.4 javac should not accept the Covariant Return Type
+ * @summary Ensure Covariant Return Type allowed in minimum supported version
  * @author gafter
  *
- * @compile/fail -source 1.4 ExtendCovariant2.java
+ * @compile -source 1.6 ExtendCovariant2.java
  * @compile                  ExtendCovariant2.java
  */
 
@@ -38,8 +38,8 @@
  *
  * java.lang.Appendable java.lang.Appendable.append(char)
  *
- * Yet javac should allow extending PrintStream, as long as the user
- * doesn't directly override a covariant method in -source 1.4.
+ * With JDK 1.5, a Covariant Return is allowed so check that is the case.
+ *
  **/
 public class ExtendCovariant2 extends java.io.PrintStream {
     ExtendCovariant2() throws java.io.IOException {
--- a/langtools/test/tools/javac/options/T6900037.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/options/T6900037.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -26,9 +26,9 @@
  * @bug 6900037
  * @summary javac should warn if earlier -source is used and bootclasspath not set
  * @compile T6900037.java
- * @compile -source 1.6 T6900037.java
- * @compile/fail/ref=T6900037.out -XDrawDiagnostics -Werror -source 1.6 T6900037.java
- * @compile -Werror -source 1.6 -Xlint:-options T6900037.java
+ * @compile -source 1.8 T6900037.java
+ * @compile/fail/ref=T6900037.out -XDrawDiagnostics -Werror -source 1.8 T6900037.java
+ * @compile -Werror -source 1.8 -Xlint:-options T6900037.java
  */
 
 class T6900037 { }
--- a/langtools/test/tools/javac/options/T6900037.out	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/options/T6900037.out	Wed Jul 05 19:50:06 2017 +0200
@@ -1,4 +1,4 @@
-- compiler.warn.source.no.bootclasspath: 1.6
+- compiler.warn.source.no.bootclasspath: 1.8
 - compiler.err.warnings.and.werror
 1 error
 1 warning
--- a/langtools/test/tools/javac/options/T7022337.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/options/T7022337.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -51,7 +51,7 @@
             "-XDrawDiagnostics",
             "-d", ".",
             "-processor", myName,
-            "-source", "6", // explicit use of older source value without bootclasspath
+            "-source", "8", // explicit use of older source value without bootclasspath
             file.getPath());
 
         int count = 0;
--- a/langtools/test/tools/javac/processing/messager/MessagerDiags.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/processing/messager/MessagerDiags.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -54,7 +54,7 @@
 import static javax.tools.Diagnostic.Kind.*;
 import static javax.tools.JavaFileObject.Kind.*;
 
-@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
 @SupportedAnnotationTypes("*")
 public class MessagerDiags extends AbstractProcessor {
     static final String CNAME = "Test";
@@ -64,8 +64,8 @@
     static final String WRN_WITH_SOURCE = "warning with source";
     static final String NONE = "<none>";
     static final String[] EXPECTED = { NONE + ":-1--1:" + WRN_NO_SOURCE,
-                                       TEST_JAVA + ":0-13:" + WRN_WITH_SOURCE,
-                                       NONE + ":-1--1:" + WRN_NO_SOURCE
+                                TEST_JAVA + ":0-13:" + WRN_WITH_SOURCE,
+                                NONE + ":-1--1:" + WRN_NO_SOURCE
     };
 
     @Override
@@ -88,7 +88,7 @@
         DiagnosticCollector<JavaFileObject> dc = new DiagnosticCollector<>();
         List<String> options = new LinkedList<>();
         options.addAll(Arrays.asList("-bootclasspath",  bootPath,
-                        "-source", "1.6", "-classpath",
+                        "-source", "1.8", "-classpath",
                         System.getProperty("java.class.path")));
         options.addAll(Arrays.asList("-processor",
                        MessagerDiags.class.getName()));
--- a/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/scope/7017664/CompoundScopeTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -117,13 +117,13 @@
                 boolean subAdded = false;
                 for (int sc = 0 ; sc < 3 ; sc ++) {
                     if (scopeNesting[sc][i]) {
-                        sub.addSubScope(scopes[sc]);
+                        sub.prependSubScope(scopes[sc]);
                         if (!subAdded) {
-                            root.addSubScope(sub);
+                            root.prependSubScope(sub);
                             subAdded = true;
                         }
                     } else {
-                        root.addSubScope(scopes[sc]);
+                        root.prependSubScope(scopes[sc]);
                     }
                 }
                 log("testing scope: " + root);
@@ -145,7 +145,7 @@
          * Create a scope containing a given number of synthetic symbols
          */
         Scope createScope(int nelems) {
-            Scope s = new Scope(symtab.noSymbol);
+            WriteableScope s = WriteableScope.create(symtab.noSymbol);
             for (int i = 0 ; i < nelems ; i++) {
                 Symbol sym = new TypeVariableSymbol(0, names.fromString("s" + i), null, null);
                 s.enter(sym);
@@ -181,7 +181,7 @@
                     elems :
                     filter(elems, sf);
             int expectedCount = allSymbols.length();
-            for (Symbol s : sf == null ? cs.getElements() : cs.getElements(sf)) {
+            for (Symbol s : sf == null ? cs.getSymbols() : cs.getSymbols(sf)) {
                 checkSameSymbols(s, allSymbols.head);
                 allSymbols = allSymbols.tail;
                 found.append(s);
@@ -204,7 +204,7 @@
                     filter(shadowedEntry.getValue(), sf);
                 int expectedCount = shadowed.length();
                 Name name = shadowedEntry.getKey();
-                for (Symbol s : sf == null ? cs.getElementsByName(name) : cs.getElementsByName(name, sf)) {
+                for (Symbol s : sf == null ? cs.getSymbolsByName(name) : cs.getSymbolsByName(name, sf)) {
                     checkSameSymbols(s, shadowed.head);
                     shadowed = shadowed.tail;
                     count++;
--- a/langtools/test/tools/javac/scope/7017664/ImplementationCacheTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/scope/7017664/ImplementationCacheTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -98,7 +98,7 @@
 
         MethodSymbol I_m = null;
 
-        for (Symbol sym : i.members().getElements()) {
+        for (Symbol sym : i.members().getSymbols()) {
             if (sym.name.contentEquals("m")) {
                 I_m = (MethodSymbol)sym;
             }
--- a/langtools/test/tools/javac/scope/HashCollisionTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/scope/HashCollisionTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -25,16 +25,21 @@
  * @test
  * @bug 7004029
  * @summary Ensure Scope impl can cope with hash collisions
+ * @library /tools/javac/lib
+ * @build DPrinter HashCollisionTest
+ * @run main HashCollisionTest
  */
 
 import java.lang.reflect.*;
 import java.io.*;
+
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTrees;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Scope.*;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.file.JavacFileManager;
-import static com.sun.tools.javac.code.Kinds.*;
 
 public class HashCollisionTest {
     public static void main(String... args) throws Exception {
@@ -47,12 +52,13 @@
         JavacFileManager.preRegister(context); // required by ClassReader which is required by Symtab
         names = Names.instance(context);       // Name.Table impls tied to an instance of Names
         symtab = Symtab.instance(context);
+        trees = JavacTrees.instance(context);
 
         // determine hashMask for an empty scope
-        Scope emptyScope = new Scope(symtab.unnamedPackage); // any owner will do
-        Field sHashMask = Scope.class.getDeclaredField("hashMask");
-        sHashMask.setAccessible(true);
-        scopeHashMask = sHashMask.getInt(emptyScope);
+        Scope emptyScope = WriteableScope.create(symtab.unnamedPackage); // any owner will do
+        Field field = emptyScope.getClass().getDeclaredField("hashMask");
+        field.setAccessible(true);
+        scopeHashMask = field.getInt(emptyScope);
         log("scopeHashMask: " + scopeHashMask);
 
         // 1. determine the Name.hashCode of "Entry", and therefore the index of
@@ -92,7 +98,7 @@
 
         // 4. Create a package containing a nested class using the name from 2
         PackageSymbol p = new PackageSymbol(names.fromString("p"), symtab.rootPackage);
-        p.members_field = new Scope(p);
+        p.members_field = WriteableScope.create(p);
         ClassSymbol inner = createClass(innerName, p);
         // we'll need this later when we "rename" cn
         ClassSymbol outer = createClass(outerName, p);
@@ -100,42 +106,25 @@
         // 5. Create a star-import scope
         log ("createStarImportScope");
 
-        // if StarImportScope exists, use it, otherwise, for testing legacy code,
-        // fall back on ImportScope
-        Scope starImportScope;
-        Method importAll;
         PackageSymbol pkg = new PackageSymbol(names.fromString("pkg"), symtab.rootPackage);
-        try {
-            Class<?> c = Class.forName("com.sun.tools.javac.code.Scope$StarImportScope");
-            Constructor ctor = c.getDeclaredConstructor(new Class[] { Symbol.class });
-            importAll = c.getDeclaredMethod("importAll", new Class[] { Scope.class });
-            starImportScope = (Scope) ctor.newInstance(new Object[] { pkg });
-        } catch (ClassNotFoundException e) {
-            starImportScope = new ImportScope(pkg);
-            importAll = null;
-        }
+        StarImportScope starImportScope = new StarImportScope(pkg);
 
         dump("initial", starImportScope);
 
         // 6. Insert the contents of the package from 4.
-        Scope p_members = p.members();
-        if (importAll != null) {
-            importAll.invoke(starImportScope, p_members);
-        } else {
-            Scope fromScope = p_members;
-            Scope toScope = starImportScope;
-            // The following lines are taken from MemberEnter.importAll,
-            // before the use of StarImportScope.importAll.
-            for (Scope.Entry e = fromScope.elems; e != null; e = e.sibling) {
-                if (e.sym.kind == TYP && !toScope.includes(e.sym))
-                    toScope.enter(e.sym, fromScope);
+        Scope fromScope = p.members();
+        ImportFilter typeFilter = new ImportFilter() {
+            @Override
+            public boolean accepts(Scope origin, Symbol sym) {
+                return sym.kind == Kinds.TYP;
             }
-        }
+        };
+        starImportScope.importAll(fromScope, fromScope, typeFilter, false);
 
         dump("imported p", starImportScope);
 
         // 7. Insert the class from 3.
-        starImportScope.enter(ce, cc.members_field);
+        starImportScope.importAll(cc.members_field, cc.members_field, typeFilter, false);
         dump("imported ce", starImportScope);
 
         /*
@@ -149,11 +138,11 @@
         outer.members_field.enter(inner);
 
         // 9. Lookup Entry
-        Scope.Entry e = starImportScope.lookup(entry);
-        dump("final", starImportScope);
+        Symbol found = starImportScope.findFirst(entry);
+        if (found != ce)
+            throw new Exception("correct symbol not found: " + entry + "; found=" + found);
 
-        if (e.sym == null)
-            throw new Exception("symbol not found: " + entry);
+        dump("final", starImportScope);
     }
 
     /*
@@ -170,7 +159,7 @@
      */
     ClassSymbol createClass(Name name, Symbol owner) {
         ClassSymbol sym = new ClassSymbol(0, name, owner);
-        sym.members_field = new Scope(sym);
+        sym.members_field = WriteableScope.create(sym);
         if (owner != symtab.unnamedPackage)
             owner.members().enter(sym);
         return sym;
@@ -180,58 +169,16 @@
      * Dump the contents of a scope to System.err.
      */
     void dump(String label, Scope s) throws Exception {
-        dump(label, s, System.err);
-    }
-
-    /**
-     * Dump the contents of a scope to a stream.
-     */
-    void dump(String label, Scope s, PrintStream out) throws Exception {
-        out.println(label);
-        Field sTable = Scope.class.getDeclaredField("table");
-        sTable.setAccessible(true);
-
-        out.println("owner:" + s.owner);
-        Scope.Entry[] table = (Scope.Entry[]) sTable.get(s);
-        for (int i = 0; i < table.length; i++) {
-            if (i > 0)
-                out.print(", ");
-            out.print(i + ":" + toString(table[i], table, false));
-        }
-        out.println();
+        PrintWriter pw = new PrintWriter(System.err);
+        new DPrinter(pw, trees).printScope(label, s);
+        pw.flush();
     }
 
-    /**
-     * Create a string showing the contents of an entry, using the table
-     * to help identify cross-references to other entries in the table.
-     * @param e the entry to be shown
-     * @param table the table containing the other entries
-     */
-    String toString(Scope.Entry e, Scope.Entry[] table, boolean ref) {
-        if (e == null)
-            return "null";
-        if (e.sym == null)
-            return "sent"; // sentinel
-        if (ref) {
-            int index = indexOf(table, e);
-            if (index != -1)
-                return String.valueOf(index);
-        }
-        return "(" + e.sym.name + ":" + e.sym
-                + ",shdw:" + toString(e.next(), table, true)
-                + ",sibl:" + toString(e.sibling, table, true)
-                + ((e.sym.owner != e.scope.owner)
-                    ? (",BOGUS[" + e.sym.owner + "," + e.scope.owner + "]")
-                    : "")
-                + ")";
-    }
+    Object readField(Object scope, String fieldName) throws Exception {
+        Field field = scope.getClass().getDeclaredField(fieldName);
+        field.setAccessible(true);
 
-    <T> int indexOf(T[] array, T item) {
-        for (int i = 0; i < array.length; i++) {
-            if (array[i] == item)
-                return i;
-        }
-        return -1;
+        return field.get(scope);
     }
 
     /**
@@ -246,4 +193,5 @@
 
     Names names;
     Symtab symtab;
+    Trees trees;
 }
--- a/langtools/test/tools/javac/scope/StarImportTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/scope/StarImportTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -27,14 +27,17 @@
  * @summary Basher for star-import scopes
  */
 
-import java.lang.reflect.*;
 import java.util.*;
 import java.util.List;
-import com.sun.tools.javac.util.*;
+
 import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Scope.*;
+import com.sun.tools.javac.code.Scope.ImportFilter;
+import com.sun.tools.javac.code.Scope.StarImportScope;
+import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.*;
+
 import static com.sun.tools.javac.code.Kinds.*;
 
 public class StarImportTest {
@@ -87,13 +90,9 @@
         System.err.print(msg);
         System.err.print(": ");
         String sep = "(";
-        for (Scope.Entry se = s.elems; se != null; se = se.sibling) {
-            for (Scope.Entry e = se; e.sym != null; e = e.next()) {
-                System.err.print(sep + e.sym.name + ":" + e.sym);
-                sep = ",";
-            }
-            System.err.print(")");
-            sep = ", (";
+        for (Symbol sym : s.getSymbols()) {
+            System.err.print(sep + sym.name + ":" + sym);
+            sep = ",";
         }
         System.err.println();
     }
@@ -171,7 +170,7 @@
             int count = rgen.nextInt(MAX_SETUP_PACKAGE_COUNT);
             log("setup: creating package " + name + " with " + count + " entries");
             PackageSymbol p = new PackageSymbol(name, symtab.rootPackage);
-            p.members_field = new Scope(p);
+            p.members_field = WriteableScope.create(p);
             for (int i = 0; i < count; i++) {
                 String outer = name + "c" + i;
                 String suffix = random(null, "$Entry", "$Entry2");
@@ -213,38 +212,21 @@
             log ("createStarImportScope");
             PackageSymbol pkg = new PackageSymbol(names.fromString("pkg"), symtab.rootPackage);
 
-            // if StarImportScope exists, use it, otherwise, for testing legacy code,
-            // fall back on ImportScope
-            Method importAll;
-            try {
-                Class<?> c = Class.forName("com.sun.tools.javac.code.Scope$StarImportScope");
-                Constructor ctor = c.getDeclaredConstructor(new Class[] { Symbol.class });
-                importAll = c.getDeclaredMethod("importAll", new Class[] { Scope.class });
-                starImportScope = (Scope) ctor.newInstance(new Object[] { pkg });
-            } catch (ClassNotFoundException e) {
-                starImportScope = new ImportScope(pkg);
-                importAll = null;
-            }
+            starImportScope = new StarImportScope(pkg);
             starImportModel = new Model();
 
             for (Symbol imp: imports) {
                 Scope members = imp.members();
-                if (importAll != null) {
 //                    log("importAll", members);
-                    importAll.invoke(starImportScope, members);
-                } else {
-                    Scope fromScope = members;
-                    Scope toScope = starImportScope;
-                    // The following lines are taken from MemberEnter.importAll,
-                    // before the use of StarImportScope.importAll.
-                    for (Scope.Entry e = fromScope.elems; e != null; e = e.sibling) {
-                        if (e.sym.kind == TYP && !toScope.includes(e.sym))
-                            toScope.enter(e.sym, fromScope);
+                starImportScope.importAll(members, members, new ImportFilter() {
+                    @Override
+                    public boolean accepts(Scope origin, Symbol t) {
+                        return t.kind == TYP;
                     }
-                }
+                }, false);
 
-                for (Scope.Entry e = members.elems; e != null; e = e.sibling) {
-                    starImportModel.enter(e.sym);
+                for (Symbol sym : members.getSymbols()) {
+                    starImportModel.enter(sym);
                 }
             }
 
@@ -260,9 +242,9 @@
             log ("test");
             List<ClassSymbol> nestedClasses = new LinkedList<ClassSymbol>();
             for (PackageSymbol p: packages) {
-                for (Scope.Entry se = p.members_field.elems; se != null; se = se.sibling) {
-                    if (se.sym.name.toString().contains("$"))
-                        nestedClasses.add((ClassSymbol) se.sym);
+                for (Symbol sym : p.members_field.getSymbols()) {
+                    if (sym.name.toString().contains("$"))
+                        nestedClasses.add((ClassSymbol) sym);
                 }
             }
 
@@ -283,8 +265,7 @@
                 // determine new owner
                 Name outerName = names.fromString(s.substring(0, dollar));
 //                log(sym + " owner: " + sym.owner, sym.owner.members());
-                Scope.Entry outerEntry = sym.owner.members().lookup(outerName);
-                ClassSymbol outer = (ClassSymbol) outerEntry.sym;
+                ClassSymbol outer = (ClassSymbol)sym.owner.members().findFirst(outerName);
 //                log("outer: " + outerName + " " + outer);
 
                 // remove from package
@@ -302,7 +283,7 @@
 
         ClassSymbol createClass(Name name, Symbol owner) {
             ClassSymbol sym = new ClassSymbol(0, name, owner);
-            sym.members_field = new Scope(sym);
+            sym.members_field = WriteableScope.create(sym);
             if (owner != symtab.unnamedPackage)
                 owner.members().enter(sym);
             return sym;
@@ -318,7 +299,7 @@
         List<Symbol> imports = new ArrayList<Symbol>();
         int nextClassSerial;
 
-        Scope starImportScope;
+        StarImportScope starImportScope;
         Model starImportModel;
     }
 
@@ -355,9 +336,8 @@
         void check(Scope scope) {
             // First, check all entries in scope are in map
             int bogusCount = 0;
-            for (Scope.Entry se = scope.elems; se != null; se = se.sibling) {
-                Symbol sym = se.sym;
-                if (sym.owner != se.scope.owner) {
+            for (Symbol sym : scope.getSymbols()) {
+                if (sym.owner != scope.getOrigin(sym).owner) {
                     if (bogus.contains(sym)) {
                         bogusCount++;
                     } else {
@@ -380,16 +360,14 @@
             // Second, check all entries in map are in scope
             for (Map.Entry<Name,Set<Symbol>> me: map.entrySet()) {
                 Name name = me.getKey();
-                Scope.Entry se = scope.lookup(name);
-                assert (se != null);
-                if (se.sym == null) {
+                if (scope.findFirst(name) == null) {
                     error("check: no entries found for " + name + " in scope");
                     continue;
                 }
             nextSym:
                 for (Symbol sym: me.getValue()) {
-                    for (Scope.Entry e = se; e.sym != null; e = e.next()) {
-                        if (sym == e.sym)
+                    for (Symbol s : scope.getSymbolsByName(name)) {
+                        if (sym == s)
                             continue nextSym;
                     }
                     error("check: symbol " + sym + " not found in scope");
--- a/langtools/test/tools/javac/staticImport/6537020/T6537020.out	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/staticImport/6537020/T6537020.out	Wed Jul 05 19:50:06 2017 +0200
@@ -1,2 +1,2 @@
-T6537020.java:25:16: compiler.err.ref.ambiguous: s, kindname.variable, s, p.T6537020.B, kindname.variable, s, p.T6537020.A
+T6537020.java:25:16: compiler.err.ref.ambiguous: s, kindname.variable, s, p.T6537020.A, kindname.variable, s, p.T6537020.B
 1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/MakeTypeTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug     8042239
+ * @summary Verify that TreeMaker.Type(Type) can handle all reasonable types
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor MakeTypeTest
+ * @compile/process/ref=MakeTypeTest.out -processor MakeTypeTest MakeTypeTest.java
+ */
+
+import java.lang.annotation.*;
+import java.util.*;
+
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+
+import com.sun.source.tree.*;
+import com.sun.source.util.*;
+import com.sun.tools.javac.api.JavacTrees;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.List;
+
+public class MakeTypeTest extends JavacTestingAbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver())
+            return false;
+
+        JavacTask.instance(processingEnv).addTaskListener(new TaskListener() {
+            @Override
+            public void started(TaskEvent e) {
+            }
+            @Override
+            public void finished(TaskEvent e) {
+                if (e.getKind() == TaskEvent.Kind.ANALYZE &&
+                    e.getTypeElement().getQualifiedName().contentEquals("MakeTypeTest")) {
+                    doTest();
+                }
+            }
+        });
+
+        return false;
+    }
+
+    void doTest() {
+        //go through this file, look for @TestType and verify TreeMaker.Type behavior:
+        Context ctx = ((JavacProcessingEnvironment) processingEnv).getContext();
+        JavacTrees trees = JavacTrees.instance(ctx);
+        TypeElement testType = processingEnv.getElementUtils().getTypeElement("MakeTypeTest");
+        TreePath path = trees.getPath(testType);
+
+        Set<TypeKind> unseenTypeKinds = EnumSet.allOf(TypeKind.class);
+
+        new TreePathScanner<Void, Void>() {
+            @Override
+            public Void visitVariable(VariableTree node, Void p) {
+                handleDecl(new TreePath(getCurrentPath(), node.getType()));
+                return super.visitVariable(node, p);
+            }
+
+            @Override
+            public Void visitMethod(MethodTree node, Void p) {
+                if (node.getReturnType() != null)
+                    handleDecl(new TreePath(getCurrentPath(), node.getReturnType()));
+                return super.visitMethod(node, p);
+            }
+
+            @Override
+            public Void visitTypeParameter(TypeParameterTree node, Void p) {
+                TypeVariable type = (TypeVariable) trees.getTypeMirror(getCurrentPath());
+                TreePath aBoundPath = new TreePath(getCurrentPath(), node.getBounds().get(0));
+                handleDecl(aBoundPath, (Type) type.getUpperBound());
+                return super.visitTypeParameter(node, p);
+            }
+
+            void handleDecl(TreePath typePath) {
+                handleDecl(typePath, (Type) trees.getTypeMirror(typePath));
+            }
+
+            void handleDecl(TreePath typePath, Type type) {
+                Element decl = trees.getElement(typePath.getParentPath());
+                TestType testType = decl.getAnnotation(TestType.class);
+
+                if (testType == null) return ;
+
+                if (testType.nested() >= 0) {
+                    ClassType ct = (ClassType) type;
+                    type = ct.getTypeArguments().get(testType.nested());
+                }
+
+                JCExpression typeExpr = TreeMaker.instance(ctx).Type(type);
+
+                if (!typeExpr.getKind().equals(testType.expectedKind())) {
+                    throw new IllegalStateException("was=" + typeExpr + ", kind=" +
+                            typeExpr.getKind() + "; expected kind: " +
+                            testType.expectedKind() + "; type=" + type);
+                }
+                unseenTypeKinds.remove(type.getKind());
+            }
+
+        }.scan(path, null);
+
+        unseenTypeKinds.removeAll(Arrays.asList(TypeKind.NONE, TypeKind.NULL, TypeKind.ERROR,
+                TypeKind.PACKAGE, TypeKind.EXECUTABLE, TypeKind.OTHER));
+
+        if (!unseenTypeKinds.isEmpty())
+            throw new IllegalStateException("Unhandled types=" + unseenTypeKinds);
+
+        System.err.println("done.");
+    }
+
+    //the following defines the Types that should be passed into TreeMaker.Type and
+    //the expected resulting Tree kind:
+
+    @TestType(expectedKind=Tree.Kind.PRIMITIVE_TYPE)
+    boolean f1;
+    @TestType(expectedKind=Tree.Kind.PRIMITIVE_TYPE)
+    byte f2;
+    @TestType(expectedKind=Tree.Kind.PRIMITIVE_TYPE)
+    char f3;
+    @TestType(expectedKind=Tree.Kind.PRIMITIVE_TYPE)
+    double f4;
+    @TestType(expectedKind=Tree.Kind.PRIMITIVE_TYPE)
+    float f5;
+    @TestType(expectedKind=Tree.Kind.PRIMITIVE_TYPE)
+    int f6;
+    @TestType(expectedKind=Tree.Kind.PRIMITIVE_TYPE)
+    long f7;
+    @TestType(expectedKind=Tree.Kind.PRIMITIVE_TYPE)
+    short f8;
+    @TestType(expectedKind=Tree.Kind.PARAMETERIZED_TYPE)
+    List<? extends String> f9;
+    @TestType(expectedKind=Tree.Kind.ARRAY_TYPE)
+    int[] fa;
+    @TestType(expectedKind=Tree.Kind.EXTENDS_WILDCARD, nested = 0)
+    List<? extends String> fb;
+    @TestType(expectedKind=Tree.Kind.SUPER_WILDCARD, nested = 0)
+    List<? super String> fc;
+    @TestType(expectedKind=Tree.Kind.UNBOUNDED_WILDCARD, nested = 0)
+    List<?> fd;
+
+    @TestType(expectedKind=Tree.Kind.PRIMITIVE_TYPE)
+    void voidMethod() {
+        try {
+            voidMethod();
+        } catch (@TestType(expectedKind=Tree.Kind.UNION_TYPE) NullPointerException |
+                                                              IllegalStateException ex) {
+        }
+    }
+
+    class WithTypeParam<@TestType(expectedKind=Tree.Kind.INTERSECTION_TYPE)
+                        T extends CharSequence & Runnable> {
+        @TestType(expectedKind=Tree.Kind.IDENTIFIER)
+        T voidMethod() {
+            return null;
+        }
+    }
+
+}
+
+//TreeMaker.Type will be tested for the type the element annotated by this annotation
+@Target({ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD,
+         ElementType.PARAMETER, ElementType.TYPE_PARAMETER})
+@interface TestType {
+    //the expected Tree kind of the Tree that will be returned from TreeMaker.Type for the type
+    public Tree.Kind expectedKind();
+    //if >=0, the current type will be interpreted as a ClassType and the type to test will be
+    //the given type argument:
+    public int nested() default -1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/MakeTypeTest.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,1 @@
+done.
--- a/langtools/test/tools/javac/unicode/NonasciiDigit.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/unicode/NonasciiDigit.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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
+ * @test /nodynamiccopyright/
  * @bug 4707960 6183529
  * @summary javac accepts unicode digits - sometimes crashing
  * @author gafter
  *
- * @compile/fail NonasciiDigit.java
+ * @compile/fail/ref=NonasciiDigit.out -XDrawDiagnostics  NonasciiDigit.java
  */
 public class NonasciiDigit {
     public static void main(String[] args) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/unicode/NonasciiDigit.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NonasciiDigit.java:12:26: compiler.err.illegal.char: \uff11
+1 error
--- a/langtools/test/tools/javac/unicode/NonasciiDigit2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/unicode/NonasciiDigit2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,33 +1,10 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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
+ * @test /nodynamiccopyright/
  * @bug 4707960 6183529
  * @summary javac accepts unicode digits - sometimes crashing
  * @author gafter
  *
- * @compile/fail NonasciiDigit2.java
+ * @compile/fail/ref=NonasciiDigit2.out -XDrawDiagnostics  NonasciiDigit2.java
  */
 public class NonasciiDigit2 {
     public static void main(String[] args) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/unicode/NonasciiDigit2.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+NonasciiDigit2.java:12:18: compiler.err.illegal.nonascii.digit
+1 error
--- a/langtools/test/tools/javac/unicode/SupplementaryJavaID2.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID2.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,34 +1,11 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 4914724
  * @summary Ensure that the invalid surrogate sequence, as the start of an identifier,
  *          causes a compilation failure
  * @author Naoto Sato
  *
- * @compile/fail SupplementaryJavaID2.java
+ * @compile/fail/ref=SupplementaryJavaID2.out -XDrawDiagnostics  SupplementaryJavaID2.java
  */
 
 public class SupplementaryJavaID2 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID2.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,3 @@
+SupplementaryJavaID2.java:12:14: compiler.err.illegal.char: \ud801
+SupplementaryJavaID2.java:12:24: compiler.err.expected: token.identifier
+2 errors
--- a/langtools/test/tools/javac/unicode/SupplementaryJavaID3.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID3.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,34 +1,11 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 4914724
  * @summary Ensure that the invalid surrogate sequence, as the part of an identifier,
  *          causes a compilation failure
  * @author Naoto Sato
  *
- * @compile/fail SupplementaryJavaID3.java
+ * @compile/fail/ref=SupplementaryJavaID3.out -XDrawDiagnostics  SupplementaryJavaID3.java
  */
 
 public class SupplementaryJavaID3 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID3.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,2 @@
+SupplementaryJavaID3.java:12:23: compiler.err.illegal.char: \ud801
+1 error
--- a/langtools/test/tools/javac/unicode/TripleQuote.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/unicode/TripleQuote.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,36 +1,14 @@
 /*
- * Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
- * 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
+ * @test /nodynamiccopyright/
  * @bug 1265387
  * @summary ''' and '\u0027' are not legal char literals.
  * @author turnidge
  *
- * @compile/fail TripleQuote.java
+ * @compile/fail/ref=TripleQuote.out -XDrawDiagnostics  TripleQuote.java
  */
 
 public
 class TripleQuote {
     char c = '\u0027';
+    char d = ''';
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/unicode/TripleQuote.out	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,7 @@
+TripleQuote.java:12:14: compiler.err.empty.char.lit
+TripleQuote.java:12:20: compiler.err.empty.char.lit
+TripleQuote.java:12:21: compiler.err.unclosed.char.lit
+TripleQuote.java:13:14: compiler.err.empty.char.lit
+TripleQuote.java:13:15: compiler.err.empty.char.lit
+TripleQuote.java:13:16: compiler.err.unclosed.char.lit
+6 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/varargs/T8049075/VarargsAndWildcardParameterizedTypeTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8049075
+ * @summary javac, wildcards and generic vararg method invocation not accepted
+ * @compile VarargsAndWildcardParameterizedTypeTest.java
+ */
+
+class VarargsAndWildcardParameterizedTypeTest {
+    interface I<T> {
+        String m(T... t);
+    }
+
+    void m() {
+        I<? super Integer> i = null;
+        i.m(Integer.valueOf(1), Integer.valueOf(1));
+    }
+}
--- a/langtools/test/tools/javac/varargs/warning/Warn4.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/varargs/warning/Warn4.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug     6945418 6993978 8006694
+ * @bug     6945418 6993978 8006694 7196160
  * @summary Project Coin: Simplified Varargs Method Invocation
  *  temporarily workaround combo tests are causing time out in several platforms
  * @author  mcimadamore
--- a/langtools/test/tools/javac/varargs/warning/Warn5.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/javac/varargs/warning/Warn5.java	Wed Jul 05 19:50:06 2017 +0200
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug     6993978 7097436 8006694
+ * @bug     6993978 7097436 8006694 7196160
  * @summary Project Coin: Annotation to reduce varargs warnings
  *  temporarily workaround combo tests are causing time out in several platforms
  * @author  mcimadamore
--- a/langtools/test/tools/javac/versions/CheckClassFileVersion.java	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-
-
-public class CheckClassFileVersion {
-
-    static String get(String fn) throws IOException {
-        ByteBuffer bb = ByteBuffer.allocate(1024);
-        FileChannel fc = new FileInputStream(fn).getChannel();
-        try {
-            bb.clear();
-            if (fc.read(bb) < 0)
-                throw new IOException("Could not read any bytes");
-            bb.flip();
-            int minor = bb.getShort(4);
-            int major = bb.getShort(6);
-            return major + "." + minor;
-        } finally {
-            fc.close();
-        }
-    }
-
-    public static void main(String[] args) throws IOException {
-        String cfv = get(args[0]);
-        if (args.length == 1) {
-            System.out.println(cfv);
-            return;
-        }
-        if (!cfv.equals(args[1])) {
-            System.err.println("Class-file version mismatch: Expected "
-                               + args[1] + ", got " + cfv);
-            System.exit(1);
-        }
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/versions/SourceTargetTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8050106
+ * @summary JavaCompiler relies on inappropriate result from comparison
+ */
+
+import java.io.*;
+import java.util.*;
+import com.sun.tools.javac.code.Source;
+import com.sun.tools.javac.jvm.Target;
+
+public class SourceTargetTest {
+    public static void main(String... args) throws Exception {
+        SourceTargetTest t = new SourceTargetTest();
+        t.run();
+    }
+
+    public void run() throws Exception {
+        try (FileWriter out = new FileWriter("C.java")) {
+            out.write("class C { }");
+        }
+
+        for (Source s: Source.values()) {
+            test(s, null, "source", getKind(s, Source.MIN));
+        }
+
+        for (Target t: Target.values()) {
+            test(Source.values()[0], t, "target", getKind(t, Target.MIN));
+        }
+
+        if (errors > 0)
+            throw new Exception(errors + " errors occurred");
+    }
+
+    void test(Source s, Target t, String select, Kind kind) {
+        System.err.println("Test: source:" + s + ", target:" + t + " " + select + " " + kind);
+        List<String> args = new ArrayList<>();
+        args.add("-XDrawDiagnostics");
+        args.add("-source");
+        args.add(s.name);
+        if (t != null) {
+            args.add("-target");
+            args.add(t.name);
+        }
+        args.add("C.java");
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]), pw);
+        pw.close();
+        String out = sw.toString();
+        System.err.print(out);
+
+        switch (kind) {
+            case INVALID:
+                check(out, "removed." + select, true);
+                check(out, "obsolete." + select, false);
+                break;
+
+            case OBSOLETE:
+                check(out, "removed." + select, false);
+                check(out, "obsolete." + select, true);
+                break;
+
+            case VALID:
+                check(out, "removed." + select, false);
+                check(out, "obsolete." + select, false);
+                break;
+        }
+
+        System.err.println();
+    }
+
+    enum Kind { INVALID, OBSOLETE, VALID };
+
+    <T extends Comparable<T>> Kind getKind(T t1, T t2) {
+        if (t1.compareTo(t2) < 0)
+            return Kind.INVALID;
+        else if (t1 == t2)
+            return Kind.OBSOLETE;
+        else
+            return Kind.VALID;
+    }
+
+    void check(String out, String text, boolean expect) {
+        if (out.contains(text) == expect) {
+            if (expect)
+                System.err.println("expected string found: " + text);
+            else
+                System.err.println("string not found, as expected: " + text);
+        } else {
+            if (expect)
+                error("expected string not found: " + text);
+            else
+                error("unexpected string found: " + text);
+        }
+    }
+
+    void error(String msg) {
+        System.err.println("error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/versions/Versions.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,335 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610
+ * @summary Check interpretation of -target and -source options
+ * @run main Versions
+ */
+
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+
+public class Versions {
+
+    protected JavaCompiler javacompiler;
+    protected int failedCases;
+
+    public Versions() throws IOException {
+        javacompiler = ToolProvider.getSystemJavaCompiler();
+        genSourceFiles();
+        failedCases = 0;
+    }
+
+    public static void main(String... args) throws IOException {
+        Versions versions = new Versions();
+        versions.run();
+    }
+
+    void run() {
+
+        String jdk9cv = "52.0";  // class version.change when ./dev pushed to 53
+
+        String TC = "";
+        System.out.println("Version.java: Starting");
+
+        check("52.0");
+        check("52.0", "-source 1.6");
+        check("52.0", "-source 1.7");
+        check("52.0", "-source 1.8");
+        check(jdk9cv, "-source 1.9");
+
+        check_source_target("50.0", "6", "6");
+        check_source_target("51.0", "6", "7");
+        check_source_target("51.0", "7", "7");
+        check_source_target("52.0", "6", "8");
+        check_source_target("52.0", "7", "8");
+        check_source_target("52.0", "8", "8");
+        check_source_target(jdk9cv, "6", "9");
+        check_source_target(jdk9cv, "7", "9");
+        check_source_target(jdk9cv, "8", "9");
+        check_source_target(jdk9cv, "9", "9");
+
+        checksrc16("-source 1.6");
+        checksrc16("-source 6");
+        checksrc16("-source 1.6", "-target 1.6");
+        checksrc16("-source 6", "-target 6");
+        checksrc17("-source 1.7");
+        checksrc17("-source 7");
+        checksrc17("-source 1.7", "-target 1.7");
+        checksrc17("-source 7", "-target 7");
+        checksrc18("-source 1.8");
+        checksrc18("-source 8");
+        checksrc18("-source 1.8", "-target 1.8");
+        checksrc18("-source 8", "-target 8");
+        checksrc19();
+        checksrc19("-source 1.9");
+        checksrc19("-source 9");
+        checksrc19("-source 1.9", "-target 1.9");
+        checksrc19("-source 9", "-target 9");
+        checksrc19("-target 1.9");
+        checksrc19("-target 9");
+
+        fail("-source 7", "-target 1.6", "X.java");
+        fail("-source 8", "-target 1.6", "X.java");
+        fail("-source 8", "-target 1.7", "X.java");
+        fail("-source 9", "-target 1.7", "X.java");
+        fail("-source 9", "-target 1.8", "X.java");
+
+        if (failedCases > 0) {
+            System.err.println("failedCases = " + String.valueOf(failedCases));
+            throw new Error("Test failed");
+        }
+
+    }
+
+
+
+    protected void printargs(String fname,String... args) {
+        System.out.printf("test: %s", fname);
+        for (String onearg : args) {
+            System.out.printf(" %s", onearg);
+        }
+        System.out.printf("\n", fname);
+    }
+
+    protected void check_source_target(String... args) {
+        printargs("check_source_target", args);
+        check_target(args[0], args[1], args[2]);
+        check_target(args[0], "1." + args[1], args[2]);
+    }
+
+    protected void check_target(String... args) {
+        check(args[0], "-source " + args[1], "-target " + args[2]);
+        check(args[0], "-source " + args[1], "-target 1." + args[2]);
+    }
+
+    protected void check(String major, String... args) {
+        printargs("check", args);
+        List<String> jcargs = new ArrayList<String>();
+        jcargs.add("-Xlint:-options");
+
+        // add in args conforming to List requrements of JavaCompiler
+        for (String onearg : args) {
+            String[] fields = onearg.split(" ");
+            for (String onefield : fields) {
+                jcargs.add(onefield);
+            }
+        }
+
+        boolean creturn = compile("X.java", jcargs);
+        if (!creturn) {
+            // compilation errors note and return.. assume no class file
+            System.err.println("check: Compilation Failed");
+            System.err.println("\t classVersion:\t" + major);
+            System.err.println("\t arguments:\t" + jcargs);
+            failedCases++;
+
+        } else if (!checkClassFileVersion("X.class", major)) {
+            failedCases++;
+        }
+    }
+
+    protected void checksrc16(String... args) {
+        printargs("checksrc16", args);
+        int asize = args.length;
+        String[] newargs = new String[asize + 1];
+        System.arraycopy(args, 0, newargs, 0, asize);
+        newargs[asize] = "X.java";
+        pass(newargs);
+        newargs[asize] = "Y.java";
+        fail(newargs);
+    }
+
+    protected void checksrc17(String... args) {
+        printargs("checksrc17", args);
+        int asize = args.length;
+        String[] newargs = new String[asize+1];
+        System.arraycopy(args, 0, newargs,0 , asize);
+        newargs[asize] = "X.java";
+        pass(newargs);
+        newargs[asize] = "Y.java";
+        pass(newargs);
+    }
+
+    protected void checksrc18(String... args) {
+        printargs("checksrc18", args);
+        checksrc17(args);
+    }
+
+    protected void checksrc19(String... args) {
+        printargs("checksrc19", args);
+        checksrc17(args);
+    }
+
+    protected void pass(String... args) {
+        printargs("pass", args);
+
+        List<String> jcargs = new ArrayList<String>();
+        jcargs.add("-Xlint:-options");
+
+        // add in args conforming to List requrements of JavaCompiler
+        for (String onearg : args) {
+            String[] fields = onearg.split(" ");
+            for (String onefield : fields) {
+                jcargs.add(onefield);
+            }
+        }
+
+        // empty list is error
+        if (jcargs.isEmpty()) {
+            System.err.println("error: test error in pass() - No arguments");
+            System.err.println("\t arguments:\t" + jcargs);
+            failedCases++;
+            return;
+        }
+
+        // the last argument is the filename *.java
+        String filename = jcargs.get(jcargs.size() - 1);
+        jcargs.remove(jcargs.size() - 1);
+
+        boolean creturn = compile(filename, jcargs);
+        // expect a compilation failure, failure if otherwise
+        if (!creturn) {
+            System.err.println("pass: Compilation erroneously failed");
+            System.err.println("\t arguments:\t" + jcargs);
+            System.err.println("\t file     :\t" + filename);
+            failedCases++;
+
+        }
+
+    }
+
+    protected void fail(String... args) {
+        printargs("fail", args);
+
+        List<String> jcargs = new ArrayList<String>();
+        jcargs.add("-Xlint:-options");
+
+        // add in args conforming to List requrements of JavaCompiler
+        for (String onearg : args) {
+            String[] fields = onearg.split(" ");
+            for (String onefield : fields) {
+                jcargs.add(onefield);
+            }
+        }
+
+        // empty list is error
+        if (jcargs.isEmpty()) {
+            System.err.println("error: test error in fail()- No arguments");
+            System.err.println("\t arguments:\t" + jcargs);
+            failedCases++;
+            return;
+        }
+
+        // the last argument is the filename *.java
+        String filename = jcargs.get(jcargs.size() - 1);
+        jcargs.remove(jcargs.size() - 1);
+
+        boolean creturn = compile(filename, jcargs);
+        // expect a compilation failure, failure if otherwise
+        if (creturn) {
+            System.err.println("fail: Compilation erroneously succeeded");
+            System.err.println("\t arguments:\t" + jcargs);
+            System.err.println("\t file     :\t" + filename);
+            failedCases++;
+        }
+    }
+
+    protected boolean compile(String sourceFile, List<String>options) {
+        JavaCompiler.CompilationTask jctask;
+        StandardJavaFileManager fm = javacompiler.getStandardFileManager(null, null, null);
+        Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(sourceFile);
+
+        jctask = javacompiler.getTask(
+            null,    // Writer
+            fm,      // JavaFileManager
+            null,    // DiagnosticListener
+            options, // Iterable<String>
+            null,    // Iterable<String> classes
+            files);  // Iterable<? extends JavaFileObject>
+        return jctask.call();
+    }
+
+
+    protected void genSourceFiles() throws IOException{
+        /* Create a file that executes with all supported versions. */
+        File fsource = new File("X.java");
+        try (Writer fw = new FileWriter(fsource)) {
+            fw.write("public class X { }\n");
+            fw.flush();
+        }
+
+        /* Create a file with feature not supported in deprecated version.
+         * New feature for 1.7, does not exist in 1.6.
+         */
+        fsource = new File("Y.java");
+        try (Writer fw = new FileWriter(fsource)) {
+            fw.write("import java.util.List;\n");
+            fw.write("import java.util.ArrayList;\n");
+            fw.write("class Z { List<String> s = new ArrayList<>(); }\n");
+            fw.flush();
+        }
+    }
+
+    protected boolean checkClassFileVersion
+        (String filename,String classVersionNumber) {
+        ByteBuffer bb = ByteBuffer.allocate(1024);
+        try (FileChannel fc = new FileInputStream(filename).getChannel()) {
+            bb.clear();
+            if (fc.read(bb) < 0)
+                throw new IOException("Could not read from file : " + filename);
+            bb.flip();
+            int minor = bb.getShort(4);
+            int major = bb.getShort(6);
+            String fileVersion = major + "." + minor;
+            if (fileVersion.equals(classVersionNumber)) {
+                return true;
+            } else {
+                System.err.println("checkClassFileVersion : Failed");
+                System.err.println("\tclassfile version mismatch");
+                System.err.println("\texpected : " + classVersionNumber);
+                System.err.println("\tfound    : " + fileVersion);
+                return false;
+            }
+        }
+        catch (IOException e) {
+            System.err.println("checkClassFileVersion : Failed");
+            System.err.println("\terror :\t" + e.getMessage());
+            System.err.println("\tfile:\tfilename");
+        }
+        return false;
+    }
+}
+
--- a/langtools/test/tools/javac/versions/check.sh	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-#
-# 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.
-#
-# 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 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961
-# @summary Check interpretation of -target and -source options
-# @build CheckClassFileVersion
-# @run shell check.sh 
-
-TESTJAVA=${TESTJAVA:?}
-TC=${TESTCLASSES-.}
-
-J="$TESTJAVA/bin/java" 
-JC="$TESTJAVA/bin/javac" 
-CFV="${TESTVMOPTS} -cp $TC CheckClassFileVersion"
-
-rm -f $TC/X.java $TC/X.java
-echo 'public class X { }' > $TC/X.java
-echo 'public enum Y { }' > $TC/Y.java
-
-
-# Check class-file versions
-
-check() {
-  V=$1; shift
-  echo "+ javac $* [$V]"
-  "$JC" ${TESTTOOLVMOPTS} -Xlint:-options -d $TC $* $TC/X.java && "$J" $CFV $TC/X.class $V || exit 2
-}
-
-# check for all combinations of target values
-check_target() {
-  check $1 -source $2 -target $3
-  check $1 -source $2 -target 1.${3}
-}
-# check for all combinations of source and target values
-check_source_target() {
-  check_target $1 $2     $3
-  check_target $1 1.${2} $3
-}
-
-check 48.0 -source 1.4
-
-check 49.0 -source 1.4 -target 1.5
-check 49.0 -source 1.5 -target 1.5
-
-check_target        50.0 1.4 6
-check_target        50.0 1.5 6
-check_source_target 50.0 6   6
-
-check_target        51.0 1.4 7
-check_target        51.0 1.5 7
-check_source_target 51.0 6   7
-check_source_target 51.0 7   7
-
-check_target        52.0 1.4 8
-check_target        52.0 1.5 8
-check_source_target 52.0 6   8
-check_source_target 52.0 7   8
-check_source_target 52.0 8   8
-
-check_target        52.0 1.5 9
-check_source_target 52.0 8   9
-check_source_target 52.0 9   9
-
-# and finally the default with no options
-check 52.0
-
-# Check source versions
-
-fail() {
-  echo "+ javac $*"
-  if "$JC" ${TESTTOOLVMOPTS} -Xlint:-options -d $TC $*; then
-    echo "-- did not fail as expected"
-    exit 3
-  else
-    echo "-- failed as expected"
-  fi
-}
-
-pass() {
-  echo "+ javac $*"
-  if "$JC" ${TESTTOOLVMOPTS} -Xlint:options -d $TC $*; then
-    echo "-- passed"
-  else
-    echo "-- failed"
-    exit 4
-  fi
-}
-
-# the following need to be updated when -source 7 features are available
-checksrc14() { pass $* $TC/X.java; fail $* $TC/Y.java; }
-checksrc15() { pass $* $TC/X.java; pass $* $TC/Y.java; }
-checksrc16() { checksrc15 $* ; }
-checksrc17() { checksrc15 $* ; }
-checksrc18() { checksrc15 $* ; }
-checksrc19() { checksrc15 $* ; }
-
-checksrc14 -source 1.4
-checksrc14 -source 1.4 -target 1.5
-
-checksrc15 -source 1.5
-checksrc15 -source 1.5 -target 1.5
-
-checksrc16 -source 1.6
-checksrc16 -source 6
-checksrc16 -source 1.6 -target 1.6
-checksrc16 -source 6 -target 6
-
-checksrc17 -source 1.7
-checksrc17 -source 7
-checksrc17 -source 1.7 -target 1.7
-checksrc17 -source 7 -target 7
-
-checksrc18 -source 1.8
-checksrc18 -source 8
-checksrc18 -source 1.8 -target 1.8
-checksrc18 -source 8 -target 8
-
-checksrc19
-checksrc19 -source 1.9
-checksrc19 -source 9
-checksrc19 -source 1.9 -target 1.9
-checksrc19 -source 9 -target 9
-checksrc19 -target 1.9
-checksrc19 -target 9
-
-fail -source 1.5 -target 1.4 $TC/X.java
-fail -source 1.6 -target 1.4 $TC/X.java
-fail -source 6   -target 1.4 $TC/X.java
-fail -source 1.6 -target 1.5 $TC/X.java
-fail -source 6   -target 1.5 $TC/X.java
-fail -source 7   -target 1.6 $TC/X.java
-fail -source 8   -target 1.6 $TC/X.java
-fail -source 8   -target 1.7 $TC/X.java
-fail -source 9   -target 1.7 $TC/X.java
-fail -source 9   -target 1.8 $TC/X.java
--- a/langtools/test/tools/jdeps/APIDeps.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/jdeps/APIDeps.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8015912 8029216
+ * @bug 8015912 8029216 8048063
  * @summary Test -apionly and -jdkinternals options
  * @build m.Bar m.Foo m.Gee b.B c.C c.I d.D e.E f.F g.G
  * @run main APIDeps
@@ -81,27 +81,39 @@
              new String[] {"compact1", "compact3", testDirBasename},
              new String[] {"-classpath", testDir.getPath(), "-verbose", "-P"});
         test(new File(mDir, "Foo.class"),
+             new String[] {"c.I", "e.E", "f.F"},
+             new String[] {testDirBasename},
+             new String[] {"-classpath", testDir.getPath(), "-verbose:class", "-P"});
+        test(new File(mDir, "Foo.class"),
              new String[] {"c.I", "e.E", "f.F", "m.Bar"},
              new String[] {testDirBasename},
-             new String[] {"-classpath", testDir.getPath(), "-verbose", "-P"});
+             new String[] {"-classpath", testDir.getPath(), "-verbose:class", "-filter:none", "-P"});
         test(new File(mDir, "Gee.class"),
-             new String[] {"g.G", "sun.misc.Lock"},
-             new String[] {testDirBasename, "JDK internal API"},
-             new String[] {"-classpath", testDir.getPath(), "-verbose"});
+             new String[] {"g.G", "sun.misc.Lock", "com.sun.tools.classfile.ClassFile",
+                           "com.sun.management.ThreadMXBean", "com.sun.source.tree.BinaryTree"},
+             new String[] {testDirBasename, "JDK internal API", "compact3", ""},
+             new String[] {"-classpath", testDir.getPath(), "-verbose", "-P"});
 
         // -jdkinternals
         test(new File(mDir, "Gee.class"),
-             new String[] {"sun.misc.Lock"},
+             new String[] {"sun.misc.Lock", "com.sun.tools.classfile.ClassFile"},
              new String[] {"JDK internal API"},
              new String[] {"-jdkinternals"});
         // -jdkinternals parses all classes on -classpath and the input arguments
         test(new File(mDir, "Gee.class"),
-             new String[] {"sun.misc.Lock", "sun.misc.Unsafe"},
+             new String[] {"com.sun.tools.jdeps.Main", "com.sun.tools.classfile.ClassFile",
+                           "sun.misc.Lock", "sun.misc.Unsafe"},
              new String[] {"JDK internal API"},
              new String[] {"-classpath", testDir.getPath(), "-jdkinternals"});
 
         // parse only APIs
-        // parse only APIs
+        test(mDir,
+             new String[] {"java.lang.Object", "java.lang.String",
+                           "java.util.Set",
+                           "c.C", "d.D", "c.I", "e.E"},
+             new String[] {"compact1", testDirBasename},
+             new String[] {"-classpath", testDir.getPath(), "-verbose:class", "-P", "-apionly"});
+
         test(mDir,
              new String[] {"java.lang.Object", "java.lang.String",
                            "java.util.Set",
--- a/langtools/test/tools/jdeps/Basic.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/jdeps/Basic.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8003562 8005428 8015912 8027481
+ * @bug 8003562 8005428 8015912 8027481 8048063
  * @summary Basic tests for jdeps tool
  * @build Test p.Foo p.Bar javax.activity.NotCompactProfile
  * @run main Basic
@@ -86,6 +86,16 @@
              new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"},
              new String[] {"compact1", "compact1", "not found", "not found"},
              new String[] {"-verbose:class"});
+        // test -filter:none option
+        test(new File(testDir, "p"),
+             new String[] {"java.lang", "java.util", "java.lang.management", "javax.activity", "javax.crypto", "p"},
+             new String[] {"compact1", "compact1", "compact3", testDir.getName(), "compact1", "p"},
+             new String[] {"-classpath", testDir.getPath(), "-verbose:package", "-filter:none"});
+        // test -filter:archive option
+        test(new File(testDir, "p"),
+             new String[] {"java.lang", "java.util", "java.lang.management", "javax.activity", "javax.crypto"},
+             new String[] {"compact1", "compact1", "compact3", testDir.getName(), "compact1"},
+             new String[] {"-classpath", testDir.getPath(), "-verbose:package", "-filter:archive"});
         // test -p option
         test(new File(testDir, "Test.class"),
              new String[] {"p.Foo", "p.Bar"},
@@ -100,11 +110,12 @@
              new String[] {"java.lang"},
              new String[] {"compact1"},
              new String[] {"-verbose:package", "-e", "java\\.lang\\..*"});
+
         // test -classpath and -include options
         test(null,
-             new String[] {"java.lang", "java.util",
-                           "java.lang.management", "javax.crypto"},
-             new String[] {"compact1", "compact1", "compact3", "compact1"},
+             new String[] {"java.lang", "java.util", "java.lang.management",
+                           "javax.activity", "javax.crypto"},
+             new String[] {"compact1", "compact1", "compact3", testDir.getName(), "compact1"},
              new String[] {"-classpath", testDir.getPath(), "-include", "p.+|Test.class"});
         test(new File(testDir, "Test.class"),
              new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/DotFileTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8003562
+ * @summary Basic tests for jdeps -dotoutput option
+ * @build Test p.Foo p.Bar javax.activity.NotCompactProfile
+ * @run main DotFileTest
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.regex.*;
+
+public class DotFileTest {
+    private static boolean symbolFileExist = initProfiles();
+    private static boolean initProfiles() {
+        // check if ct.sym exists; if not use the profiles.properties file
+        Path home = Paths.get(System.getProperty("java.home"));
+        if (home.endsWith("jre")) {
+            home = home.getParent();
+        }
+        Path ctsym = home.resolve("lib").resolve("ct.sym");
+        boolean symbolExists = ctsym.toFile().exists();
+        if (!symbolExists) {
+            Path testSrcProfiles =
+                Paths.get(System.getProperty("test.src", "."), "profiles.properties");
+            if (!testSrcProfiles.toFile().exists())
+                throw new Error(testSrcProfiles + " does not exist");
+            System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
+                ctsym, testSrcProfiles);
+            System.setProperty("jdeps.profiles", testSrcProfiles.toString());
+        }
+        return symbolExists;
+    }
+
+    public static void main(String... args) throws Exception {
+        int errors = 0;
+        errors += new DotFileTest().run();
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    final Path dir;
+    final Path dotoutput;
+    DotFileTest() {
+        this.dir = Paths.get(System.getProperty("test.classes", "."));
+        this.dotoutput = dir.resolve("dots");
+    }
+
+    int run() throws IOException {
+        File testDir = dir.toFile();
+        // test a .class file
+        test(new File(testDir, "Test.class"),
+             new String[] {"java.lang", "p"},
+             new String[] {"compact1", "not found"});
+        // test a directory
+        // also test non-SE javax.activity class dependency
+        test(new File(testDir, "p"),
+             new String[] {"java.lang", "java.util", "java.lang.management", "javax.activity", "javax.crypto"},
+             new String[] {"compact1", "compact1", "compact3", testDir.getName(), "compact1"},
+             new String[] {"-classpath", testDir.getPath()});
+        // test class-level dependency output
+        test(new File(testDir, "Test.class"),
+             new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"},
+             new String[] {"compact1", "compact1", "not found", "not found"},
+             new String[] {"-verbose:class"});
+        // test -filter:none option
+        test(new File(testDir, "p"),
+             new String[] {"java.lang", "java.util", "java.lang.management", "javax.activity", "javax.crypto", "p"},
+             new String[] {"compact1", "compact1", "compact3", testDir.getName(), "compact1", "p"},
+             new String[] {"-classpath", testDir.getPath(), "-verbose:package", "-filter:none"});
+        // test -filter:archive option
+        test(new File(testDir, "p"),
+             new String[] {"java.lang", "java.util", "java.lang.management", "javax.activity", "javax.crypto"},
+             new String[] {"compact1", "compact1", "compact3", testDir.getName(), "compact1"},
+             new String[] {"-classpath", testDir.getPath(), "-verbose:package", "-filter:archive"});
+        // test -p option
+        test(new File(testDir, "Test.class"),
+             new String[] {"p.Foo", "p.Bar"},
+             new String[] {"not found", "not found"},
+             new String[] {"-verbose:class", "-p", "p"});
+        // test -e option
+        test(new File(testDir, "Test.class"),
+             new String[] {"p.Foo", "p.Bar"},
+             new String[] {"not found", "not found"},
+             new String[] {"-verbose:class", "-e", "p\\..*"});
+        test(new File(testDir, "Test.class"),
+             new String[] {"java.lang"},
+             new String[] {"compact1"},
+             new String[] {"-verbose:package", "-e", "java\\.lang\\..*"});
+        // test -classpath options
+        test(new File(testDir, "Test.class"),
+             new String[] {"java.lang.Object", "java.lang.String", "p.Foo", "p.Bar"},
+             new String[] {"compact1", "compact1", testDir.getName(), testDir.getName()},
+             new String[] {"-v", "-classpath", testDir.getPath()});
+
+        testSummary(new File(testDir, "Test.class"),
+             new String[] {"rt.jar", testDir.getName()},
+             new String[] {"compact1", ""},
+             new String[] {"-classpath", testDir.getPath()});
+        testSummary(new File(testDir, "Test.class"),
+             new String[] {"java.lang", "p"},
+             new String[] {"compact1", testDir.getName()},
+             new String[] {"-v", "-classpath", testDir.getPath()});
+        return errors;
+    }
+
+    void test(File file, String[] expect, String[] profiles) throws IOException {
+        test(file, expect, profiles, new String[0]);
+    }
+
+    void test(File file, String[] expect, String[] profiles, String[] options)
+        throws IOException
+    {
+        Path dotfile = dotoutput.resolve(file.toPath().getFileName().toString() + ".dot");
+
+        List<String> args = new ArrayList<>(Arrays.asList(options));
+        args.add("-dotoutput");
+        args.add(dotoutput.toString());
+        if (file != null) {
+            args.add(file.getPath());
+        }
+
+        Map<String,String> result = jdeps(args, dotfile);
+        checkResult("dependencies", expect, result.keySet());
+
+        // with -P option
+        List<String> argsWithDashP = new ArrayList<>();
+        argsWithDashP.add("-dotoutput");
+        argsWithDashP.add(dotoutput.toString());
+        argsWithDashP.add("-P");
+        argsWithDashP.addAll(args);
+
+        result = jdeps(argsWithDashP, dotfile);
+        checkResult("profiles", expect, profiles, result);
+    }
+
+    void testSummary(File file, String[] expect, String[] profiles, String[] options)
+        throws IOException
+    {
+        Path dotfile = dotoutput.resolve("summary.dot");
+
+        List<String> args = new ArrayList<>(Arrays.asList(options));
+        args.add("-dotoutput");
+        args.add(dotoutput.toString());
+        if (file != null) {
+            args.add(file.getPath());
+        }
+
+        Map<String,String> result = jdeps(args, dotfile);
+        checkResult("dependencies", expect, result.keySet());
+
+        // with -P option
+        List<String> argsWithDashP = new ArrayList<>();
+        argsWithDashP.add("-dotoutput");
+        argsWithDashP.add(dotoutput.toString());
+        argsWithDashP.add("-P");
+        argsWithDashP.addAll(args);
+
+        result = jdeps(argsWithDashP, dotfile);
+        checkResult("profiles", expect, profiles, result);
+    }
+
+    Map<String,String> jdeps(List<String> args, Path dotfile) throws IOException {
+        if (Files.exists(dotoutput)) {
+            try (DirectoryStream<Path> stream = Files.newDirectoryStream(dotoutput)) {
+                for (Path p : stream) {
+                    Files.delete(p);
+                }
+            }
+            Files.delete(dotoutput);
+        }
+        // invoke jdeps
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        System.err.println("jdeps " + args);
+        int rc = com.sun.tools.jdeps.Main.run(args.toArray(new String[0]), pw);
+        pw.close();
+        String out = sw.toString();
+        if (!out.isEmpty())
+            System.err.println(out);
+        if (rc != 0)
+            throw new Error("jdeps failed: rc=" + rc);
+
+        // check output files
+        if (Files.notExists(dotfile)) {
+            throw new RuntimeException(dotfile + " doesn't exist");
+        }
+        return parse(dotfile);
+    }
+    private static Pattern pattern = Pattern.compile("(.*) -> +([^ ]*) (.*)");
+    private Map<String,String> parse(Path outfile) throws IOException {
+        Map<String,String> result = new LinkedHashMap<>();
+        for (String line : Files.readAllLines(outfile)) {
+            line = line.replace('"', ' ').replace(';', ' ');
+            Matcher pm = pattern.matcher(line);
+            if (pm.find()) {
+                String origin = pm.group(1).trim();
+                String target = pm.group(2).trim();
+                String module = pm.group(3).replace('(', ' ').replace(')', ' ').trim();
+                result.put(target, module);
+            }
+        }
+        return result;
+    }
+
+    void checkResult(String label, String[] expect, Collection<String> found) {
+        List<String> list = Arrays.asList(expect);
+        if (!isEqual(list, found))
+            error("Unexpected " + label + " found: '" + found + "', expected: '" + list + "'");
+    }
+
+    void checkResult(String label, String[] expect, String[] profiles, Map<String,String> result) {
+        if (expect.length != profiles.length)
+            error("Invalid expected names and profiles");
+
+        // check the dependencies
+        checkResult(label, expect, result.keySet());
+        // check profile information
+        checkResult(label, profiles, result.values());
+        for (int i=0; i < expect.length; i++) {
+            String profile = result.get(expect[i]);
+            if (!profile.equals(profiles[i]))
+                error("Unexpected profile: '" + profile + "', expected: '" + profiles[i] + "'");
+        }
+    }
+
+    boolean isEqual(List<String> expected, Collection<String> found) {
+        if (expected.size() != found.size())
+            return false;
+
+        List<String> list = new ArrayList<>(found);
+        list.removeAll(expected);
+        return list.isEmpty();
+    }
+
+    void error(String msg) {
+        System.err.println("Error: " + msg);
+        errors++;
+    }
+
+    int errors;
+}
--- a/langtools/test/tools/jdeps/m/Gee.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/jdeps/m/Gee.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -26,5 +26,7 @@
 
 class Gee extends g.G {
     public sun.misc.Lock lock;
+    public com.sun.tools.classfile.ClassFile cf;     // @jdk.Exported(false)
+    public com.sun.source.tree.BinaryTree tree;      // @jdk.Exported
+    public com.sun.management.ThreadMXBean mxbean;   // @jdk.Exported on package-info
 }
-
--- a/langtools/test/tools/jdeps/p/Bar.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/langtools/test/tools/jdeps/p/Bar.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -30,4 +30,8 @@
     public javax.crypto.Cipher getCiper() {
         return null;
     }
+
+    public Foo foo() {
+        return new Foo();
+    }
 }
--- a/make/jprt.properties	Wed Jul 05 19:48:51 2017 +0200
+++ b/make/jprt.properties	Wed Jul 05 19:50:06 2017 +0200
@@ -193,9 +193,7 @@
     ${my.make.rule.test.targets.core},					\
     ${my.make.rule.test.targets.svc},					\
     ${my.test.target.set:TESTNAME=jdk_awt},				\
-    ${my.test.target.set:TESTNAME=jdk_beans1},				\
-    ${my.test.target.set:TESTNAME=jdk_beans2},				\
-    ${my.test.target.set:TESTNAME=jdk_beans3},				\
+    ${my.test.target.set:TESTNAME=jdk_beans},				\
     ${my.test.target.set:TESTNAME=jdk_sound},				\
     ${my.test.target.set:TESTNAME=jdk_swing}
 
--- a/nashorn/.hgtags	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/.hgtags	Wed Jul 05 19:50:06 2017 +0200
@@ -255,3 +255,4 @@
 46e36a92e37c06dea50f8c829549d9d0bfed4e3c jdk9-b19
 d703c59c556f9fcd9604272806ef7acf55c92363 jdk9-b20
 174cf53bce4e93a3d5d880ed7915ce8d0f08bc5e jdk9-b21
+a9d39bcfeb1bb3f7de929c56a2ecbea10a554ca1 jdk9-b22
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornException.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornException.java	Wed Jul 05 19:50:06 2017 +0200
@@ -53,9 +53,6 @@
     // underlying ECMA error object - lazily initialized
     private Object ecmaError;
 
-    /** script source name used for "engine.js" */
-    public static final String ENGINE_SCRIPT_SOURCE_NAME = "nashorn:engine/resources/engine.js";
-
     /**
      * Constructor
      *
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Wed Jul 05 19:50:06 2017 +0200
@@ -25,8 +25,6 @@
 
 package jdk.nashorn.api.scripting;
 
-import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError;
-import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 import static jdk.nashorn.internal.runtime.Source.sourceFor;
 
 import java.io.IOException;
@@ -34,13 +32,10 @@
 import java.lang.invoke.MethodHandles;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.net.URL;
 import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.security.Permissions;
 import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import java.security.ProtectionDomain;
 import java.text.MessageFormat;
 import java.util.Locale;
@@ -58,7 +53,6 @@
 import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
-import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -98,9 +92,6 @@
     // This is the initial default Nashorn global object.
     // This is used as "shared" global if above option is true.
     private final Global              global;
-    // initialized bit late to be made 'final'.
-    // Property object for "context" property of global object.
-    private volatile Property         contextProperty;
 
     // default options passed to Nashorn Options object
     private static final String[] DEFAULT_OPTIONS = new String[] { "-doe" };
@@ -122,30 +113,6 @@
         }
     }
 
-    // load engine.js
-    private static Source loadEngineJSSource() {
-        final String script = "resources/engine.js";
-        try {
-            return AccessController.doPrivileged(
-                    new PrivilegedExceptionAction<Source>() {
-                        @Override
-                        public Source run() throws IOException {
-                            final URL url = NashornScriptEngine.class.getResource(script);
-                            return sourceFor(NashornException.ENGINE_SCRIPT_SOURCE_NAME, url);
-                        }
-                    }
-            );
-        } catch (final PrivilegedActionException e) {
-            if (Context.DEBUG) {
-                e.printStackTrace();
-            }
-            throw new RuntimeException(e);
-        }
-    }
-
-    // Source object for engine.js
-    private static final Source ENGINE_SCRIPT_SRC = loadEngineJSSource();
-
     NashornScriptEngine(final NashornScriptEngineFactory factory, final ClassLoader appLoader) {
         this(factory, DEFAULT_OPTIONS, appLoader);
     }
@@ -248,33 +215,6 @@
         return getInterfaceInner(thiz, clazz);
     }
 
-    // These are called from the "engine.js" script
-
-    /**
-     * This hook is used to search js global variables exposed from Java code.
-     *
-     * @param self 'this' passed from the script
-     * @param ctxt current ScriptContext in which name is searched
-     * @param name name of the variable searched
-     * @return the value of the named variable
-     */
-    public Object __noSuchProperty__(final Object self, final ScriptContext ctxt, final String name) {
-        if (ctxt != null) {
-            final int scope = ctxt.getAttributesScope(name);
-            final Global ctxtGlobal = getNashornGlobalFrom(ctxt);
-            if (scope != -1) {
-                return ScriptObjectMirror.unwrap(ctxt.getAttribute(name, scope), ctxtGlobal);
-            }
-
-            if (self == UNDEFINED) {
-                // scope access and so throw ReferenceError
-                throw referenceError(ctxtGlobal, "not.defined", name);
-            }
-        }
-
-        return UNDEFINED;
-    }
-
     // Implementation only below this point
 
     private static Source makeSource(final Reader reader, final ScriptContext ctxt) throws ScriptException {
@@ -426,47 +366,12 @@
             }
         }, CREATE_GLOBAL_ACC_CTXT);
 
-        nashornContext.initGlobal(newGlobal);
+        nashornContext.initGlobal(newGlobal, this);
+        newGlobal.setScriptContext(ctxt);
 
-        final int NON_ENUMERABLE_CONSTANT = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE;
-        // current ScriptContext exposed as "context"
-        // "context" is non-writable from script - but script engine still
-        // needs to set it and so save the context Property object
-        contextProperty = newGlobal.addOwnProperty("context", NON_ENUMERABLE_CONSTANT, ctxt);
-        // current ScriptEngine instance exposed as "engine". We added @SuppressWarnings("LeakingThisInConstructor") as
-        // NetBeans identifies this assignment as such a leak - this is a false positive as we're setting this property
-        // in the Global of a Context we just created - both the Context and the Global were just created and can not be
-        // seen from another thread outside of this constructor.
-        newGlobal.addOwnProperty("engine", NON_ENUMERABLE_CONSTANT, this);
-        // global script arguments with undefined value
-        newGlobal.addOwnProperty("arguments", Property.NOT_ENUMERABLE, UNDEFINED);
-        // file name default is null
-        newGlobal.addOwnProperty(ScriptEngine.FILENAME, Property.NOT_ENUMERABLE, null);
-        // evaluate engine.js initialization script this new global object
-        try {
-            evalImpl(compileImpl(ENGINE_SCRIPT_SRC, newGlobal), ctxt, newGlobal);
-        } catch (final ScriptException exp) {
-            throw new RuntimeException(exp);
-        }
         return newGlobal;
     }
 
-    // scripts should see "context" and "engine" as variables in the given global object
-    private void setContextVariables(final Global ctxtGlobal, final ScriptContext ctxt) {
-        // set "context" global variable via contextProperty - because this
-        // property is non-writable
-        contextProperty.setValue(ctxtGlobal, ctxtGlobal, ctxt, false);
-        Object args = ScriptObjectMirror.unwrap(ctxt.getAttribute("arguments"), ctxtGlobal);
-        if (args == null || args == UNDEFINED) {
-            args = ScriptRuntime.EMPTY_ARRAY;
-        }
-        // if no arguments passed, expose it
-        if (! (args instanceof ScriptObject)) {
-            args = ctxtGlobal.wrapAsObject(args);
-            ctxtGlobal.set("arguments", args, false);
-        }
-    }
-
     private Object invokeImpl(final Object selfObject, final String name, final Object... args) throws ScriptException, NoSuchMethodException {
         name.getClass(); // null check
 
@@ -533,11 +438,7 @@
             }
 
             final ScriptFunction script = mgcs.getFunction(ctxtGlobal);
-
-            // set ScriptContext variables if ctxt is non-null
-            if (ctxt != null) {
-                setContextVariables(ctxtGlobal, ctxt);
-            }
+            ctxtGlobal.setScriptContext(ctxt);
             return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(ScriptRuntime.apply(script, ctxtGlobal), ctxtGlobal));
         } catch (final Exception e) {
             throwAsScriptException(e, ctxtGlobal);
@@ -560,10 +461,7 @@
                 Context.setGlobal(ctxtGlobal);
             }
 
-            // set ScriptContext variables if ctxt is non-null
-            if (ctxt != null) {
-                setContextVariables(ctxtGlobal, ctxt);
-            }
+            ctxtGlobal.setScriptContext(ctxt);
             return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(ScriptRuntime.apply(script, ctxtGlobal), ctxtGlobal));
         } catch (final Exception e) {
             throwAsScriptException(e, ctxtGlobal);
--- a/nashorn/src/jdk/nashorn/api/scripting/ScriptUtils.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptUtils.java	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,8 @@
 
 package jdk.nashorn.api.scripting;
 
+import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
+
 import java.lang.invoke.MethodHandle;
 import jdk.internal.dynalink.beans.StaticClass;
 import jdk.internal.dynalink.linker.LinkerServices;
@@ -69,12 +71,15 @@
      * Create a wrapper function that calls {@code func} synchronized on {@code sync} or, if that is undefined,
      * {@code self}. Used to implement "sync" function in resources/mozilla_compat.js.
      *
-     * @param func the function to invoke
+     * @param func the function to wrap
      * @param sync the object to synchronize on
      * @return a synchronizing wrapper function
      */
-    public static Object makeSynchronizedFunction(final ScriptFunction func, final Object sync) {
-        return func.makeSynchronizedFunction(sync);
+    public static Object makeSynchronizedFunction(final Object func, final Object sync) {
+        if (func instanceof ScriptFunction) {
+           return ((ScriptFunction)func).makeSynchronizedFunction(sync);
+        }
+        throw typeError("not.a.function", ScriptRuntime.safeToString(func));
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/api/scripting/resources/engine.js	Wed Jul 05 19:48:51 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- */
-
-/**
- * This script file is executed by script engine at the construction
- * of the every new Global object. The functions here assume global variables
- * "context" of type javax.script.ScriptContext and "engine" of the type
- * jdk.nashorn.api.scripting.NashornScriptEngine.
- **/
-
-Object.defineProperty(this, "__noSuchProperty__", {
-    configurable: true,
-    enumerable: false,
-    writable: true,
-    value: function (name) {
-        'use strict';
-        return engine.__noSuchProperty__(this, context, name);
-    }
-});
-
-function print() {
-    var writer = context != null? context.writer : engine.context.writer;
-    if (! (writer instanceof java.io.PrintWriter)) {
-        writer = new java.io.PrintWriter(writer);
-    }
-    
-    var buf = new java.lang.StringBuilder();
-    for (var i = 0; i < arguments.length; i++) {
-        if (i != 0) {
-            buf.append(' ');
-        }
-        buf.append(String(arguments[i]));
-    }
-    writer.println(buf.toString());
-}
-
-/**
- * This is C-like printf
- *
- * @param format string to format the rest of the print items
- * @param args variadic argument list
- */
-Object.defineProperty(this, "printf", {
-    configurable: true,
-    enumerable: false,
-    writable: true,
-    value: function (format, args/*, more args*/) {
-        print(sprintf.apply(this, arguments));
-    }
-});
-
-/**
- * This is C-like sprintf
- *
- * @param format string to format the rest of the print items
- * @param args variadic argument list
- */
-Object.defineProperty(this, "sprintf", {
-    configurable: true,
-    enumerable: false,
-    writable: true,
-    value: function (format, args/*, more args*/) {
-        var len = arguments.length - 1;
-        var array = [];
-
-        if (len < 0) {
-            return "";
-        }
-
-        for (var i = 0; i < len; i++) {
-            if (arguments[i+1] instanceof Date) {
-                array[i] = arguments[i+1].getTime();
-            } else {
-                array[i] = arguments[i+1];
-            }
-        }
-
-        array = Java.to(array);
-        return Packages.jdk.nashorn.api.scripting.ScriptUtils.format(format, array);
-    }
-});
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Wed Jul 05 19:50:06 2017 +0200
@@ -1317,20 +1317,14 @@
 
                         // Load up self (scope).
                         method.loadCompilerConstant(SCOPE);
-                        final CallNode.EvalArgs evalArgs = callNode.getEvalArgs();
+                        final List<Expression> evalArgs = callNode.getEvalArgs().getArgs();
                         // load evaluated code
-                        loadExpressionAsObject(evalArgs.getCode());
+                        loadExpressionAsObject(evalArgs.get(0));
                         // load second and subsequent args for side-effect
-                        final List<Expression> callArgs = callNode.getArgs();
-                        final int numArgs = callArgs.size();
+                        final int numArgs = evalArgs.size();
                         for (int i = 1; i < numArgs; i++) {
-                            loadExpressionUnbounded(callArgs.get(i)).pop();
+                            loadAndDiscard(evalArgs.get(i));
                         }
-                        // special/extra 'eval' arguments
-                        loadExpressionUnbounded(evalArgs.getThis());
-                        method.load(evalArgs.getLocation());
-                        method.load(evalArgs.getStrictMode());
-                        method.convert(Type.OBJECT);
                         method._goto(invoke_direct_eval);
 
                         method.label(is_not_eval);
@@ -1339,7 +1333,7 @@
                         // This is some scope 'eval' or global eval replaced by user
                         // but not the built-in ECMAScript 'eval' function call
                         method.loadNull();
-                        argsCount = loadArgs(callArgs);
+                        argsCount = loadArgs(callNode.getArgs());
                     }
 
                     @Override
@@ -1349,6 +1343,11 @@
                         method._goto(eval_done);
 
                         method.label(invoke_direct_eval);
+                        // Special/extra 'eval' arguments. These can be loaded late (in consumeStack) as we know none of
+                        // them can ever be optimistic.
+                        method.loadCompilerConstant(THIS);
+                        method.load(callNode.getEvalArgs().getLocation());
+                        method.load(CodeGenerator.this.lc.getCurrentFunction().isStrict());
                         // direct call to Global.directEval
                         globalDirectEval();
                         convertOptimisticReturnValue();
@@ -4438,7 +4437,7 @@
 
     private MethodEmitter globalDirectEval() {
         return method.invokestatic(GLOBAL_OBJECT, "directEval",
-                methodDescriptor(Object.class, Object.class, Object.class, Object.class, Object.class, Object.class));
+                methodDescriptor(Object.class, Object.class, Object.class, Object.class, Object.class, boolean.class));
     }
 
     private abstract class OptimisticOperation {
--- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Wed Jul 05 19:50:06 2017 +0200
@@ -27,7 +27,6 @@
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.EVAL;
 import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
-import static jdk.nashorn.internal.codegen.CompilerConstants.THIS;
 import static jdk.nashorn.internal.ir.Expression.isAlwaysTrue;
 
 import java.util.ArrayList;
@@ -603,13 +602,11 @@
 
             // 'eval' call with at least one argument
             if (args.size() >= 1 && EVAL.symbolName().equals(callee.getName())) {
-                final FunctionNode currentFunction = lc.getCurrentFunction();
-                return callNode.setEvalArgs(
-                    new CallNode.EvalArgs(
-                        (Expression)ensureUniqueNamesIn(args.get(0)).accept(this),
-                        compilerConstant(THIS),
-                        evalLocation(callee),
-                        currentFunction.isStrict()));
+                final List<Expression> evalArgs = new ArrayList<>(args.size());
+                for(final Expression arg: args) {
+                    evalArgs.add((Expression)ensureUniqueNamesIn(arg).accept(this));
+                }
+                return callNode.setEvalArgs(new CallNode.EvalArgs(evalArgs, evalLocation(callee)));
             }
         }
 
--- a/nashorn/src/jdk/nashorn/internal/ir/CallNode.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/ir/CallNode.java	Wed Jul 05 19:50:06 2017 +0200
@@ -65,61 +65,35 @@
      * Arguments to be passed to builtin {@code eval} function
      */
     public static class EvalArgs {
-        /** evaluated code */
-        private final Expression code;
-
-        /** 'this' passed to evaluated code */
-        private final IdentNode evalThis;
+        private final List<Expression> args;
 
         /** location string for the eval call */
         private final String location;
 
-        /** is this call from a strict context? */
-        private final boolean strictMode;
-
         /**
          * Constructor
          *
-         * @param code       code to evaluate
-         * @param evalThis   this node
-         * @param location   location for the eval call
-         * @param strictMode is this a call from a strict context?
+         * @param args     arguments to eval
+         * @param location location for the eval call
          */
-        public EvalArgs(final Expression code, final IdentNode evalThis, final String location, final boolean strictMode) {
-            this.code = code;
-            this.evalThis = evalThis;
+        public EvalArgs(final List<Expression> args, final String location) {
+            this.args = args;
             this.location = location;
-            this.strictMode = strictMode;
         }
 
         /**
          * Return the code that is to be eval:ed by this eval function
          * @return code as an AST node
          */
-        public Expression getCode() {
-            return code;
-        }
-
-        private EvalArgs setCode(final Expression code) {
-            if (this.code == code) {
-                return this;
-            }
-            return new EvalArgs(code, evalThis, location, strictMode);
+        public List<Expression> getArgs() {
+            return Collections.unmodifiableList(args);
         }
 
-        /**
-         * Get the {@code this} symbol used to invoke this eval call
-         * @return the {@code this} symbol
-         */
-        public IdentNode getThis() {
-            return this.evalThis;
-        }
-
-        private EvalArgs setThis(final IdentNode evalThis) {
-            if (this.evalThis == evalThis) {
+        private EvalArgs setArgs(final List<Expression> args) {
+            if (this.args == args) {
                 return this;
             }
-            return new EvalArgs(code, evalThis, location, strictMode);
+            return new EvalArgs(args, location);
         }
 
         /**
@@ -129,14 +103,6 @@
         public String getLocation() {
             return this.location;
         }
-
-        /**
-         * Check whether this eval call is executed in strict mode
-         * @return true if executed in strict mode, false otherwise
-         */
-        public boolean getStrictMode() {
-            return this.strictMode;
-        }
     }
 
     /** arguments for 'eval' call. Non-null only if this call node is 'eval' */
@@ -212,8 +178,7 @@
                     setArgs(Node.accept(visitor, Expression.class, args)).
                     setEvalArgs(evalArgs == null ?
                             null :
-                            evalArgs.setCode((Expression)evalArgs.getCode().accept(visitor)).
-                                setThis((IdentNode)evalArgs.getThis().accept(visitor))));
+                            evalArgs.setArgs(Node.accept(visitor, Expression.class, evalArgs.getArgs()))));
             // Theoretically, we'd need to instead pass lc to every setter and do a replacement on each. In practice,
             // setType from TypeOverride can't accept a lc, and we don't necessarily want to go there now.
             if (this != newCallNode) {
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Wed Jul 05 19:50:06 2017 +0200
@@ -27,6 +27,7 @@
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
+import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 
@@ -45,8 +46,11 @@
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicReference;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import jdk.nashorn.internal.codegen.ApplySpecialization;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.lookup.Lookup;
@@ -107,6 +111,10 @@
     /** Name invalidator for things like call/apply */
     public static final Call BOOTSTRAP = staticCall(MethodHandles.lookup(), Global.class, "invalidateNameBootstrap", CallSite.class, MethodHandles.Lookup.class, String.class, MethodType.class);
 
+    /** Nashorn extension: arguments array */
+    @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE)
+    public Object arguments;
+
     /** ECMA 15.1.2.2 parseInt (string , radix) */
     @Property(attributes = Attribute.NOT_ENUMERABLE)
     public Object parseInt;
@@ -411,12 +419,13 @@
     // Used to store the last RegExp result to support deprecated RegExp constructor properties
     private RegExpResult lastRegExpResult;
 
-    private static final MethodHandle EVAL              = findOwnMH_S("eval",              Object.class, Object.class, Object.class);
-    private static final MethodHandle PRINT             = findOwnMH_S("print",             Object.class, Object.class, Object[].class);
-    private static final MethodHandle PRINTLN           = findOwnMH_S("println",           Object.class, Object.class, Object[].class);
-    private static final MethodHandle LOAD              = findOwnMH_S("load",              Object.class, Object.class, Object.class);
-    private static final MethodHandle LOADWITHNEWGLOBAL = findOwnMH_S("loadWithNewGlobal", Object.class, Object.class, Object[].class);
-    private static final MethodHandle EXIT              = findOwnMH_S("exit",              Object.class, Object.class, Object.class);
+    private static final MethodHandle EVAL              = findOwnMH_S("eval",                Object.class, Object.class, Object.class);
+    private static final MethodHandle NO_SUCH_PROPERTY  = findOwnMH_S(NO_SUCH_PROPERTY_NAME, Object.class, Object.class, Object.class);
+    private static final MethodHandle PRINT             = findOwnMH_S("print",               Object.class, Object.class, Object[].class);
+    private static final MethodHandle PRINTLN           = findOwnMH_S("println",             Object.class, Object.class, Object[].class);
+    private static final MethodHandle LOAD              = findOwnMH_S("load",                Object.class, Object.class, Object.class);
+    private static final MethodHandle LOADWITHNEWGLOBAL = findOwnMH_S("loadWithNewGlobal",   Object.class, Object.class, Object[].class);
+    private static final MethodHandle EXIT              = findOwnMH_S("exit",                Object.class, Object.class, Object.class);
 
     /** Invalidate a reserved name, such as "apply" or "call" if assigned */
     public MethodHandle INVALIDATE_RESERVED_NAME = MH.bindTo(findOwnMH_V("invalidateReservedName", void.class, String.class), this);
@@ -427,6 +436,20 @@
     // context to which this global belongs to
     private final Context context;
 
+    // current ScriptContext to use - can be null.
+    private ScriptContext scontext;
+    // associated Property object for "context" property.
+    private jdk.nashorn.internal.runtime.Property scontextProperty;
+
+    /**
+     * Set the current script context
+     * @param scontext script context
+     */
+    public void setScriptContext(final ScriptContext scontext) {
+        this.scontext = scontext;
+        scontextProperty.setValue(this, this, scontext, false);
+    }
+
     // global constants for this global - they can be replaced with MethodHandle.constant until invalidated
     private static AtomicReference<GlobalConstants> gcsInstance = new AtomicReference<>();
 
@@ -447,12 +470,7 @@
         // null check on context
         context.getClass();
 
-        /*
-         * Duplicate global's map and use it. This way the initial Map filled
-         * by nasgen (referenced from static field in this class) is retained
-         * 'as is' (as that one is process wide singleton.
-         */
-        return $nasgenmap$.duplicate();
+        return $nasgenmap$;
     }
 
     /**
@@ -483,6 +501,10 @@
         return global;
     }
 
+    private static Global instanceFrom(final Object self) {
+        return self instanceof Global? (Global)self : instance();
+    }
+
     /**
      * Return the global constants map for fields that
      * can be accessed as MethodHandle.constant
@@ -542,13 +564,13 @@
      * as well as our extension builtin objects like "Java", "JSAdapter" as properties
      * of the global scope object.
      */
-    public void initBuiltinObjects() {
+    public void initBuiltinObjects(final ScriptEngine engine) {
         if (this.builtinObject != null) {
             // already initialized, just return
             return;
         }
 
-        init();
+        init(engine);
     }
 
     /**
@@ -849,6 +871,32 @@
     }
 
     /**
+     * Hook to search missing variables in ScriptContext if available
+     * @param self used to detect if scope call or not (this function is 'strict')
+     * @param name name of the variable missing
+     * @return value of the missing variable or undefined (or TypeError for scope search)
+     */
+    public static Object __noSuchProperty__(final Object self, final Object name) {
+        final Global global = Global.instance();
+        final ScriptContext sctxt = global.scontext;
+        final String nameStr = name.toString();
+
+        if (sctxt != null) {
+            final int scope = sctxt.getAttributesScope(nameStr);
+            if (scope != -1) {
+                return ScriptObjectMirror.unwrap(sctxt.getAttribute(nameStr, scope), global);
+            }
+        }
+
+        if (self == UNDEFINED) {
+            // scope access and so throw ReferenceError
+            throw referenceError(global, "not.defined", nameStr);
+        }
+
+        return UNDEFINED;
+    }
+
+    /**
      * This is the eval used when 'indirect' eval call is made.
      *
      * var global = this;
@@ -860,7 +908,7 @@
      * @return the result of eval
      */
     public static Object eval(final Object self, final Object str) {
-        return directEval(self, str, UNDEFINED, UNDEFINED, UNDEFINED);
+        return directEval(self, str, UNDEFINED, UNDEFINED, false);
     }
 
     /**
@@ -876,14 +924,14 @@
      *
      * This is directly invoked from generated when eval(code) is called in user code
      */
-    public static Object directEval(final Object self, final Object str, final Object callThis, final Object location, final Object strict) {
+    public static Object directEval(final Object self, final Object str, final Object callThis, final Object location, final boolean strict) {
         if (!(str instanceof String || str instanceof ConsString)) {
             return str;
         }
-        final Global global = Global.instance();
+        final Global global = Global.instanceFrom(self);
         final ScriptObject scope = self instanceof ScriptObject ? (ScriptObject)self : global;
 
-        return global.getContext().eval(scope, str.toString(), callThis, location, Boolean.TRUE.equals(strict), true);
+        return global.getContext().eval(scope, str.toString(), callThis, location, strict, true);
     }
 
     /**
@@ -895,7 +943,7 @@
      * @return result of print (undefined)
      */
     public static Object print(final Object self, final Object... objects) {
-        return printImpl(false, objects);
+        return Global.instanceFrom(self).printImpl(false, objects);
     }
 
     /**
@@ -907,7 +955,7 @@
      * @return result of println (undefined)
      */
     public static Object println(final Object self, final Object... objects) {
-        return printImpl(true, objects);
+        return Global.instanceFrom(self).printImpl(true, objects);
     }
 
     /**
@@ -921,7 +969,7 @@
      * @throws IOException if source could not be read
      */
     public static Object load(final Object self, final Object source) throws IOException {
-        final Global global = Global.instance();
+        final Global global = Global.instanceFrom(self);
         final ScriptObject scope = self instanceof ScriptObject ? (ScriptObject)self : global;
         return global.getContext().load(scope, source);
     }
@@ -937,7 +985,7 @@
      * @throws IOException if source could not be read
      */
     public static Object loadWithNewGlobal(final Object self, final Object...args) throws IOException {
-        final Global global = Global.instance();
+        final Global global = Global.instanceFrom(self);
         final int length = args.length;
         final boolean hasArgs = 0 < length;
         final Object from = hasArgs ? args[0] : UNDEFINED;
@@ -1604,7 +1652,7 @@
         splitState = state;
     }
 
-    private void init() {
+    private void init(final ScriptEngine engine) {
         assert Context.getGlobal() == this : "this global is not set as current";
 
         final ScriptEnvironment env = getContext().getEnv();
@@ -1705,12 +1753,19 @@
         copyBuiltins();
 
         // expose script (command line) arguments as "arguments" property of global
-        final Object argumentsObject = wrapAsObject(env.getArguments().toArray());
-        final int    argumentsFlags  = Attribute.NOT_ENUMERABLE;
-        addOwnProperty("arguments", argumentsFlags, argumentsObject);
+        arguments = wrapAsObject(env.getArguments().toArray());
         if (env._scripting) {
             // synonym for "arguments" in scripting mode
-            addOwnProperty("$ARG", argumentsFlags, argumentsObject);
+            addOwnProperty("$ARG", Attribute.NOT_ENUMERABLE, arguments);
+        }
+
+        if (engine != null) {
+            final int NOT_ENUMERABLE_NOT_CONFIG = Attribute.NOT_ENUMERABLE | Attribute.NOT_CONFIGURABLE;
+            scontextProperty = addOwnProperty("context", NOT_ENUMERABLE_NOT_CONFIG, null);
+            addOwnProperty("engine", NOT_ENUMERABLE_NOT_CONFIG, engine);
+            // __noSuchProperty__ hook for ScriptContext search of missing variables
+            final ScriptFunction noSuchProp = ScriptFunctionImpl.makeStrictFunction(NO_SUCH_PROPERTY_NAME, NO_SUCH_PROPERTY);
+            addOwnProperty(NO_SUCH_PROPERTY_NAME, Attribute.NOT_ENUMERABLE, noSuchProp);
         }
     }
 
@@ -1878,8 +1933,8 @@
         this.addOwnProperty("Debug", Attribute.NOT_ENUMERABLE, initConstructor("Debug"));
     }
 
-    private static Object printImpl(final boolean newLine, final Object... objects) {
-        final PrintWriter out = Global.getEnv().getOut();
+    private Object printImpl(final boolean newLine, final Object... objects) {
+        final PrintWriter out = scontext != null? new PrintWriter(scontext.getWriter()) : getContext().getEnv().getOut();
         final StringBuilder sb = new StringBuilder();
 
         for (final Object object : objects) {
@@ -2023,12 +2078,11 @@
 
         for (final jdk.nashorn.internal.runtime.Property property : properties) {
             final Object key   = property.getKey();
-            final Object value = ObjectPrototype.get(key);
-
             if (key.equals("constructor")) {
                 continue;
             }
 
+            final Object value = ObjectPrototype.get(key);
             if (value instanceof ScriptFunction) {
                 final ScriptFunction func = (ScriptFunction)value;
                 final ScriptObject prototype = ScriptFunction.getPrototype(func);
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Wed Jul 05 19:50:06 2017 +0200
@@ -222,7 +222,6 @@
         out.println("ScriptFunction allocations " + ScriptFunction.getAllocations());
         out.println("PropertyMap count " + PropertyMap.getCount());
         out.println("PropertyMap cloned " + PropertyMap.getClonedCount());
-        out.println("PropertyMap duplicated " + PropertyMap.getDuplicatedCount());
         out.println("PropertyMap history hit " + PropertyMap.getHistoryHit());
         out.println("PropertyMap proto invalidations " + PropertyMap.getProtoInvalidations());
         out.println("PropertyMap proto history hit " + PropertyMap.getProtoHistoryHit());
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java	Wed Jul 05 19:50:06 2017 +0200
@@ -36,6 +36,7 @@
 import jdk.internal.dynalink.beans.StaticClass;
 import jdk.internal.dynalink.support.TypeUtilities;
 import jdk.nashorn.api.scripting.JSObject;
+import jdk.nashorn.api.scripting.ScriptUtils;
 import jdk.nashorn.internal.objects.annotations.Attribute;
 import jdk.nashorn.internal.objects.annotations.Function;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
@@ -45,6 +46,7 @@
 import jdk.nashorn.internal.runtime.ListAdapter;
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptObject;
+import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory;
@@ -80,6 +82,73 @@
     }
 
     /**
+     * Returns synchronized wrapper version of the given ECMAScript function.
+     * @param self not used
+     * @param func the ECMAScript function whose synchronized version is returned.
+     * @param obj the object (i.e, lock) on which the function synchronizes.
+     * @return synchronized wrapper version of the given ECMAScript function.
+     */
+    @Function(name="synchronized", attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static Object synchronizedFunc(final Object self, final Object func, final Object obj) {
+        return ScriptUtils.makeSynchronizedFunction(func, obj);
+    }
+
+    /**
+     * Returns true if the specified object is a Java method.
+     * @param self not used
+     * @param obj the object that is checked if it is a Java method object or not
+     * @return tells whether given object is a Java method object or not.
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static boolean isJavaMethod(final Object self, final Object obj) {
+        return Bootstrap.isDynamicMethod(obj);
+    }
+
+    /**
+     * Returns true if the specified object is a java function (but not script function)
+     * @param self not used
+     * @param obj the object that is checked if it is a Java function or not
+     * @return tells whether given object is a Java function or not
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static boolean isJavaFunction(final Object self, final Object obj) {
+        return Bootstrap.isCallable(obj) && !(obj instanceof ScriptFunction);
+    }
+
+    /**
+     * Returns true if the specified object is a Java object but not a script object
+     * @param self not used
+     * @param obj the object that is checked
+     * @return tells whether given object is a Java object but not a script object
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static boolean isJavaObject(final Object self, final Object obj) {
+        return obj != null && !(obj instanceof ScriptObject);
+    }
+
+    /**
+     * Returns true if the specified object is a ECMAScript object, that is an instance of {@link ScriptObject}.
+     * @param self not used
+     * @param obj the object that is checked if it is a ECMAScript object or not
+     * @return tells whether given object is a ECMAScript object or not.
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static boolean isScriptObject(final Object self, final Object obj) {
+        return obj instanceof ScriptObject;
+    }
+
+    /**
+     * Returns true if the specified object is a ECMAScript function, that is an instance of {@link ScriptFunction}.
+     * @param self not used
+     * @param obj the object that is checked if it is a ECMAScript function or not
+     * @return tells whether given object is a ECMAScript function or not.
+     */
+    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
+    public static boolean isScriptFunction(final Object self, final Object obj) {
+        return obj instanceof ScriptFunction;
+    }
+
+    /**
      * <p>
      * Given a name of a Java type, returns an object representing that type in Nashorn. The Java class of the objects
      * used to represent Java types in Nashorn is not {@link java.lang.Class} but rather {@link StaticClass}. They are
--- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Wed Jul 05 19:50:06 2017 +0200
@@ -184,6 +184,15 @@
         return new AnonymousFunction();
     }
 
+    private static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs, final int flags) {
+        final ScriptFunctionImpl func = new ScriptFunctionImpl(name, methodHandle, null, specs, flags);
+        func.setPrototype(UNDEFINED);
+        // Non-constructor built-in functions do not have "prototype" property
+        func.deleteOwnProperty(func.getMap().findProperty("prototype"));
+
+        return func;
+    }
+
     /**
      * Factory method for non-constructor built-in functions
      *
@@ -193,12 +202,18 @@
      * @return new ScriptFunction
      */
     static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final MethodHandle[] specs) {
-        final ScriptFunctionImpl func = new ScriptFunctionImpl(name, methodHandle, null, specs, ScriptFunctionData.IS_BUILTIN);
-        func.setPrototype(UNDEFINED);
-        // Non-constructor built-in functions do not have "prototype" property
-        func.deleteOwnProperty(func.getMap().findProperty("prototype"));
+        return makeFunction(name, methodHandle, specs, ScriptFunctionData.IS_BUILTIN);
+    }
 
-        return func;
+    /**
+     * Factory method for non-constructor built-in, strict functions
+     *
+     * @param name   function name
+     * @param methodHandle handle for invocation
+     * @return new ScriptFunction
+     */
+    static ScriptFunction makeStrictFunction(final String name, final MethodHandle methodHandle) {
+        return makeFunction(name, methodHandle, null, ScriptFunctionData.IS_BUILTIN | ScriptFunctionData.IS_STRICT );
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Wed Jul 05 19:50:06 2017 +0200
@@ -62,6 +62,7 @@
 import java.util.function.Consumer;
 import java.util.function.Supplier;
 import java.util.logging.Level;
+import javax.script.ScriptEngine;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
 import jdk.nashorn.api.scripting.ScriptObjectMirror;
@@ -954,16 +955,17 @@
      * Initialize given global scope object.
      *
      * @param global the global
+     * @param engine the associated ScriptEngine instance, can be null
      * @return the initialized global scope object.
      */
-    public Global initGlobal(final Global global) {
+    public Global initGlobal(final Global global, final ScriptEngine engine) {
         // Need only minimal global object, if we are just compiling.
         if (!env._compile_only) {
             final Global oldGlobal = Context.getGlobal();
             try {
                 Context.setGlobal(global);
                 // initialize global scope with builtin global objects
-                global.initBuiltinObjects();
+                global.initBuiltinObjects(engine);
             } finally {
                 Context.setGlobal(oldGlobal);
             }
@@ -973,6 +975,16 @@
     }
 
     /**
+     * Initialize given global scope object.
+     *
+     * @param global the global
+     * @return the initialized global scope object.
+     */
+    public Global initGlobal(final Global global) {
+        return initGlobal(global, null);
+    }
+
+    /**
      * Return the current global's context
      * @return current global's context
      */
--- a/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ECMAErrors.java	Wed Jul 05 19:50:06 2017 +0200
@@ -405,12 +405,8 @@
         // Look for script package in class name (into which compiler puts generated code)
         if (className.startsWith(scriptPackage) && !CompilerConstants.isInternalMethodName(frame.getMethodName())) {
             final String source = frame.getFileName();
-            /*
-             * Make sure that it is not some Java code that Nashorn has in that package!
-             * also, we don't want to report JavaScript code that lives in script engine implementation
-             * We want to report only user's own scripts and not any of our own scripts like "engine.js"
-             */
-            return source != null && !source.endsWith(".java") && !source.contains(NashornException.ENGINE_SCRIPT_SOURCE_NAME);
+            // Make sure that it is not some Java code that Nashorn has in that package!
+            return source != null && !source.endsWith(".java");
         }
         return false;
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Wed Jul 05 19:50:06 2017 +0200
@@ -145,21 +145,6 @@
         this(propertyMap, propertyMap.properties);
     }
 
-    /**
-     * Duplicates this PropertyMap instance. This is used to duplicate 'shared'
-     * maps {@link PropertyMap} used as process wide singletons. Shared maps are
-     * duplicated for every global scope object. That way listeners, proto and property
-     * histories are scoped within a global scope.
-     *
-     * @return Duplicated {@link PropertyMap}.
-     */
-    public PropertyMap duplicate() {
-        if (Context.DEBUG) {
-            duplicatedCount++;
-        }
-        return new PropertyMap(this.properties, this.className, 0, 0, 0, containsArrayKeys());
-    }
-
     private void writeObject(final ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
         out.writeObject(properties.getProperties());
@@ -968,7 +953,6 @@
     // counters updated only in debug mode
     private static int count;
     private static int clonedCount;
-    private static int duplicatedCount;
     private static int historyHit;
     private static int protoInvalidations;
     private static int protoHistoryHit;
@@ -989,13 +973,6 @@
     }
 
     /**
-     * @return The number of maps that are duplicated.
-     */
-    public static int getDuplicatedCount() {
-        return duplicatedCount;
-    }
-
-    /**
      * @return The number of times history was successfully used.
      */
     public static int getHistoryHit() {
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Wed Jul 05 19:50:06 2017 +0200
@@ -103,10 +103,10 @@
     public static final String PROTO_PROPERTY_NAME   = "__proto__";
 
     /** Search fall back routine name for "no such method" */
-    static final String NO_SUCH_METHOD_NAME   = "__noSuchMethod__";
+    public static final String NO_SUCH_METHOD_NAME   = "__noSuchMethod__";
 
     /** Search fall back routine name for "no such property" */
-    static final String NO_SUCH_PROPERTY_NAME = "__noSuchProperty__";
+    public static final String NO_SUCH_PROPERTY_NAME = "__noSuchProperty__";
 
     /** Per ScriptObject flag - is this a scope object? */
     public static final int IS_SCOPE       = 1 << 0;
@@ -160,7 +160,8 @@
     static final MethodHandle GLOBALFILTER       = findOwnMH_S("globalFilter", Object.class, Object.class);
 
     private static final MethodHandle TRUNCATINGFILTER   = findOwnMH_S("truncatingFilter", Object[].class, int.class, Object[].class);
-    private static final MethodHandle KNOWNFUNCPROPGUARD = findOwnMH_S("knownFunctionPropertyGuard", boolean.class, Object.class, PropertyMap.class, MethodHandle.class, Object.class, ScriptFunction.class);
+    private static final MethodHandle KNOWNFUNCPROPGUARDSELF = findOwnMH_S("knownFunctionPropertyGuardSelf", boolean.class, Object.class, PropertyMap.class, MethodHandle.class, ScriptFunction.class);
+    private static final MethodHandle KNOWNFUNCPROPGUARDPROTO = findOwnMH_S("knownFunctionPropertyGuardProto", boolean.class, Object.class, PropertyMap.class, MethodHandle.class, int.class, ScriptFunction.class);
 
     private static final ArrayList<MethodHandle> PROTO_FILTERS = new ArrayList<>();
 
@@ -2271,13 +2272,20 @@
                 if (scopeAccess && func.isStrict()) {
                     mh = bindTo(mh, UNDEFINED);
                 }
+
                 return new GuardedInvocation(
                         mh,
-                        //TODO this always does a scriptobject check
-                        getKnownFunctionPropertyGuard(
+                        find.isSelf()?
+                            getKnownFunctionPropertyGuardSelf(
                                 getMap(),
                                 find.getGetter(Object.class, INVALID_PROGRAM_POINT),
-                                find.getOwner(),
+                                func)
+                            :
+                            //TODO this always does a scriptobject check
+                            getKnownFunctionPropertyGuardProto(
+                                getMap(),
+                                find.getGetter(Object.class, INVALID_PROGRAM_POINT),
+                                find.getProtoChainLength(),
                                 func),
                         getProtoSwitchPoint(NO_SUCH_PROPERTY_NAME, find.getOwner()),
                         //TODO this doesn't need a ClassCastException as guard always checks script object
@@ -3595,15 +3603,51 @@
         return MH.findStatic(MethodHandles.lookup(), ScriptObject.class, name, MH.type(rtype, types));
     }
 
-    private static MethodHandle getKnownFunctionPropertyGuard(final PropertyMap map, final MethodHandle getter, final Object where, final ScriptFunction func) {
-        return MH.insertArguments(KNOWNFUNCPROPGUARD, 1, map, getter, where, func);
+    private static MethodHandle getKnownFunctionPropertyGuardSelf(final PropertyMap map, final MethodHandle getter, final ScriptFunction func) {
+        return MH.insertArguments(KNOWNFUNCPROPGUARDSELF, 1, map, getter, func);
     }
 
     @SuppressWarnings("unused")
-    private static boolean knownFunctionPropertyGuard(final Object self, final PropertyMap map, final MethodHandle getter, final Object where, final ScriptFunction func) {
+    private static boolean knownFunctionPropertyGuardSelf(final Object self, final PropertyMap map, final MethodHandle getter, final ScriptFunction func) {
         if (self instanceof ScriptObject && ((ScriptObject)self).getMap() == map) {
             try {
-                return getter.invokeExact(where) == func;
+                return getter.invokeExact(self) == func;
+            } catch (final RuntimeException | Error e) {
+                throw e;
+            } catch (final Throwable t) {
+                throw new RuntimeException(t);
+            }
+        }
+
+        return false;
+    }
+
+    private static MethodHandle getKnownFunctionPropertyGuardProto(final PropertyMap map, final MethodHandle getter, final int depth, final ScriptFunction func) {
+        return MH.insertArguments(KNOWNFUNCPROPGUARDPROTO, 1, map, getter, depth, func);
+    }
+
+    @SuppressWarnings("unused")
+    private static ScriptObject getProto(final ScriptObject self, final int depth) {
+        ScriptObject proto = self;
+        for (int d = 0; d < depth; d++) {
+            proto = proto.getProto();
+            if (proto == null) {
+                return null;
+            }
+        }
+
+        return proto;
+    }
+
+    @SuppressWarnings("unused")
+    private static boolean knownFunctionPropertyGuardProto(final Object self, final PropertyMap map, final MethodHandle getter, final int depth, final ScriptFunction func) {
+        if (self instanceof ScriptObject && ((ScriptObject)self).getMap() == map) {
+            final ScriptObject proto = getProto((ScriptObject)self, depth);
+            if (proto == null) {
+                return false;
+            }
+            try {
+                return getter.invokeExact((Object)proto) == func;
             } catch (final RuntimeException | Error e) {
                 throw e;
             } catch (final Throwable t) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java	Wed Jul 05 19:50:06 2017 +0200
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.runtime.linker;
 
+import java.util.Objects;
 import jdk.internal.dynalink.beans.BeansLinker;
 
 /**
@@ -48,4 +49,9 @@
     Object getBoundThis() {
         return boundThis;
     }
+
+    @Override
+    public String toString() {
+        return dynamicMethod.toString() + " on " + Objects.toString(boundThis);
+    }
 }
--- a/nashorn/test/script/basic/JDK-8047057.js	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/test/script/basic/JDK-8047057.js	Wed Jul 05 19:50:06 2017 +0200
@@ -49,7 +49,7 @@
 makeFuncAndCall("L: { { break L; } return; }");
 makeFuncAndCall("L: { while(0) break L; return; }");
 makeFuncExpectError("L: {while(0) break L; return [](); }", TypeError);
-// makeFuncAndCall("do with({}) break ; while(0);");
+makeFuncAndCall("do with({}) break ; while(0);");
 makeFuncAndCall("while(0) with({}) continue ;");
 makeFuncAndCall("eval([]);");
 makeFuncAndCall("try{} finally{[]}");
@@ -59,10 +59,10 @@
 makeFuncAndCall("try { var x = 1, x = null; } finally { }");
 makeFuncAndCall("try { var x = {}, x = []; } catch(x3) { }");
 makeFuncAndCall("[delete this]");
-// makeFuncAndCall("if(eval('', eval('', function() {}))) { }");
-// makeFuncAndCall("if(eval('', eval('', function() {}))) { }");
-// makeFuncAndCall("eval(\"[,,];\", [11,12,13,14].some)");
-// makeFuncAndCall("eval(\"1.2e3\", ({})[ /x/ ])");
+makeFuncAndCall("if(eval('', eval('', function() {}))) { }");
+makeFuncAndCall("if(eval('', eval('', function() {}))) { }");
+makeFuncAndCall("eval(\"[,,];\", [11,12,13,14].some)");
+makeFuncAndCall("eval(\"1.2e3\", ({})[ /x/ ])");
 makeFuncExpectError("eval(\"x4\", x3);", ReferenceError);
 makeFuncAndCall("with({5.0000000000000000000000: String()}){(false); }");
 makeFuncAndCall("try { var x = undefined, x = 5.0000000000000000000000; } catch(x) { x = undefined; }");
@@ -72,4 +72,4 @@
 makeFuncAndCall("with({8: 'fafafa'.replace()}){ }");
 makeFuncAndCall("(function (x) '' )(true)");
 makeFuncExpectError("new eval(function(){})", TypeError);
-//** makeFuncAndCall('eval("23", ({})[/x/])');
+makeFuncAndCall('eval("23", ({})[/x/])');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8047067.js	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8047067: all eval arguments need to be copied in Lower
+ *
+ * @test
+ * @run
+ */
+
+// The second expression triggers optimistic deoptimization, and if not
+// all eval arguments were copied in Lower, we'd end up with duplicate
+// program points that'd cause incorrect continuation program point in
+// the rest-of, and therefore a bad stack, and therefore an AIOOBE in
+// the continuation setup code.
+eval("23", ({})[/x/]) 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8049086.js	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8049086: Minor API convenience functions on "Java" object
+ *
+ * @test
+ * @run
+ */
+
+var System = Java.type("java.lang.System");
+var out = System.out;
+var println = out.println;
+var getProperty = System.getProperty;
+var File = Java.type("java.io.File")["(String)"];
+
+print("println is java method? " + Java.isJavaMethod(println));
+print("println is script function? " + Java.isScriptFunction(println));
+print("getProperty is java method? " + Java.isJavaMethod(getProperty));
+print("getProperty is script function? " + Java.isScriptFunction(getProperty));
+print("File is java method? " + Java.isJavaMethod(File));
+print("File is script function? " + Java.isScriptFunction(File));
+
+print("eval is script function? " + Java.isScriptFunction(eval));
+print("eval is java method? " + Java.isJavaMethod(eval));
+function hello() {}
+print("hello is script function? " + Java.isScriptFunction(hello));
+print("hello is java method? " + Java.isJavaMethod(hello));
+
+print("out is script object? " + Java.isScriptObject(out));
+print("System is script object? " + Java.isScriptObject(System));
+print("Object is script object? " + Java.isScriptObject(Object));
+print("{} is script object? " + Java.isScriptObject({}));
+print("/foo/ is script object? " + Java.isScriptObject(/foo/));
+
+// Java function is anything whose 'typeof' is 'function' but it is not
+// a script function! This includes:
+// (a) Java methods (b) Java classes (as these respond to new)
+// (c) FunctionalInterface objects (d) JSObjects that are 'functions'
+
+print("java.awt.Color is java function? " + Java.isJavaFunction(java.awt.Color));
+print("java.lang.Runnable instance is java function? " 
+    + Java.isJavaFunction(new java.lang.Runnable(function() {})));
+print("eval is java function? " + Java.isJavaFunction(eval));
+print("println is java function? " + Java.isJavaFunction(println));
+print("getProperty is java function? " + Java.isJavaFunction(getProperty));
+
+var JSObject = Java.type("jdk.nashorn.api.scripting.JSObject");
+print("callable JSObject is function? " +
+    Java.isJavaFunction(new JSObject() {
+        isFunction: function() true,
+        call: function() {}
+    })
+);
+
+print("Non callable JSObject is function? " +
+    Java.isJavaFunction(new JSObject() {
+        isFunction: function() false,
+    })
+);
+
+// synchronized function
+var lock = new java.lang.Object();
+
+print("lock is java object? " + Java.isJavaObject(lock));
+print("eval is java object? " + Java.isJavaObject(eval));
+print("{} is java object? " + Java.isJavaObject({}));
+print("/foo/ is java object? " + Java.isJavaObject(/foo/));
+print("[] is java object? " + Java.isJavaObject([]));
+print("java.io.File is java object? " + Java.isJavaObject(java.io.File));
+
+// synchornized function checks
+Java.synchronized(function() {
+    var th = new java.lang.Thread(Java.synchronized(function() {
+        print("new thread");
+        print("notifying..");
+        lock.notifyAll();
+    }, lock));
+    th.start();
+    print("about to wait..");
+    lock.wait();
+    th.join();
+    print("done waiting!");
+}, lock)();
+
+// try Mozilla "sync" as well
+load("nashorn:mozilla_compat.js");
+sync(function() {
+    var th = new java.lang.Thread(sync(function() {
+        print("new thread");
+        print("notifying..");
+        lock.notifyAll();
+    }, lock));
+    th.start();
+    print("about to wait..");
+    lock.wait();
+    th.join();
+    print("done waiting!");
+}, lock)();
+
+function expectTypeError(func) {
+    try {
+        func();
+        throw new Error("should have thrown TypeError");
+    } catch (e) {
+        if (! (e instanceof TypeError)) {
+            fail("Expected TypeError, got " +e);
+        }
+        print(e);
+    }
+}
+
+expectTypeError(function() Java.synchronized(232));
+expectTypeError(function() sync(232));
+expectTypeError(function() Java.synchronized({}));
+expectTypeError(function() sync({}));
+expectTypeError(function() Java.synchronized([]));
+expectTypeError(function() sync([]));
+expectTypeError(function() Java.synchronized("hello"));
+expectTypeError(function() sync("hello"));
+expectTypeError(function() Java.synchronized(null));
+expectTypeError(function() sync(null));
+expectTypeError(function() Java.synchronized(undefined));
+expectTypeError(function() sync(undefined));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8049086.js.EXPECTED	Wed Jul 05 19:50:06 2017 +0200
@@ -0,0 +1,48 @@
+println is java method? true
+println is script function? false
+getProperty is java method? true
+getProperty is script function? false
+File is java method? true
+File is script function? false
+eval is script function? true
+eval is java method? false
+hello is script function? true
+hello is java method? false
+out is script object? false
+System is script object? false
+Object is script object? true
+{} is script object? true
+/foo/ is script object? true
+java.awt.Color is java function? true
+java.lang.Runnable instance is java function? true
+eval is java function? false
+println is java function? true
+getProperty is java function? true
+callable JSObject is function? true
+Non callable JSObject is function? false
+lock is java object? true
+eval is java object? false
+{} is java object? false
+/foo/ is java object? false
+[] is java object? false
+java.io.File is java object? true
+about to wait..
+new thread
+notifying..
+done waiting!
+about to wait..
+new thread
+notifying..
+done waiting!
+TypeError: 232 is not a function
+TypeError: 232 is not a function
+TypeError: [object Object] is not a function
+TypeError: [object Object] is not a function
+TypeError: [object Array] is not a function
+TypeError: [object Array] is not a function
+TypeError: hello is not a function
+TypeError: hello is not a function
+TypeError: null is not a function
+TypeError: null is not a function
+TypeError: undefined is not a function
+TypeError: undefined is not a function
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java	Wed Jul 05 19:48:51 2017 +0200
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java	Wed Jul 05 19:50:06 2017 +0200
@@ -136,8 +136,7 @@
             // Check that a new compiled script is stored in existing code cache
             e.eval(code1);
             final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
-            // Already one compiled script has been stored in the cache during initialization
-            checkCompiledScripts(stream, 2);
+            checkCompiledScripts(stream, 1);
             // Setting to default current working dir
         } finally {
             System.setProperty("user.dir", oldUserDir);
@@ -154,9 +153,8 @@
         e.eval(code1);
         e.eval(code2);
         e.eval(code3);// less than minimum size for storing
-        // Already one compiled script has been stored in the cache during initialization
         // adding code1 and code2.
         final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
-        checkCompiledScripts(stream, 3);
+        checkCompiledScripts(stream, 2);
     }
 }